Learn R Programming

Rearrangement (version 2.1)

simconboot: Simultaneous Confidence Interval Estimation using Bootstrap

Description

simconboot obtains a simultaneous confidence interval for a function. It estimates the lower and upper endpoint functions of the interval by bootstrap.

Usage

simconboot(x,y,estimator,formula,B=200,alpha=0.05,sampsize=length(x), seed=8,colInt=c(5:39)/2,...)

Arguments

x
a numerical vector of x values
y
a numerical vector of y values
estimator
estimator to be used in regression
formula
formula to be used in the estimator
B
an integer with the number of bootstrap repetitions
alpha
a real number between 0 and 1 reflecting the desired confidence level
sampsize
an integer with the sample size of each bootstrap repetition
seed
if desired, seed to be set for the random number generator
colInt
the points to be evaluated when ploting
...
further arguments to be passed to the estimator

Value

An object of class conint with the following elements:
x
the original x data
y
the original y data
sortedx
the original x data, sorted with repeated elements removed
Lower
the lower endpoint function. Represented as a vector of values corresponding to sortedx
Upper
the upper endpoint function. Represented as a vector of values corresponding to sortedx
cef
the corresponding estimates

Details

estimator can be any of a set of standard regression models, most commonly lm or rq (from package quantreg) for global estimators and the built-in functions lclm, lplm, lcrq2, lprq2 for local estimators.

Note: formula=0 for all the local estimators.

See Also

rconint

Examples

Run this code
data(GrowthChart)
attach(GrowthChart)

nage <- 2 * pi * (age - min(age)) / (max(age) - min(age))
nages <- unique(sort(nage))
formula <- height~I(sin(nage))+I(cos(nage))+I(sin(2*nage))+I(cos(2*nage))+
            I(sin(3*nage))+I(cos(3*nage))+I(sin(4*nage))+I(cos(4*nage))
j <- simconboot(nage,height,lm,formula)
plot(j, border=NA, col='darkgray',xlab = 'Age (years)',ylab = 'Height (cms)',xaxt = "n")
axis(1, at = seq(-2*pi*min(age)/(max(age)-min(age)), 2*pi+1,
        by=5*2*pi/(max(age)-min(age))), label = seq(0, max(age)+1, by=5))
points(nage,height)
lines(nages, j$cef, lty=2, col='green')

detach(GrowthChart)

Run the code above in your browser using DataLab