delta.method {alr3}R Documentation

Standard error of a nonlinear function of regression coefficients

Description

These functions use the delta method to get a first-order approximate standard error for a nonlinear function of a vector of random variables with known or estimated covariance matrix.

Usage

delta.method(object, g, parameter.prefix="b")
compute.delta.method(Var, g, values, para.name, print=TRUE)

Arguments

object A regression object of type lm, aov, glm or nls. More generally, object can be any object for which vcov(object) returns a covariance matrix and coef(object) returns a vector of parameter estimates.
g A quoted string that is the nonlinear function to be evaluated; see the details below.
values The estimated values of the parameters.
para.name Names of the parameters, as used in the expression g.
parameter.prefix If para.name is not set, then parameter names will be generated to be the parameter.prefix followed by a number. See details below.
Var Estimated or population covariance matrix of the estimates
print If TRUE, print estimates, else return a list

Details

The delta method computes the estimate and large-sample standard error of a nonlinear function of parameter estimates. Suppose the names of the parameters are “b0”, “b1”,...,“bp”, as would be the case for an object of type lm or glm with parameter.prefix left at its default value of “b”.

If the value of g were "(b2+b6*350)/(4*b4)", then the function delta.method would extract the coefficient estimates from object, and the covariance matrix from object, and pass them to compute.delta.method.

For compute.delta.method, the vector values of length p has estimated covariance matrix V, a p by p matrix. g is an expression of the form "(b2+b6*350)/(4*b4)" that gives the function of values to be evaluated. The routine evaluates g at the parameter values, and then computes g', the derivative of g with respect to the parameter names, also evaluated at the values, and then computes the standard error,

(t(g') (Var) g')^(1/2)

delta.method calls compute.delta.method, which can be used directly by providing the nonlinear function, its values, and its estimated covariance matrix.

Value

Estimate estimate of g
se Standard error of g
func g

Author(s)

Sanford Weisberg, sandy@stat.umn.edu

References

S. Weisberg (2005), Applied Linear Regression, third edition, Wiley, Section 6.1.2

Examples

# cakes is a data frame with response Y, predictors X1 X2 
data(cakes) 
m1 <- lm(Y~ X2 + I(X2^2), data = cakes) # quadratic polynomial
delta.method(m1, "-b1/(2*b2)") # X2 that maximizes the quadratic
# second order polynomial in two predictors:
m2 <- lm(Y ~ X1 + X2 + I(X1^2) + I(X2^2) + X1:X2, data=cakes)
# Find X1 to maximize Y when X2=350:
delta.method(m2,"(b1+b5*350)/(-2*b3)")

[Package Contents]