[R] Confidence bands for model estimates using ns() spline basis

From: Assaf oron <assaf.oron_at_gmail.com>
Date: Wed, 16 Jul 2008 09:43:36 -0700


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]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Jul 2008 - 16:50:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Jul 2008 - 17:31:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive