makeFakeData: Make a data frame of fake item data

View source: R/makeFakeData.R

makeFakeDataR Documentation

Make a data frame of fake item data

Description

makeFakeData creates a data frame containing fake item data to facilitate the writing and testing of new scoring functions. It is also used to create data for examples of scoring function usage.

Usage

makeFakeData(
  n = 20,
  nitems = 9,
  values = 0:4,
  propmiss = 0.2,
  prefix = "q",
  id = FALSE
)

Arguments

n

The number of respondents (rows) in the fake data. The default is 20.

nitems

The number of items in the fake data. The default is 9.

values

A vector of all possible values the items can take. The default is 0:4, or equivalently c(0, 1, 2, 3, 4).

propmiss

The proportion of responses that will be randomly assigned to be missing. The default is .20.

prefix

A quoted character that will be used to prefix the item numbers. The default is "q".

id

Logical, if TRUE the first variable in the data frame will be a unique row "ID". The default is FALSE, and the "ID" variable is omitted.

Details

The item responses in the first row are all the lowest possible value and never NA, and the responses on the second row are all the highest possible value and never NA. This makes it easier to check if the scoring function is at least getting the scores correct for subjects with no missing values. It also makes it easier in some cases to check that the scoring function is properly reversing the items according to the itemsrev argument of the scoring function.

Although the resulting data frame can be customized using the arguments, the default values are sufficient for most generic testing purposes (see example).

Value

A data frame with n rows, nitems items, and possibly with some missing values randomly inserted.

Examples

makeFakeData()

raybaser/PROscorerTools documentation built on Oct. 17, 2023, 8:48 p.m.