Learn R Programming

pcFactorStan (version 1.5.4)

prepFactorModel: Specify a factor model

Description

Specify a factor model with an arbitrary number of factors and arbitrary factor-to-item structure.

Usage

prepFactorModel(
  data,
  path,
  factorScalePrior = deprecated(),
  psiScalePrior = deprecated()
)

Value

a data list suitable for passing as the data

argument to pcStan or stan

Arguments

data

a data list prepared for processing by Stan

path

a named list of item names

factorScalePrior

a named numeric vector (deprecated)

psiScalePrior

matrix of priors for factor correlations (deprecated)

Details

For each factor, you need to specify its name and which items it predicts. The connections from factors to items is specified by the `path` argument. Both factors and items are specified by name (not index).

See Also

To simulate data from a factor model: generateFactorItems

Other factor model: prepSingleFactorModel()

Other data preppers: prepCleanData(), prepData(), prepSingleFactorModel()

Examples

Run this code
pa <- phyActFlowPropensity[,setdiff(colnames(phyActFlowPropensity),
                                    c('goal1','feedback1'))]
dl <- prepData(pa)
dl <- prepFactorModel(dl,
                      list(flow=c('complex','skill','predict',
                                  'creative', 'novelty', 'stakes',
                                  'present', 'reward', 'chatter',
                                  'body'),
                           f2=c('waiting','control','evaluated','spont'),
                           rc=c('novelty', 'waiting')))
str(dl)

Run the code above in your browser using DataLab