| linReg {jmv} | R Documentation |
Linear Regression
linReg(data, dep, covs = NULL, factors = NULL, blocks = list(list()), refLevels = NULL, 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, 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 |
a string naming the dependent variable from |
covs |
a vector of strings naming the covariates from |
factors |
a vector of strings naming 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 |
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 |
|
qqPlot |
|
resPlots |
|
durbin |
|
collin |
|
cooks |
|
emMeans |
a list of lists specifying the variables for which the estimated marginal means need to be calculate. 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 = c('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
# --------------------------------------------------------
#