My question regards the use of the gamlss
package. I am using gamlss
package to fit a dataset to a logistic function. There is only one predictor, let me denote it with x
and because the overall dependence is not exactly sigmoid, a better model is achieved by wrapping the predictor x
in a smoother function. I chose the cubic spline smoother (cs
). The response is binomial. I'll denote it with y
:
y = cbind(number of successful events, total number - number of successful events).
The R code is the following:
cs15 <- gamlss(y~cs(x, df=15), sigma.fo=~1, family=BI, data=mydata, trace=FALSE)
I want to estimate predicted response for a set of predictors not contained in the original data set. I know this can be achieved with the function:
cs15fit = predict(cs25, newdata=data.frame(x=xnew), type="response")
However, my problem is that I also want to estimate the standard errors, which should be done by adding se.fit=T
:
cs15fit=predict(cs25, newdata=data.frame(x=xnew), type="response", se.fit=T)
But the addition of se.fit = T
produces the following error:
se.fit = TRUE is not supported for new data values at the moment
Anyone know how I can still find standard errors for the new values?
Best Answer
See the answer to this question: How are the standard errors computed for the fitted values from a logistic regression?
The linked answer relates to a glm. I am not sure whether using a smoothing term as you have done affects the standard error calculation, but it should give you an idea of how standard errors are computed in predict
.
Similar Posts:
- Solved – How to do LASSO regression with a dependent variable that is continuous between 0 and 1
- Solved – How to model a zero-inflated ‘continuous’ response data in r ‘without’ assuming an underlying normal distribution
- Solved – Why is Poisson regression different with glmer and gamlss
- Solved – Is it possible to calculate variable confidence intervals, conditional on $hat{Y}$ to address heteroscedasticity
- Solved – the impact of low predictor variance on logistic regression coefficient estimates