Learn R Programming

lmreg (version 1.2)

cisngl: Confidence interval for a linear parametric function in a linear model

Description

Computes point estimate and confidence interval for a single linear parametric function in a linear model.

Usage

cisngl(y, X, p, alpha, type, tol=sqrt(.Machine$double.eps))

Arguments

y

Responese vector in linear model.

X

Design/model matrix or matrix containing values of explanatory variables (generally including intercept).

p

Coefficient vector of linear parametric function for which confidence interval is needed.

alpha

Non-coverage probability of confidence interval.

type

Type of confidence interval ("lower", "upper", "both").

tol

A relative tolerance to detect zero singular values while computing generalized inverse, in case X is rank deficient (default = sqrt(.Machine$double.eps)).

Value

Returns a list of two objects:

estimate

Point estimate.

ci

Confidence interval.

Details

Normal distribution of response (given explanatory variables and/or factors) is assumed.

References

Sengupta and Jammalamadaka (2019), Linear Models and Regression with R: An Integrated Approach.

Examples

Run this code
# NOT RUN {
library(MASS)
data(birthwt)
attach(birthwt)
X <- cbind(1, smoke, binaries(race))
p <- c(0,1,0,0,0)
cisngl(bwt, X, p, 0.05, type = "upper", tol = 1e-10)
cisngl(bwt, X, p, 0.05, type = "both", tol = 1e-10) 
detach(birthwt)
# }

Run the code above in your browser using DataLab