simulateData | R Documentation |
Simulate data from a given model. The dataset in the model should match the pattern of the data you are interested in. A new data set can for instance be generate with getDataTemplate.
simulateData(model)
model |
psydiff model |
### Simulation of a second order stochastic differential equation model manifestEquations <- " y = x(0); " latentEquations <- " dx(0) = x(1); dx(1) = cint + a*x(0) +b*x(1); " A0 <- diag(1,2) m0 <- c(0,1) Rchol <- matrix(10,1,1) L <- matrix(0,2,2) parameters <- list("cint" = 1, "a" = -.005, "b" = -.04) dataTemplate <- getDataTemplate(nSubjects = 1, nVariables = 1, nTimpoints = 200, dts = 1) # set up model model <- newPsydiff(dataset = dataTemplate, latentEquations = latentEquations, manifestEquations = manifestEquations, L = L, Rchol = Rchol, A0 = A0, m0 = m0, parameters = parameters) compileModel(model) datSim <- simulateData(model) plot(datSim$predictedManifest, type = "l") points(datSim$simulatedObservation)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.