Fx_glm: Matrix of candidate regressors for a generalized linear model

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/Fx_glm.R

Description

Creates the matrix of all candidate regressors for a linearization of a generalized linear model.

Usage

1
2
Fx_glm(formula, theta0, glm.model="bin-logit", lower=NULL, upper=NULL,
       n.levels=NULL, echo=TRUE)

Arguments

formula

the formula of the linear part of the model. The rules for creating the formula are standard for R but: 1) the formula must not contain the dependent variable (it is one-sided); 2) the d factors (variables) must be labeled x1,x2,x3,...

theta0

the d-dimensional vector of values of the unknown parameter in which to linearize the model

glm.model

the type of the generalized linear model. Available models are "bin-logit", "bin-probit", "bin-cloglog", and Poisson-log.

lower

the d-dimensional vector of the smallest values of factors. If lower=NULL, the program sets lower <- rep(-1, d).

upper

the d-dimensional vector of the largest values of factors. If upper=NULL, the program sets upper <- rep(1, d).

n.levels

the d-dimensional vector of the numbers of levels of each factor. If n.levels=NULL, the program sets n.levels <- rep(2, d).

echo

Print the call of the function?

Details

For mathematical details, see the referenced paper.

Value

The n times m matrix of all candidate regressors of a generalized linear regression model linearized in theta0.

Author(s)

Radoslav Harman, Lenka Filova

References

Atkinson AC, Woods DC (2015). Designs for generalized linear models. Handbook of Design and Analysis of Experiments, 471-514.

See Also

Fx_cube, Fx_simplex, Fx_blocks, Fx_survival, Fx_dose

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# The logistic model with second-order predictors x1, x2 in [-1,1]
# discretized into 21 points and theta0=c(1, 2, 2, -1, -1.5, 1.5)

form.quad <- ~ x1 + x2 + I(x1*x2) + I(x1^2) + I(x2^2)
Fx <- Fx_glm(form.quad, c(1, 2, 2, -1, -1.5, 1.5),
             glm.model="bin-logit", n.levels=c(21,21))

# The locally D-optimal approximate design
w <- od_REX(Fx)$w.best
Fx.lin <- Fx_cube(form.quad, n.levels=c(21,21)) # Just for the plot
od_plot(Fx, w, Fx.lin[, 2:3], dd.size=2)

## Not run: 
#The GLM with Poisson link and 2 linear predictors x1,x2 in [-1,1]
# discretized into 21 points and theta0=c(0,2,2)
Fx <- Fx_glm(~x1+x2, c(0, 2, 2), glm.model="Poisson-log", n.levels=c(21, 21))

# The locally D-optimal exact design of size 50 without replications
w <- od_KL(Fx, 50, bin=TRUE, t.max=5)$w.best
Fx.lin <- Fx_cube(~x1+x2, n.levels=c(21, 21))
od_plot(Fx, w, Fx.lin[, 2:3], w.lim=Inf)

## End(Not run)

OptimalDesign documentation built on March 26, 2020, 9:35 p.m.