simulate_gnls {nlraa}R Documentation

Simulate fitted values from an object of class gnls

Description

Simulate values from an object of class gnls. Unequal variances, as modeled using the ‘weights’ option are supported, and there is experimental code for dealing with the ‘correlation’ structure.

Usage

simulate_gnls(
  object,
  psim = 1,
  na.action = na.fail,
  naPattern = NULL,
  data = NULL,
  ...
)

Arguments

object

object of class gnls

psim

parameter simulation level, 0: for fitted values, 1: for simulation from fixed parameters (assuming a fixed vcov matrix), 2: for simulation considering the uncertainty in the residual standard error (sigma), this returns data which will appear similar to the observed values

na.action

default ‘na.fail’. See predict.gnls

naPattern

missing value pattern. See predict.gnls

data

the data argument is needed when using this function inside user defined functions. It should be identical to the data used to fit the model.

...

additional arguments (it is possible to supply a newdata this way)

Details

This function is based on predict.gnls function

It uses function mvrnorm to generate new values for the coefficients of the model using the Variance-Covariance matrix vcov. This variance-covariance matrix refers to the one for the parameters ‘beta’, not the one for the residuals.

Value

It returns a vector with simulated values with length equal to the number of rows in the original data

See Also

predict.gnls

Examples


require(nlme)
data(barley, package = "nlraa")

fit.gnls <- gnls(yield ~ SSlinp(NF, a, b, xs), data = barley)

sim <- simulate_gnls(fit.gnls)


[Package nlraa version 1.9.7 Index]