uwIntroStats (version 0.0.7)

lincom: Tests of Linear Combinations of Regression Coefficients

Description

Produces point estimates, interval estimates, and p values for linear combinations of regression coefficients using a uRegress object.

Usage

lincom(reg, comb, hyp=0, conf.level=.95, robustSE = TRUE, eform=reg$fnctl!="mean")

Arguments

reg

an object of class uRegress.

comb

a vector or matrix containing the values of the constants which create the linear combination of the form $$c_0 + c_1\beta_1 + \dots$$.

hyp

the null hypothesis to compare the linear combination of coefficients against. The default value is 0. An error will be thrown if the number of columns of this matrix are not equal to the number of coefficients in the model.

conf.level

a number between 0 and 1, indicating the desired confidence level for intervals.

robustSE

a logical value indicating whether or not to use robust standard errors in calculation. If TRUE, then robustSE must have been TRUE when reg was created.

eform

a logical value indicating whether or not to exponentiate the estimated coefficient. By default this is performed based on the type of regression used.

Value

Prints a matrix with the point estimate of the linear combination of coefficients, a p-value, and confidence interval.

Examples

Run this code
# NOT RUN {
# Loading required libraries
library(survival)
library(sandwich)

# Reading in a dataset
mri <- read.table("http://www.emersonstatistics.com/datasets/mri.txt",header=TRUE)
attach(mri)

# Linear regression of LDL on age (with robust SE by default)
testReg <- regress ("mean", ldl~age+stroke)

# Testing coefficient created by .5*age - stroke (the first 1 comes from including the intercept)
testC <- c(1, .5, -1)
lincom(testReg, testC)
# }

Run the code above in your browser using DataLab