Simulate fitted values from an object of class nls
Simulate values from an object of class nls.
simulate_nls( object, nsim = 1, psim = 1, resid.type = c("none", "resample", "normal", "wild"), value = c("matrix", "data.frame"), data = NULL, ... )
object |
object of class |
nsim |
number of simulations to perform |
psim |
parameter simulation level, 0: for fitted values, 1: for simulation from fixed parameters (assuming a fixed vcov matrix), 2: simulation from sampling both from the parameters and the residuals, 3: for simulation considering the uncertainty in the residual standard error only (sigma) and fixing the parameter estimates at their original value; this will result in simulations similar to the observed values. |
resid.type |
either ‘none’, “resample”, “normal” or “wild”. |
value |
either ‘matrix’ or ‘data.frame’ |
data |
the data argument is needed when using this function inside user defined functions. |
... |
additional arguments (it is possible to supply a newdata this way) |
This function is based on predict.gnls
function
It returns a vector with simulated values with length equal to the number of rows in the original data
The default behavior is that simulations are perfomed for the mean function only.
When ‘psim = 2’ this function will silently choose ‘resample’ as the
‘resid.type’. This is not ideal design for this function, but I made this choice for
compatibility with other types of simulation originating from glm
and
gam
.
data(barley, package = "nlraa") fit <- nls(yield ~ SSlinp(NF, a, b, xs), data = barley) sim <- simulate_nls(fit, nsim = 100)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.