varfun {OptimalDesign}R Documentation

Vector of variances

Description

Computes the vector of variances (sensitivities) for a given design w.

Usage

varfun(Fx, w, crit="D", h=NULL, echo=TRUE)

Arguments

Fx

the n times m matrix of candidate regressors (as rows), where n is the number of candidate design points and m (where m>=2, m<=n) is the number of parameters.

w

a non-negative vector of length n representing the design.

crit

the criterion; possible values are "D", "A", "I", "C" and "c".

h

a non-zero vector of length m corresponding to the coefficients of the linear parameter combination of interest. If crit is not "C" nor "c" then h is ignored. If crit is "C" or "c" and h=NULL then h is assumed to be c(0,...,0,1).

echo

Print the call of the function?

Details

For D-optimality, the i-th element of the vector of variances is the variance of the best linear unbiased estimator of the mean value of observations under the experimental conditions represented by the i-th design point (where the variance of the observational errors is assumed to be 1). There is a linear transformation relation of the vector of variances and the vector of directional derivatives for the criterion of D-optimality. See the reference paper at http://www.iam.fmph.uniba.sk/design/ for mathematical details.

Value

The vector of variances (sensitivities) for a given design w.

Note

The design w should have a non-singular information matrix.

Author(s)

Radoslav Harman, Lenka Filova

See Also

effbound, dirder

Examples

# The values of the variance function (for crit=D)
# of D-, I-, and C-optimal approximate design

Fx <- Fx_cube(~x1 + I(x1^2), n.levels = 21)
wD <- od_REX(Fx)$w.best
wI <- od_REX(Fx, crit="I")$w.best
wC <- od_REX(Fx, crit="C", h=c(1, 0, 0))$w.best
vD <- varfun(Fx, wD)
vI <- varfun(Fx, wI)
vC <- varfun(Fx, wC)
plot(Fx[, 2], rep(0, nrow(Fx)), ylim = c(0, max(vD, vI, vC)),
     type = "n", xlab = "x", ylab = "var", lwd = 2)
grid()
lines(Fx[, 2], vD, col = "red")
lines(Fx[, 2], vI, col = "blue")
lines(Fx[, 2], vC, col = "green")

# The D-optimal approximate design minimized the maximum
# of the var. function (it is "G-optimal").
# The I-optimal approximate design minimizes the integral of the var. function.
# The C-optimal design with h=f(0) makes the var. function small around 0.

[Package OptimalDesign version 1.0.1 Index]