Assaf oron
2008-Jul-16 16:43 UTC
[R] Confidence bands for model estimates using ns() spline basis
Hi, I am using ns() to model the effect of time on some outcome y [ specifically, I am using polr() in a model of the form mod1=polr(y~x1+x2*ns(Year,df=3),...) , with x1 and x2 denoting several covariates each ] I understand how to use the spline basis as recorded in the model matrix in order to reproduce the model fit and to generate curves of the point estimates of the time effect, including its interactions with other covariates. My question is about confidence bands. So far, I tried to calculate these in a straightforward manner using the coefficients' estimated covariance matrix. [ e.g., Var (a+b) = Var(a) + Var(b) + 2Cov(a,b) ] Common sense suggests that the bands will be narrowest in the middle of the time period studied and widening towards the edges. However, the model fit seems to default to zero time-effect errors at the start of the period, gradually widening as time progresses - which is not supported by the data (in my case the data are almost evenly distributed across time by design). In my application the time effect is of major importance and not a nuisance variable, so it is crucial for me to get this right. I tried to add an intercept to the ns() function, but this appears to interfere with the model's intercept estimate and generates errors. Any suggestions welcome... Thanks in advance, Assaf Oron [[alternative HTML version deleted]]
Apparently Analagous Threads
- Smooth monotone estimation on R
- confidence intervals when using polr()
- Overlaying several qqnorm curves in same frame
- how to use the basis matrix of "ns" in R? really confused by multi-dim spline filtering?
- confidence variability bands for kernel estimators