Skip to content
Prev 366860 / 398502 Next

g parameter for deltaMethod() as a function

Dear Marc,

A "wrapper function" *calls* deltaMethod(). Your function try_g() is intended to be *called by* try_g(). Actually, you just pass to deltaMethod() a character string that would evaluate to the function call, and deltaMethod() doesn't know what to do with that.

The description of the g (second) argument in ?deltaMethod seems perfectly clear to me; beyond what I quoted, in "Details" you'll find, "The argument g must be a quoted character string that gives the function [of the coefficients] of interest. For example, if you set m2 <- lm(Y ~ X1 + X2 + X1:X2), then deltaMethod(m2,"X1/X2") applies the delta method to the ratio of the coefficient estimates for X1 and X2. The argument g can consist of constants and names associated with the elements of the vector of coefficient estimates. Etc."

Try writing a function that calls deltaMethod() and does what you want.

John