Last data update: 2014.03.03

R: Create simulation data for multiple individuals
PSM.simulateR Documentation

Create simulation data for multiple individuals

Description

Simulates data for multiple individuals in a mixed effects model based on stochastic differential equations using an euler scheme.

Usage

PSM.simulate(Model, Data, THETA, deltaTime, longX=TRUE) 

Arguments

Model

A list containing the model components either Linear or Non-Linear Model list.*

Data

List with elements described below. No Data$Y is needed as it is generated through the simulation. The number of individuals simulated is equal to length(Data).

Time

Time vector

U

Input list for the Model

covar

Covariates list

THETA

Vector of population parameters

deltaTime

Time Step in the Euler scheme

longX

Boolean. Toggles output of the entire simulated outcome of the states

* See description in PSM.estimate.

Details

The eta is drawn from the multivariate normal distribution N(0,OMEGA). The simulation is an euler based method but for every time interval dt the model is predicted and the states affected by system noise (SIG).

The measurements are added an normal error term belonging to N(0,S).

The function mvrnorm from the MASS pacakge is used to to generate random numbers fra multivariate normal distributions.

Value

The simulated outcome of the model is returned in a list, where each element is the data for an individual.

X

Simulated states sampled at time points for measurements

Y

Simulated measurements

Time

Time points for measurements

U

Input vector used in the simulation

eta

The random effects used in the simulation

Dose

The dose list used in the simulation

longX

Entire outcome of simulated states

longTime

Time points for longX.

Note

For further details please also read the package vignette pdf-document by writing vignette("PSM") in R.

Author(s)

Stig B. Mortensen and S<c3><b8>ren Klim

References

Please visit http://www.imm.dtu.dk/psm or refer to the help page for PSM.

See Also

PSM, PSM.estimate, PSM.smooth, PSM.plot, PSM.template

Examples

cat("\nExamples are included in the package vignette.\n")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PSM)
Loading required package: MASS
Loading required package: numDeriv
Loading required package: deSolve

Attaching package: 'deSolve'

The following object is masked from 'package:graphics':

    matplot

Loading required package: ucminf
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PSM/PSM.simulate.Rd_%03d_medium.png", width=480, height=480)
> ### Name: PSM.simulate
> ### Title: Create simulation data for multiple individuals
> ### Aliases: PSM.simulate
> ### Keywords: htest models multivariate ts
> 
> ### ** Examples
> 
> cat("\nExamples are included in the package vignette.\n")

Examples are included in the package vignette.
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>