I’m trying to obtain the three parameters of the Weibull function, using the Maximum likelihood method for diameter. But I need the parameters by group.
For example: I have columns of diameter, plots 1,2, and 3, Ages 2,4,5 and,6, and densities of 200 and 300.
I need parameters for each plot, for all three ages, for the two densities.
Does anyone know how I can do that?
data_DBH <-c(9.2, 10.7, 11.5, 10.2, 10.8, 9.4, 10.4, 9.8, 7.5, 9.6, 9.8, 11.5, 9.7, 8.8, 9.3, 8.8, 9.3, 10.2, 9.7, 9.6, 8.4, 8.4, 8.1, 10.2, 9.8, 9.5, 10.6, 9.5, 9.3, 10.8, 10.4, 9, 9.3)
dweibull3 <- function(x, gamma, beta, alpha) {
(gamma/beta)*((x - alpha)/beta)^(gamma - 1) *
(exp(-((x - alpha)/beta)^gamma)) }
ll.w3 <- function(p, data)
sum(log(dweibull3(data, p[1], p[2], p[3])))
mle.w3.nm <- optim(c(gamma = 9, beta = 8, alpha = 0),
ll.w3,
data =data_DBH,
hessian = TRUE,
control = list(fnscale = -1))
mle.w3.nm$par
Gabriel Maciel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.