[R] Inference and confidence interval for a restricted cubic spline function in a hurdle model

From: Erik Lampa <erik.lampa_at_akademiska.se>
Date: Thu, 06 Nov 2008 12:37:10 +0100


Dear list,

I'm currently analyzing some count data using a hurdle model. I've used the rcspline.eval function in the Hmisc-library to contruct the spline terms for the regression model, and what I want in the end is the ability to compute coefficients and confidence intervals for different changes in the smooth function as well as plotting the smooth function along with the confidence interval at the values of the x-variable.

An example using the "zero"-part of the hurdle model:

library(Hmisc)
library(pscl)

# Simulate some data

set.seed(1)
y<-c(rep(0,50),rnbinom(50,0.9,0.2))
x<-sin(y)+rnorm(100)

# Set up the spline terms

ssp<-rcspline.eval(x,inclx=T)

# Fit the model and construct the smooth function
f<-hurdle(y~ssp)
knots<-attr(ssp,"knots")
coef<-f$coefficients$zero
w<-rcspline.restate(knots,coef)
fun<-eval(attr(w,"function"))

The coefficient for a change in x from -0.1 to 0.1 is fun(0.1)-fun(-0.1). My question is therefore how do I compute the confidence interval for this change?

This is easy to do with the Design-library for the "zero"-part but as far as I know, zero-truncated negative binomial data can't be fitted using Design's functions as they are. Does someone know any neat tricks that would make this possible?

Any help on this would be greatly appreciated. Thanks for your time.

/Erik Lampa, Statistician, Uppsala University Hospital, Sweden

        [[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 Thu 06 Nov 2008 - 11:41:25 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 Thu 06 Nov 2008 - 12:30:22 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