| clm | R Documentation |
clm can either be used for estimating the linear model with equality constraints C * beta = d, or for
general hypothesis testing in multiple linear regression, where H0: C * beta = d and H1: otherwise
clm(formula, coef_mat, d, data = NULL, t_test = FALSE, ...)
formula |
formula passed to |
coef_mat |
the coefficient matrix C as in C * beta = d |
d |
the constant vector on the right hand side |
data |
data frame containing variables in the model |
t_test |
whether use the t test for hypothesis testing, only applicable when the coefficient matrix only has one row |
... |
additional arguments passed to |
clm returns a list containing the following components
coefficients: estimate of beta under constraints
residuals: the residuals
fitted_values: the fitted values
df_residual: the residual degree of freedom
sigma2: estimate of sigma^2, i.e. the variance of residuals
F_stat when t_test = FALSE, F-statistic testing H0: C * beta = d
t_stat: when t_test = TRUE, t-statistic testing: C * beta = d
p_value: p value of the test
y: the response
x: the model matrix
model: the model frame
df <- read.table("http://www.stat.ucla.edu/~nchristo/statistics_c173_c273/jura.txt", header = TRUE)
df <- df[, c(-1, -2, -3, -4)]
C <- matrix(
c(
0, 1, 1, 0, 0, -3, 0,
0, 0, 0, 1, 0, 1, 1
),
nrow = 2, byrow = TRUE
)
d <- c(2, 3)
clm(Pb ~ ., data = df, coef_mat = C, d = d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.