Log-Linear Regression
Log-Linear Regression
logLinear( data, factors = NULL, counts = NULL, blocks = list(list()), refLevels = NULL, modelTest = FALSE, dev = TRUE, aic = TRUE, bic = FALSE, pseudoR2 = list("r2mf"), omni = FALSE, ci = FALSE, ciWidth = 95, RR = FALSE, ciRR = FALSE, ciWidthRR = 95, emMeans = list(list()), ciEmm = TRUE, ciWidthEmm = 95, emmPlots = TRUE, emmTables = FALSE, emmWeights = TRUE )
data |
the data as a data frame |
factors |
a vector of strings naming the factors from |
counts |
a string naming a variable in |
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 |
modelTest |
|
dev |
|
aic |
|
bic |
|
pseudoR2 |
one or more of |
omni |
|
ci |
|
ciWidth |
a number between 50 and 99.9 (default: 95) specifying the confidence interval width |
RR |
|
ciRR |
|
ciWidthRR |
a number between 50 and 99.9 (default: 95) specifying the confidence interval width |
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('mtcars') tab <- table('gear'=mtcars$gear, 'cyl'=mtcars$cyl) dat <- as.data.frame(tab) logLinear(data = dat, factors = vars(gear, cyl), counts = Freq, blocks = list(list("gear", "cyl", c("gear", "cyl"))), refLevels = list( list(var="gear", ref="3"), list(var="cyl", ref="4"))) # # LOG-LINEAR REGRESSION # # Model Fit Measures # --------------------------------------- # Model Deviance AIC R²-McF # --------------------------------------- # 1 4.12e-10 41.4 1.000 # --------------------------------------- # # # MODEL SPECIFIC RESULTS # # MODEL 1 # # Model Coefficients # ------------------------------------------------------------------ # Predictor Estimate SE Z p # ------------------------------------------------------------------ # Intercept -4.71e-16 1.00 -4.71e-16 1.000 # gear: # 4 – 3 2.079 1.06 1.961 0.050 # 5 – 3 0.693 1.22 0.566 0.571 # cyl: # 6 – 4 0.693 1.22 0.566 0.571 # 8 – 4 2.485 1.04 2.387 0.017 # gear:cyl: # (4 – 3):(6 – 4) -1.386 1.37 -1.012 0.311 # (5 – 3):(6 – 4) -1.386 1.73 -0.800 0.423 # (4 – 3):(8 – 4) -26.867 42247.17 -6.36e -4 0.999 # (5 – 3):(8 – 4) -2.485 1.44 -1.722 0.085 # ------------------------------------------------------------------ # #
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.