linear_model: linear_model

Description Usage Arguments Value Examples

View source: R/linear_model.R

Description

Used to fit linear models.

Usage

1

Arguments

formula

a symbolic description of the model to be fitted

data

a data frame containing the variables in the model

Value

a list containing following components:

formula: the symbolic description of the model

Coefficients: the estimated coefficients for each predictor

s.e: the standard error of coefficient estimates

Cov_beta: the variance-covariance matrix of estimated coefficients

t_value: the t statistics of each coefficient

p_value: the p value of corresponding coefficients' t test

sigma_hat: the square root of MSE

R2: R square

F_statistics: the F statistics for the full model

fitted_values: the fitted mean values

residuals: the residuals, observed values mins fitted

X: the model matrix used

Y: the response used

Examples

1
2
3
4
5
6
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2, 10, 20, labels = c("Ctl","Trt"))
weight <- c(ctl, trt)
data <- data.frame(cbind(weight, group))
lm.D9 <- linear_model(weight ~ group, data)

YuxuanChen0824/R_package documentation built on Dec. 18, 2021, 8:24 p.m.