hyptest: Test of a linear hypothesis in a linear model

Description Usage Arguments Details Value Author(s) References Examples

View source: R/hyptest.R

Description

Carries out test of a single linear hypothesis in a linear model.

Usage

1
hyptest(lmobj, p, xi = 0, type = "both")

Arguments

lmobj

An object produced by lm fitting.

p

A numeric vector containing coefficients of the linear combination of model parameters.

xi

A numeric variable containing hypothesized value of the linear combination of model parameters (default = 0).

type

A character variable indicating the type of alternative: "upper" (one-sided), "lower" (one-sided) or "both" (default, two-sided).

Details

It is assumed that all the model parameters are estimable and the linear model is homoscedastic and normal.

Value

Returns the estimated value of the linear combination of model parameters, its standard error, the t-statistic, the degrees of freedom and the p-value.

Author(s)

Debasis Sengupta <shairiksengupta@gmail.com>, Jinwen Qiu <qjwsnow_ctw@hotmail.com>

References

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

Examples

1
2
3
4
data(lifelength)
lmlife <- lm(Lifelength~factor(Category), data = lifelength)
p <- c(0,0,0,1,-1,0,0,0)
hyptest(lmlife, p, xi = 1, type = "upper")

Example output

Loading required package: MASS
     estimate   stderr    tstat degf     pvalue
[1,] 6.310298 2.752794 1.929057  682 0.02706917

lmreg documentation built on May 2, 2019, 9:29 a.m.

Related to hyptest in lmreg...