Linear Regression
Linear regression is used to explore the relationship between a continuous dependent variable, and one or more continuous and/or categorical explanatory variables. Other statistical methods, such as ANOVA and ANCOVA, are in reality just forms of linear regression.
linReg( data, dep, covs = NULL, factors = NULL, blocks = list(list()), refLevels = NULL, intercept = "refLevel", r = TRUE, r2 = TRUE, r2Adj = FALSE, aic = FALSE, bic = FALSE, rmse = FALSE, modelTest = FALSE, anova = FALSE, ci = FALSE, ciWidth = 95, stdEst = FALSE, ciStdEst = FALSE, ciWidthStdEst = 95, coefPlot = FALSE, norm = FALSE, qqPlot = FALSE, resPlots = FALSE, durbin = FALSE, collin = FALSE, cooks = FALSE, emMeans = list(list()), ciEmm = TRUE, ciWidthEmm = 95, emmPlots = TRUE, emmTables = FALSE, emmWeights = TRUE )
data |
the data as a data frame |
dep |
the dependent variable from |
covs |
the covariates from |
factors |
the fixed factors from |
blocks |
a list containing vectors of strings that name the predictors that are added to the model. The elements are added to the model according to their order in the list |
refLevels |
a list of lists specifying reference levels of the dependent variable and all the factors |
intercept |
|
r |
|
r2 |
|
r2Adj |
|
aic |
|
bic |
|
rmse |
|
modelTest |
|
anova |
|
ci |
|
ciWidth |
a number between 50 and 99.9 (default: 95) specifying the confidence interval width |
stdEst |
|
ciStdEst |
|
ciWidthStdEst |
a number between 50 and 99.9 (default: 95) specifying the confidence interval width |
coefPlot |
|
norm |
|
qqPlot |
|
resPlots |
|
durbin |
|
collin |
|
cooks |
|
emMeans |
a formula containing the terms to estimate marginal means for, supports up to three variables per term |
ciEmm |
|
ciWidthEmm |
a number between 50 and 99.9 (default: 95) specifying the confidence interval width for the estimated marginal means |
emmPlots |
|
emmTables |
|
emmWeights |
|
A results object containing:
results$modelFit |
a table | ||||
results$modelComp |
a table | ||||
results$models |
an array of model specific results | ||||
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$modelFit$asDF
as.data.frame(results$modelFit)
data('Prestige', package='carData') linReg(data = Prestige, dep = income, covs = vars(education, prestige, women), blocks = list(list('education', 'prestige', 'women'))) # # LINEAR REGRESSION # # Model Fit Measures # --------------------------- # Model R R² # --------------------------- # 1 0.802 0.643 # --------------------------- # # # MODEL SPECIFIC RESULTS # # MODEL 1 # # # Model Coefficients # -------------------------------------------------------- # Predictor Estimate SE t p # -------------------------------------------------------- # Intercept -253.8 1086.16 -0.234 0.816 # women -50.9 8.56 -5.948 < .001 # prestige 141.4 29.91 4.729 < .001 # education 177.2 187.63 0.944 0.347 # -------------------------------------------------------- #
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.