VSS.simulate {psych}R Documentation

create VSS like data

Description

Simulation is one of most useful techniques in statistics and psychometrics. Here we simulate a correlation matrix with a simple structure composed of a specified number of factors. Each item is assumed to have complexity one.

Usage

VSS.simulate(ncases, nvariables, nfactors, meanloading)

Arguments

ncases number of simulated subjects
nvariables Number of variables
nfactors Number of factors to generate
meanloading with a mean loading

Value

a ncases x nvariables matrix

Author(s)

William Revelle

See Also

VSS, ICLUST

Examples

## Not run: 
simulated <- VSS.simulate(1000,20,4,.6)
vss <- VSS(simulated,rotate="varimax")
VSS.plot(vss)
## End(Not run)
## The function is currently defined as
function(ncases,nvariables,nfactors,meanloading)    
#generates a simple structure factor matrix
                                #with nfactors

{                                                                   
weight=sqrt(1-meanloading*meanloading)    #loadings are path coefficients
theta=matrix(rnorm(ncases*nfactors),nrow=ncases,ncol=nvariables) 
#generates nfactor independent columns, repeated nvariable/nfactor times)
error=matrix(rnorm(ncases*nvariables),nrow=ncases,ncol=nvariables)
#errors for all variables
items=meanloading*theta+weight*error      
#observed score = factor score + error score
return(items)
  }

[Package psych version 1.0-18 Index]