Description Usage Arguments Details Examples
alm performs linear regression by absorbing one categorical variable.
Model adjustment is reported with Wald Test.
1 2 3 |
formula |
a symbolic description for the model to be estimated, |
data |
a |
subset |
see |
absorb |
a variable encode as factors. |
na.action |
see |
weights |
an optional vector of weights to be used in the fitting process. |
offset |
an optional offset that can be used to specify an a priori known component to be included during fitting. |
contrasts |
an optional list. See the |
model, x, y |
logicals. If |
... |
further arguments. |
alm fits a linear model, absorbing a set of k mutually exclusive and exhaustive binary variables, based on Frisch-Waugh-Lovell Theorem.
The intercept reported by alm, is calculated by choosing the intercept that
makes the prediction calculated at the means of the independent variables equal to the mean of the dependent variable.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Without absorb it performs like lm
## Annette Dobson (1990) "An Introduction to Generalized Linear Models".
## Page 9: Plant Weight Data.
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)
lm.D9 <- alm(weight ~ group)
lm.D90 <- lm(weight ~ group)
summary(lm.D9)
summary(lm.D90)
#Using Chile dataframe from car package, to absorb categorical region variable:
data(Chile, package="car")
fit1 = alm(formula = income ~ education + age + statusquo + region,
absorb="region", data = Chile)
summary(fit1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.