confint.ols: A 'confint' function for the 'ols'

View source: R/rms_SandwichAddon.R

confint.olsR Documentation

A confint function for the ols

Description

This function checks that there is a df.residual before running the qt(). If not found it then defaults to the qnorm() function. Otherwise it is a copy of the confint() function.

Usage

## S3 method for class 'ols'
confint(object, parm, level = 0.95, ...)

Arguments

object

a fitted ols-model object.

parm

a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.

level

the confidence level required.

...

additional argument(s) for methods.

Value

A matrix (or vector) with columns giving lower and upper confidence limits for each parameter. These will be labelled as (1-level)/2 and 1 - (1-level)/2 in

Examples

# Generate some data
n <- 500
x1 <- runif(n) * 2
x2 <- runif(n)
y <- x1^3 + x2 + rnorm(n)

library(rms)
library(sandwich)
dd <- datadist(x1, x2, y)
org.op <- options(datadist = "dd")

# Main function
f <- ols(y ~ rcs(x1, 3) + x2)

# Check the bread
bread(f)
# Check the HC-matrix
vcovHC(f, type = "HC4m")
# Adjust the model so that it uses the HC4m variance
f_rob <- robcov_alt(f, type = "HC4m")
# Get the new HC4m-matrix
# - this function just returns the f_rob$var matrix
vcov(f_rob)
# Now check the confidence interval for the function
confint(f_rob)

options(org.op)

gforge/Greg documentation built on Feb. 3, 2024, 5:37 a.m.