You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am one of the authors of the VFP package on CRAN which imports gnm.
Occasionally, using a custom nonlin model, the gnm fails with the error:
Error: no valid set of coefficients has been found: please supply starting values
This happens even if the exact parameters are provided as starting values.
This failure does not occur with all datasets. E.g., the following code runs, if the
data frame is restricted to lines 1:10.
I suppose it has to do with gamma models with identity link not being defined if the estimator becomes <0.
Of course this can be avoided sometimes using another parametrization, however, I want to get the variance estimates and the like on the original scale.
Here is a minimal example (using a linear model to get a reference):
Mean <- c(1237.1, 5605.55, 801.45, 2713.55, 570.4, 193.1, 97.2, 11.05,
202.5, 7031.75, 2679.6, 1252.55, 735.6, 4088.05, 9818.7, 4486.45,
3104.85, 1189.3, 217.6, 603.2, 28.45)
VC <- c(33696.08, 296681.045, 24842.205, 31777.205, 1705.28, 950.48,
2693.78, 244.205, 3026.42, 17578.125, 3.92, 8281.845, 1280.18,
76479.605, 4665.78, 130101.005, 0.125, 9800, 18355.28, 1152,
1618.805)
dat <- data.frame(Mean=Mean,VC=VC)
coeffs <- c(beta1 = 4792.94726157285, beta2 = 0.00366035757993686)
fitglm <- gnm(VC ~ I(Mean^2) , family = Gamma(link = "identity"), data = data.frame(dat), start=coeffs, trace=TRUE)
print(fitglm$coefficients)
powfun <- function(x)
{
list(
predictors=list(beta1 = 1, beta2 = 1),
variables=list(substitute(x)),
term=function(predictors,variables){
paste( predictors[1],"+",predictors[2],"*",variables[1],"^2")
}
)
}
class(powfun) <- "nonlin"
form <- VC ~ powfun(Mean)-1
fitgnm <- gnm(formula = form, family = Gamma(link = "identity"), data = data.frame(dat), start=coeffs, trace=TRUE,iterMax=100)
Kind regards
Florian
The text was updated successfully, but these errors were encountered:
Hello,
I am one of the authors of the VFP package on CRAN which imports gnm.
Occasionally, using a custom nonlin model, the gnm fails with the error:
Error: no valid set of coefficients has been found: please supply starting values
This happens even if the exact parameters are provided as starting values.
This failure does not occur with all datasets. E.g., the following code runs, if the
data frame is restricted to lines 1:10.
I suppose it has to do with gamma models with identity link not being defined if the estimator becomes <0.
Of course this can be avoided sometimes using another parametrization, however, I want to get the variance estimates and the like on the original scale.
Here is a minimal example (using a linear model to get a reference):
Mean <- c(1237.1, 5605.55, 801.45, 2713.55, 570.4, 193.1, 97.2, 11.05,
202.5, 7031.75, 2679.6, 1252.55, 735.6, 4088.05, 9818.7, 4486.45,
3104.85, 1189.3, 217.6, 603.2, 28.45)
VC <- c(33696.08, 296681.045, 24842.205, 31777.205, 1705.28, 950.48,
2693.78, 244.205, 3026.42, 17578.125, 3.92, 8281.845, 1280.18,
76479.605, 4665.78, 130101.005, 0.125, 9800, 18355.28, 1152,
1618.805)
dat <- data.frame(Mean=Mean,VC=VC)
coeffs <- c(beta1 = 4792.94726157285, beta2 = 0.00366035757993686)
fitglm <- gnm(VC ~ I(Mean^2) , family = Gamma(link = "identity"), data = data.frame(dat), start=coeffs, trace=TRUE)
print(fitglm$coefficients)
powfun <- function(x)
{
list(
predictors=list(beta1 = 1, beta2 = 1),
variables=list(substitute(x)),
term=function(predictors,variables){
paste( predictors[1],"+",predictors[2],"*",variables[1],"^2")
}
)
}
class(powfun) <- "nonlin"
form <- VC ~ powfun(Mean)-1
fitgnm <- gnm(formula = form, family = Gamma(link = "identity"), data = data.frame(dat), start=coeffs, trace=TRUE,iterMax=100)
Kind regards
Florian
The text was updated successfully, but these errors were encountered: