Learn R Programming

segmented (version 2.0-0)

confint.stepmented: Confidence intervals for breakpoints in stepmented regression

Description

Computes confidence intervals for the breakpoints in a fitted `stepmented' model.

Usage

# S3 method for stepmented
confint(object, parm, level=0.95, method=c("delta", "score", "gradient"), 
    round=TRUE, cheb=FALSE, digits=max(4, getOption("digits") - 1), 
    .coef=NULL, .vcov=NULL, ...)

Value

A matrix including point estimate and confidence limits of the breakpoint(s) for the stepmented variable possibly specified in parm.

Arguments

object

a fitted stepmented object.

parm

the stepmented variable of interest. If missing the first stepmented variable in object is considered.

level

the confidence level required, default to 0.95.

method

which confidence interval should be computed. One of "delta", "score", or "gradient". Can be abbreviated. Currently only "delta" allowed.

round

logical. Should the values (estimates and lower/upper limits) rounded to the smallest integer?

cheb

logical. If TRUE, the confidence limits are computed using the Chebyshev inequality which yields conservative confidence intervals but it is 'robust' to the non-normality of the changepoint sampling distribution.

digits

controls the number of digits to print when returning the output.

.coef

The regression parameter estimates. If unspecified (i.e. NULL), it is computed internally by coef(object).

.vcov

The full covariance matrix of estimates. If unspecified (i.e. NULL), the covariance matrix is computed internally by vcov(object).

...

additional arguments passed to vcov.stepmented, namely k.

Author

Vito M.R. Muggeo

Details

confint.stepmented computes confidence limits for the changepoints. Currently the only option is to compute the covariance matrix and to build

See Also

stepmented and lines.segmented to plot the estimated breakpoints with corresponding confidence intervals.

Examples

Run this code
set.seed(10)
x<-1:100
z<-runif(100)
y<-2+1.5*pmax(x-35,0)-1.5*pmax(x-70,0)+10*pmax(z-.5,0)+rnorm(100,0,2)
out.lm<-lm(y~x)
o<-segmented(out.lm,seg.Z=~x+z,psi=list(x=c(30,60),z=.4))
confint(o) #delta CI for the 1st variable 
confint(o, "x", method="score") #also method="g"

Run the code above in your browser using DataLab