Description Usage Arguments Value Author(s) See Also Examples
Simulates data y.s using lavaan simulateData. The data y.s are based on samples from the posterior and represent samples from the predictive distribution.
1 |
n.r |
Sample size for the new data (y.r) |
nsim |
Number of datasets y.s to be created. |
post |
Matrix with samples from the posterior distribution for the original data y.o |
pT |
The blavaan parameter table. |
free.i |
A vector with indices for the freely estimated parameters as given in pT. |
group |
If applicable, the name of the grouping variable. |
n.groups |
If applicable, the number of groups. |
y.s |
A list containing all y.s. |
M. A. J. Zondervan-Zwijnenburg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
#the following example can be used, but takes >10 seconds
data <- data.frame(y=ChickWeight$weight,x=ChickWeight$Time)
model <- '
y ~ x #regression
y ~1 #intercept not default in lavaan (but is in blavaan)
'
reg.post <- posterior.step1(y.o=data, model=model, nburnin=5000, nsample=5000)
reg.sim <- sim.step1(n.r = 50, post=reg.post$post,
pT=reg.post$pT, free.i=reg.post$free.i, nsim = 100)
head(reg.sim$y.s[[1]])
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.