Description Usage Arguments Value References See Also Examples
View source: R/info.mvloglin.R
Calculates the expected information matrix for a multivariate log-linear model where the parameter p, probability of an event, depends on the covariates, x = c(x[1], x[2], …, x[n]), through an exponential, p = exp(u). The variable u is a log-linear combination of the covariates via a set of coefficients, coef = c(coef[1], coef[2], …, coef[n]), u = Sum (log(coef[i]) * x[i]) i = 1, … ,n.
The usual use of this routine is for tabulated data in which case the x's will all be 0 or 1 valued indicator variables.
1 | info.mvloglin(coef, design, rss=1)
|
coef |
Vector of length p (number of covariates) giving coefficients of variables. |
design |
Matrix of dimension (n X p) each row of which gives values of covariates at one of the n design points. Note: Most models will include a constant term and the column of design corresponding to this term will be identically 1. |
rss |
The relative sample size at each design point. The default is the same sample size at each design point. If changed from the default, rss should be a vector of length n. |
The information matrix for one observation for this design.
Cox, D.R. and Hinkley, D.V. (1974). Theoretical Statistics Chapman and Hall, London.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Find the information matrix for a multivariate
# log-linear design with variables x, y and z
# Define coefficient matrix so that
# u = .1 + .2*x + .3*y + .3*z
coef <- c(.1, .2, .3, .4)
# Define the design matrix so that there are 10 design points
intercept <- rep(1, 10)
x <- seq(.1, .2, length=10)
y <- seq(.25, .3, length=10)
z <- seq(.2, .3, length=10)
design <- cbind(intercept, x, y, z)
# Use info.mvloglin to find the information matrix for
# this design
info.xyz <- info.mvloglin(coef, design)
print(info.xyz)
|
intercept x y z
intercept 4.7237667 0.34641982 0.43039106 0.29130408
x 0.3464198 0.02659991 0.03196129 0.02196045
y 0.4303911 0.03196129 0.03934650 0.02674042
z 0.2913041 0.02196045 0.02674042 0.01826283
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.