search for: numdeltamethod

Displaying 1 result from an estimated 1 matches for "numdeltamethod".

2011 Feb 15
0
Delta method using numerical derivatives
...h.hi[i] lo[i] <- x[i] - h.lo[i] if (ny==1L) df[i] <- (func(hi, ...) - func(lo, ...))/twoeps[i] else df[i,] <- (func(hi, ...) - func(lo, ...))/twoeps[i] } return(df) } ## fun: takes coef as its first argument ## requires: coef() and vcov() on the object numDeltaMethod <- function(object,fun,...) { coef <- coef(object) est <- fun(coef,...) Sigma <- vcov(object) gd <- grad(fun,coef,...) se.est <- as.vector(sqrt(diag(t(gd) %*% Sigma %*% gd))) data.frame(Estimate = est, SE = se.est) } predictnl <- function (object, ...) UseMethod(...