| update.RprobitB_fit | R Documentation |
Refits a choice model with a modified specification.
## S3 method for class 'RprobitB_fit'
update(object, formula., ..., evaluate = TRUE)
object |
[ |
formula. |
[ |
... |
Arguments of |
evaluate |
[ |
Arguments that are not specified are taken from object.
The model formula is updated part by part, so . ~ . + income extends the
covariates that are constant across alternatives and leaves the other two
formula parts unchanged.
The choice data of object are reused, also if they were simulated, which
makes the updated model comparable to object. Supply data to fit the
updated model to other choice data.
An object of class RprobitB_fit, or the updated call if evaluate is
FALSE.
### simulate choice data and fit a model with two covariates
set.seed(1)
model <- fit(
choice ~ x + y | 0, dgp_parameters = list(beta = c(x = 1, y = -0.5)),
chains = 1
)
summary(model)
### drop `y` from the formula, the other formula parts stay as they are
model_2 <- update(model, . ~ . - y)
summary(model_2)
### let the coefficient of `x` vary across deciders instead
model_3 <- update(model, random_effects = "x")
summary(model_3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.