simulation: Repeats the data generation process in a simulation scheme

Description Usage Arguments See Also Examples

Description

Simulates many versions of mixed data, and reports averaged proportion, mean, variance and correlation estimates across replications.

Usage

1
2
3
simulation(seed = NULL, nsim, no.rows, no.bin, no.nor, 
	mean.vec.nor = NULL, var.nor = NULL, prop.vec.bin = NULL, 
	corr.vec = NULL, corr.mat = NULL, continue.with.warning = TRUE)

Arguments

seed

A seed value for the random number generator. Seed value will be randomly generated unless specified.

nsim

Number of simulation runs.

no.rows

Number of rows.

no.bin

Number of binary variables

no.nor

Number of normal variables

prop.vec.bin

Probability vector for binary variables

mean.vec.nor

Vector of means for normal variables

var.nor

Vector of variances for normal variables

corr.vec

Vector of elements below the diagonal of correlation matrix ordered columnwise

corr.mat

Specified correlation matrix

continue.with.warning

TRUE to proceed with the nearest positive definite Σ^*. FALSE to terminate program execution if Σ^* is not positive definite

See Also

compute.sigma.star, jointly.generate.binary.normal

Examples

1
2
3
simulation(nsim=10, no.rows=100, no.bin=2, no.nor=2, 
		mean.vec.nor=c(3,1), var.nor=c(4,2), prop.vec.bin=c(0.4,0.7),
		corr.vec=c(0.16,0.04,0.38,0.14,0.47,0.68), corr.mat=NULL)

Example output

Loading required package: mvtnorm
Loading required package: corpcor
Loading required package: psych
Loading required package: Matrix
No problems are detected for the marginal specification of binary variables! 
All correlations are in feasible range! 
All correlations are in feasible range! 
No specification problems are detected for the correlation structure! 
[1] "1"                        "Sun Oct  8 18:01:39 2017"
No problems are detected for the marginal specification of binary variables! 
No problems are detected for the marginal specification of normal variables! 
[1] "2"                        "Sun Oct  8 18:01:39 2017"
No problems are detected for the marginal specification of binary variables! 
No problems are detected for the marginal specification of normal variables! 
[1] "3"                        "Sun Oct  8 18:01:39 2017"
No problems are detected for the marginal specification of binary variables! 
No problems are detected for the marginal specification of normal variables! 
[1] "4"                        "Sun Oct  8 18:01:39 2017"
No problems are detected for the marginal specification of binary variables! 
No problems are detected for the marginal specification of normal variables! 
[1] "5"                        "Sun Oct  8 18:01:39 2017"
No problems are detected for the marginal specification of binary variables! 
No problems are detected for the marginal specification of normal variables! 
[1] "6"                        "Sun Oct  8 18:01:39 2017"
No problems are detected for the marginal specification of binary variables! 
No problems are detected for the marginal specification of normal variables! 
[1] "7"                        "Sun Oct  8 18:01:39 2017"
No problems are detected for the marginal specification of binary variables! 
No problems are detected for the marginal specification of normal variables! 
[1] "8"                        "Sun Oct  8 18:01:39 2017"
No problems are detected for the marginal specification of binary variables! 
No problems are detected for the marginal specification of normal variables! 
[1] "9"                        "Sun Oct  8 18:01:39 2017"
No problems are detected for the marginal specification of binary variables! 
No problems are detected for the marginal specification of normal variables! 
[1] "10"                       "Sun Oct  8 18:01:39 2017"
No problems are detected for the marginal specification of binary variables! 
No problems are detected for the marginal specification of normal variables! 
==============================:
Desired correlation matrix:
     [,1] [,2] [,3] [,4]
[1,] 1.00 0.16 0.04 0.38
[2,] 0.16 1.00 0.14 0.47
[3,] 0.04 0.14 1.00 0.68
[4,] 0.38 0.47 0.68 1.00
Averaged correlation matrix:
           [,1]      [,2]       [,3]      [,4]
[1,]  1.0000000 0.1564190 -0.0180847 0.3640802
[2,]  0.1564190 1.0000000  0.0336575 0.3938845
[3,] -0.0180847 0.0336575  1.0000000 0.6423722
[4,]  0.3640802 0.3938845  0.6423722 1.0000000
==============================:
Desired proportion and mean parameters: 
[1] 0.4 0.7 3.0 1.0
Averaged proportion and mean parameters: 
[1] 0.391000 0.718000 2.997480 1.002811
==============================:
Target variance of normal variate(s): 
[1] 4 2
Actual variance of normal variates(s): 
[1] 4.050221 1.937046
==============================:
Seed used: 3247437 

BinNor documentation built on March 6, 2021, 1:08 a.m.