Fx_cube {OptimalDesign}R Documentation

Matrix of candidate regressors for a model on a cuboid grid

Description

Creates the matrix of all candidate regressors for a factor regression model on a cuboid grid (up to 9 factors).

Usage

Fx_cube(formula, lower=NULL, upper=NULL, n.levels=NULL, echo=TRUE)

Arguments

formula

the formula 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,...

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?

Value

The n times m matrix of all candidate regressors for a factor regression model on a cuboid grid. The rows of Fx are the regressors f(x) for all candidate design points x.

Note

Note that Fx is not the design matrix (which is also sometimes called the regression matrix, or the model matrix). The design matrix depends on Fx as well as on the exact experimental design w. For this package, an exact experimental design is formalized as the vector of non-negative integer values corresponding to the replication of trials (observations) in individual design points. Thus, if Fx is the matrix of all candidate regressors and w is the exact design then Fx[rep(1:nrow(Fx), w),] is the actual design matrix for the experiment.

Author(s)

Radoslav Harman, Lenka Filova

See Also

Fx_simplex, Fx_blocks, Fx_glm, Fx_survival, Fx_dose

Examples

## Not run: 
# The Fx for the cubic model on a discretized interval
Fx <- Fx_cube(~x1 + I(x1^2) + I(x1^3), lower=0, upper=2, n.levels=101)

# The D-optimal design of size 20
w <- od_KL(Fx, 20, t.max=5)$w.best
od_plot(Fx, w, Fx[, 2])


# The Fx for the full quadratic response surface model on a non-convex region
Fx <- Fx_cube(~x1 + x2 + I(x1^2) + I(x2^2) + I(x1*x2), n.levels=c(51, 51))
keep <- rep(TRUE, nrow(Fx))
for(i in 1:nrow(Fx)) if(prod(abs(Fx[i, 2:3])) > 0.2) keep[i] <- FALSE
Fx <- Fx[keep, ]

# The D-optimal design of size 29 without replications
w <- od_KL(Fx, 29, bin=TRUE, t.max=5)$w.best
od_plot(Fx, w, Fx[, 2:3])


# The Fx for the chemical weighing with 3 items and a bias term
Fx <- Fx_cube(~x1 + x2 + x3, n.levels=c(3, 3, 3))

# The D-optimal design of size 12
w <- od_KL(Fx, 12, t.max=2)$w.best
od_plot(Fx, w, Fx[, 2:4])

## End(Not run)

[Package OptimalDesign version 1.0.1 Index]