I'm using betareg from the betareg package for one of my projects. I'm wondering what is the requirement for using betareg in R? I'm now having int, character and numeric data as explanatory variables and proportion data as response variable. But I keep getting this error message:
Error in optim(par = start, fn = loglikfun, gr = gradfun, method = method, : non-finite value supplied by optim
Can anyone help with this? Sample dataset:
d <- structure(list(Col1 = c(2, 2, 5, 7),
Col2 = c("ABC", "CBD", "BBD", "IOD"),
Col3 = c("AB2", "CK5", "CD3", "JO9"),
Col4 = c(121, 122, 2, 1),
Col5 = c(NA, NA, "H2Y", "KIJ_H3I"),
Col6 = c(30, 34, NA, NA),
Col7 = c("Yes_NO(12:20)", "OK_oh(23:20)", "Yes_OKOK", "KJ_34"),
Col8 = c(0.4, 0.25, 0.3, 0.6)),
class = "data.frame", row.names = c(NA, -4L)
)
The response variable is proportion from 0 to 1
Code that generate this error:
betareg(responsevariable ~., data= data,
link = "logit",link.phi = "log", model = T,type = "ML",weights = col1)