update.jsdmStanFit | R Documentation |
This function allows you to update a jsdmStanFit model with new data or new
arguments to Stan. It does not support changes that require recompiling stancode -
for that you should use stan_jsdm()
. Changes to the number of sites, species or
covariates do not require recompiling stancode and can therefore be done using this
function.
## S3 method for class 'jsdmStanFit'
update(
object,
newY = NULL,
newX = NULL,
newD = NULL,
newNtrials = NULL,
newZi_X = NULL,
newShp_X = NULL,
save_data = TRUE,
...
)
object |
The jsdmStanFit model object |
newY |
New Y data, by default |
newX |
New X data, by default |
newD |
New number of latent variables, by default |
newNtrials |
New number of trials (binomial model only), by default
|
newZi_X |
New predictor data for the zi parameter in zero-inflated models,
by default |
newShp_X |
New predictor data for the family parameter in models where
the family parameter is modelled in response to data,
by default |
save_data |
Whether to save the data in the jsdmStanFit object, by default
|
... |
Arguments passed to |
An object of class jsdmStanFit
## Not run:
# MGLMM - specified by using the mglmm aliases and with direct reference to Y and
# X matrices:
mglmm_data <- mglmm_sim_data(
N = 100, S = 10, K = 3,
family = "gaussian"
)
mglmm_fit <- stan_mglmm(
Y = mglmm_data$Y, X = mglmm_data$X,
family = "gaussian"
)
mglmm_fit2 <- update(mglmm_fit, iter = 4000)
# You can also run a model by supplying the data as a list:
gllvm_data <- jsdm_sim_data(
method = "gllvm", N = 100, S = 6, D = 2,
family = "bernoulli"
)
gllvm_fit <- stan_jsdm(
dat_list = gllvm_data, method = "gllvm",
family = "bernoulli"
)
gllvm_fit
gllvm_data <- jsdm_sim_data(
method = "gllvm", N = 500, S = 4, D = 2,
family = "bernoulli"
)
gllvm_fit2 <- update(gllvm_fit, newY = gllvm_data$Y)
gllvm_fit2
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.