scb {pamfe}R Documentation

Calculate simultaneous confidence bands for a fitted pam object

Description

Calculates simultaneous confidence bands for the mixed model representation of penalized splines based on the scbM function from package AdaptFitOS. In contrast to the scbM function, confidence bands for fixed effects panel data models using the first-difference estimator (see Puetz and Kneib, 2016) are calculated.

Usage

scb(object, drv = 0, level = 0.95, pred = 500, div = 1000, pages = 0)

Arguments

object

A pam object.

drv

The derivative order. Defaults to 0, i.e. the estimated function itself is plotted. First and second derivatives are supported.

level

Level of confidence, default is 0.95.

pred

Number of grid points used for the plot of confidence bands, default is 500.

div

Precision for the integral used for calculation of the length of the curve, default is 1000.

pages

The number of pages over which to spread the output. If pages=1 then all terms will be plotted on one page in an automatic fashion. If pages=0 (default) all graphics settings are left as they are.

Details

The resulting confidence bands have (approximate) frequentist coverage probabilities with automatic bias correction (see references). Makes use of the volume-of-tube formula and the corresponding code from the libtube library by Catherine Loader (see package locfit).

Value

crit

A list of critical values.

seqx

A list of grid points for the plot of confidence bands.

Stdev

The standard deviations of estimates.

sigma2

The variance of the residuals.

drv

The derivative order.

fitted

A list of fitted values.

lcb

A list of lower bounds of confidence bands.

ucb

A list of upper bounds of confidence bands.

Author(s)

Peter Puetz ppuetz@uni-goettingen.de

References

Krivobokova, T., Kneib, T., and Claeskens, G. (2010). Simultaneous confidence bands for penalized spline estimators. Journal of the American Statistical Association, 105(490):852-863.

Puetz, P., Kneib, T. (2016). A Penalized Spline Estimator For Fixed Effects Panel Data Models. https://www.uni-goettingen.de/de/Puetz_03_2016/534166.html

Wiesenfarth, M., Krivobokova, T., Klasen, S., Sperlich, S. (2012). Direct Simultaneous Inference in Additive Models and its Application to Model Undernutrition. Journal of the American Statistical Association, 107(500): 1286-1296.

See Also

pam

Examples

library(pamfe)
# data generation: additive model with time constant indivdual fixed effects
id <- rep(1:50,each = 10)
years <- rep(1:10,50)
x1 <- runif(500)
x2 <- runif(500)
f1 <- sin(2 * pi * (x1 - 0.5)) ^ 2
f2 <- x2 * (1 - x2)
f1_s <- f1 / sd(f1)
f2_s <- f2 / sd(f2)
fe <- rep(sample(1:100,50),each = 10)
y <- fe + f1_s + f2_s + rnorm(500,sd = 0.5)
data <- as.data.frame(cbind(id,years,y,x1,x2))

# transform data set to panel data set from type "pdata.frame" from package "plm"
pdata <- pdata.frame (data, index = c("id", "years"),
                      row.names = TRUE)

# run first-difference penalized spline panel data model with generous amount of knots
mod <- pam(y ~ sfe(x1,k = 40) + sfe(x2,k = 40),data = pdata)
summary(mod)

# look at 99%-confidence bands for estimated functions and its derivatives
scb_mod <- scb(mod,level = 0.99,pages = 1)
scb_der <- scb(mod,level = 0.99,pages = 1,drv = 1)

[Package pamfe version 0.2 Index]