generateFactorItems {pcFactorStan}R Documentation

Generate paired comparison data for a factor model

Description

Generate paired comparison data given a mapping from factors to items.

Usage

generateFactorItems(
  df,
  path,
  factorScalePrior = deprecated(),
  th = 0.5,
  name,
  ...,
  scale = 1,
  alpha = 1
)

Arguments

df

a data frame with pairs of vertices given in columns pa1 and pa2, and item response data in other columns

path

a named list of item names

factorScalePrior

a named numeric vector (deprecated)

th

a vector of thresholds

name

a vector of item names

...

Not used. Forces remaining arguments to be specified by name.

scale

a vector of scaling constants

alpha

a vector of item discriminations

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

Path proportions (factor-to-item loadings) are sampled from a logistic transformed normal distribution with scale 0.6. A few attempts are made to resample path proportions if any of the item proportions sum to more than 1.0. An exception will be raised if repeated attempts fail to produce viable proportion assignments.

Value

The given data.frame df with additional columns for each item. In addition, you can obtain path proportions (factor-to-item loadings) from attr(df, "pathProp"), the factor scores from attr(df, "score"), and latent worths from attr(df, "worth").

Response model

See cmp_probs for details.

Backward incompatibility

The function generateFactorItems was renamed to generateSingleFactorItems (version 1.1.0) to make space for a more flexible factor model with an arbitrary number of factors and arbitrary factor-to-item loading pattern. If you don't need this flexibility, you can call the old function generateSingleFactorItems.

References

Silver, D., Hubert, T., Schrittwieser, J., Antonoglou, I., Lai, M., Guez, A., ... & Lillicrap, T. (2018). A general reinforcement learning algorithm that masters chess, shogi, and Go through self-play. Science, 362(6419), 1140-1144.

See Also

To fit a factor model: prepFactorModel

Other item generators: generateCovItems(), generateItem(), generateSingleFactorItems()

Examples

df <- twoLevelGraph(letters[1:10], 100)
df <- generateFactorItems(df, list(f1=paste0('i',1:4),
                           f2=paste0('i',2:4)),
                      c(f1=0.9, f2=0.5))
head(df)
attr(df, "pathProp")
attr(df, "score")
attr(df, "worth")

[Package pcFactorStan version 1.5.4 Index]