Learn R Programming

rstpm2 (version 1.6.9)

predictnl-methods: Estimation of standard errors using the numerical delta method.

Description

A simple, yet exceedingly useful, approach to estimate the variance of a function using the numerical delta method. A number of packages provide functions that analytically calculate the gradients; we use numerical derivatives, which generalises to models that do not offer analytical derivatives (e.g. ordinary differential equations, integration), or to examples that are tedious or error-prone to calculate (e.g. sums of predictions from GLMs).

Usage

# S4 method for mle2
predictnl(object, fun, newdata=NULL, gd=NULL, ...)
# S4 method for stpm2
predictnl(object, fun, newdata=NULL,
    link = c("I", "log", "cloglog", "logit"), gd=NULL, ...)
# S4 method for pstpm2
predictnl(object, fun, newdata=NULL,
    link = c("I", "log", "cloglog", "logit"), gd=NULL, ...)
# S4 method for aft
predictnl(object, fun, newdata=NULL,
    link = c("I", "log", "cloglog", "logit"), gd=NULL, ...)

Value

A data-frame with components Estimate, lower and

upper, with an attribute "newdata" for the newdata

data-frame.

Methods

object= "stpm2"

an stpm2 fit

Arguments

object

An object with coef, vcov and `coef<-` methods (required).

fun

A function that takes object as the first argument, possibly with newdata and other arguments (required). See notes for why it is often useful to include newdata as an argument to the function.

newdata

An optional argument that defines newdata to be passed to fun.

link

A character string to represent the link on which to calculate the variance and confidence intervals.

gd

An optional matrix of gradients. If this is not specified, then the gradients are calculated using finite differences.

...

Other arguments that are passed to fun.

Details

The confidence interval estimation is based on the delta method using numerical differentiation.

See Also

stpm2