prepFactorModel: Specify a factor model

View source: R/fit.R

prepFactorModelR Documentation

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()
)

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).

Value

a data list suitable for passing as the data argument to pcStan or stan

See Also

To simulate data from a factor model: generateFactorItems

Other factor model: prepSingleFactorModel()

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

Examples

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)

pcFactorStan documentation built on Sept. 14, 2023, 1:09 a.m.