| fit_weibull_plot | R Documentation |
Fits a three-parameter Weibull distribution to diameter data and optionally visualizes the fit with a histogram, fitted density curve, and confidence bands.
fit_weibull_plot(
x,
amplitude = 10,
shape = 2,
plot = TRUE,
show_ci = TRUE,
ci_level = 0.95,
ci_method = "delta",
n_boot = 1000,
main = NULL,
title.col = "black",
mid = TRUE,
line.col = "blue",
ci.col = "lightblue",
ci.alpha = 0.3,
legendPos = "topright",
lowLim = NULL,
ymax = NULL,
bg = "aliceblue",
method = "mle",
ties_method = "cheng_amin",
cex.axis = 0.6,
cex.lab = 0.8,
las = 1,
xlab = "Diameter class (cm)",
ylab = "Relative frequency (%)",
cex.legend = 1,
...
)
adjWeibull(
x,
amplitude = 10,
shape = 2,
plot = TRUE,
show_ci = TRUE,
ci_level = 0.95,
ci_method = "delta",
n_boot = 1000,
main = NULL,
title.col = "black",
mid = TRUE,
line.col = "blue",
ci.col = "lightblue",
ci.alpha = 0.3,
legendPos = "topright",
lowLim = NULL,
ymax = NULL,
bg = "aliceblue",
method = "mle",
ties_method = "cheng_amin",
cex.axis = 0.6,
cex.lab = 0.8,
las = 1,
xlab = "Diameter class (cm)",
ylab = "Relative frequency (%)",
cex.legend = 1,
...
)
x |
numeric vector of diameter observations (typically tree diameters in cm). |
amplitude |
numeric bin width for histogram (default: 10). |
shape |
numeric initial value for shape parameter (default: 2). |
plot |
logical; if TRUE, produces a histogram with fitted curve (default: TRUE). |
show_ci |
logical; if TRUE, displays confidence bands around fitted curve (default: TRUE). Only applicable when plot = TRUE and standard errors are available. |
ci_level |
numeric confidence level for bands (default: 0.95). |
ci_method |
character string for CI computation: "delta" (delta method using vcov), "bootstrap" (parametric bootstrap), or "both" (default: "delta"). |
n_boot |
integer number of bootstrap samples (default: 1000). Only used if ci_method is "bootstrap" or "both". |
main |
character string for plot title (default: NULL). |
title.col |
color for legend title (default: "black"). |
mid |
logical; if TRUE, curve is drawn from min to max of bin midpoints; if FALSE, from min to max of bin breaks (default: TRUE). |
line.col |
color for fitted curve (default: "blue"). |
ci.col |
color for confidence bands (default: "lightblue"). |
ci.alpha |
numeric transparency for confidence bands (default: 0.3). |
legendPos |
position of legend (default: "topright"). |
lowLim |
numeric lower limit for histogram breaks (default: NULL, uses min(x)). |
ymax |
numeric upper limit for y-axis (default: NULL, auto-computed). |
bg |
background color for legend box (default: "aliceblue"). |
method |
character string specifying estimation method. Options: "mle" (Maximum Likelihood - default), "mps" (Maximum Product Spacing), "mom" (Method of Moments). |
ties_method |
character string for ties correction in MPS: "cheng_amin", "none", or "cheng_stephens" (default: "cheng_amin"). Only used when method = "mps". |
cex.axis |
numeric character expansion factor for axis annotation (default: 0.6). |
cex.lab |
numeric character expansion factor for axis labels (default: 0.8). |
las |
numeric orientation of axis labels (default: 1). |
xlab |
character string for x-axis label (default: "Diameter class (cm)"). |
ylab |
character string for y-axis label (default: "Relative frequency (%)" ). |
cex.legend |
numeric character expansion factor for legend (default: 1). |
... |
additional graphical parameters passed to |
A list (invisibly) containing:
estimate |
Named vector of parameter estimates (shape, scale, location) |
se |
Standard errors (NULL if unavailable or method doesn't support it) |
vcov |
Variance-covariance matrix (NULL if unavailable) |
ci |
Confidence intervals for parameters at specified level (NULL if unavailable) |
measures |
Named vector of goodness-of-fit statistics (KS statistic, p-value, AIC, BIC) |
convergence |
Integer convergence code (0 = successful) |
method |
Character string of estimation method used |
ci_method |
Character string of confidence interval method used |
ci_level |
Numeric confidence level used |
note |
Character string with interpretation note for KS test |
fit_dist
# Simulate tree diameter data
set.seed(123)
diameters <- rweibull3(100, shape = 2.5, scale = 25, loc = 10)
# Fit with confidence bands
fit1 <- fit_weibull_plot(diameters, amplitude = 5, show_ci = TRUE)
# Fit without confidence bands
fit2 <- fit_weibull_plot(diameters, amplitude = 5, show_ci = FALSE)
# Use bootstrap confidence bands
fit3 <- fit_weibull_plot(diameters,
amplitude = 5,
ci_method = "bootstrap", n_boot = 500
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.