Reputation: 11
Good day,
An example of my data:
I ran the following codes in R:
DR_WCcomp <- read.csv("C:/Users/ottoa/Desktop/Personal Documentation/Analysis/data/DR_WCcomp.csv")
attach(DR_WCcomp)
View(DR_WCcomp)
library (DirichletReg)
head(DR_WCcomp)
WC <- DR_data(DR_WCcomp[, 7:11])
WC1 <- DirichReg(WC ~ DDH, DR_WCcomp, model = "alternative")
WC2 <- DirichReg(WC ~ DBH + H, DR_WCcomp, model = "alternative")
WC3 <- DirichReg(WC ~ DBH, DR_WCcomp, model = "alternative")
anova(WC1, WC2, WC3)
summary(WC2)
predict(WC2)
And get the error message:
Error in summary.DirichletRegModel(WC2) : Optimization did not converge in 149 + 1 iterations and exited with code 8
When I run the following code:
WC2 <- DirichReg(BM ~ DBH + H, data = DR_WCcomp, model = "alternative", control = list(interlim = 3000, tol1 = 1e-9, tol2 = 1e-9, maxit = 6000))
summary(WC2)
I get the message:
Error in model.frame.default(terms(formula, lhs = lhs, rhs = rhs, data = data, : variable lengths differ (found for 'DBH')
Then, I did some trouble shooting with the following:
sum(is.na(DR_WCcomp$DBH))
sum(is.na(DR_WCcomp$H))
sum(is.na(DR_WCcomp$Stem))
sum(is.na(DR_WCcomp$Bark))
sum(is.na(DR_WCcomp$Needle))
sum(is.na(DR_WCcomp$Branch))
sum(is.na(DR_WCcomp$Cone))
but there were no missing values for any of the columns.
Also, the command did not result in anything out of the ordinary that I could detect:
str(DR_WCcomp)
The predict(WC2) command seems to be working fine but I cant get a summary() or print() of WC2 to get the parameters of the models.
Your assistance with the trouble shooting will be much appreciated.
Cheers
Upvotes: 0
Views: 46