Skip to contents

update() modifies the stored call and refits. For the two-part formulas of iop() and iol() the formula. argument may itself be two-part: . ~ . + x3 | . adds x3 to the outcome equation and keeps the inflation equation, . ~ . | . + z2 changes only the inflation equation, and a one-part . ~ . + x3 changes the outcome equation and keeps the inflation equation (stats::update.formula() alone would fold the | into the outcome part). Other arguments replace or add to the stored call as in stats::update().

Usage

# S3 method for class 'iord'
update(object, formula., ..., evaluate = TRUE)

Arguments

object

a fitted "iord" model.

formula.

changes to the formula, as in stats::update.formula(), optionally two-part (see Description).

...

further arguments to the estimator, replacing those in the stored call (data = , se = , inflate = , ...).

evaluate

if FALSE, return the modified call unevaluated.

Value

the refitted model (or the modified call). As with every update() method, the refit evaluates the stored call in the calling environment, so the data object named in the original call must exist there; a fit restored with readRDS() in a fresh session can be updated only once that object is available again (predict(), summary(), and the table methods need nothing beyond the fit itself).

Examples

data(bp)
m <- oprobit(violence ~ loggdppc + parliament, data = bp)
m2 <- update(m, . ~ . + disaster)
m3 <- update(m, se = "robust")
## two-part formulas: change one equation at a time
mi <- iop(violence ~ loggdppc | parliament, data = bp, inflate = "bottom")
mi2 <- update(mi, . ~ . + disaster | .)     # outcome equation only
update(mi, . ~ . | . + disaster, evaluate = FALSE)   # the call that would refit
#> iop(formula = violence ~ loggdppc | parliament + disaster, data = bp, 
#>     inflate = "bottom")