Description Usage Arguments Details Value See Also Examples
Creates an L matrix using expressions evaluated in data
for each column of
the L matrix
1 |
fit |
a fitted model with a |
form |
formulas (expressions) to evaluate (see Details). |
data |
the data frame in which expressions are evaluated. |
If Lform
is called with only a fit
argument, it outputs code
consisting of an expression that would, if used as the form
argument
to Lform
would generate the full model matrix for the linear model.
If Lform
is called with two or three arguments, it generates a
hypothesis matrix by evaluating the expressions in form
in the
environment data
. The function M
is designed to facilitate the
generation of blocks of the hypothesis matrix corresponding to main effects
or interaction effects of factors.
hypothesis matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | mod <- lm( income ~ (education + I(education^2) )* type, Prestige)
summary(mod)
# estimate the marginal value of an extra year of education for a
# range of years for each type
years.type <- expand.grid( education = seq(6,18,2), type = levels(Prestige$type))
Lf <- Lform( mod,
list( 0, 1, 2*education, 0, 0, type =="prof", type =="wc",
2*education*(type =="prof"), 2*education*(type =="wc")),
years.type)
Lf
ww <- wald( mod, Lf)
ww
ytderiv <- as.data.frame( ww, se = 2)
head( ytderiv )
if (require("lattice")){
xyplot(coef ~ education, ytderiv, groups = type, type = 'l',
auto.key = list(columns = 3, lines = TRUE, points = FALSE))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.