make_FACTdata: Make fake FACT-like data to illustrate scoring functions

View source: R/util-make_FACTdata.R

make_FACTdataR Documentation

Make fake FACT-like data to illustrate scoring functions

Description

Generates FACT-like questionnaire answers for fake respondents.

Usage

make_FACTdata(
  namesAC = NULL,
  N = 8,
  AConly = FALSE,
  pmiss1 = 0.1,
  pmiss2 = 0.5,
  misscode = NA
)

Arguments

namesAC

Character vector of the "Additional Concerns" item names.

N

An integer specifying how many fake respondents to generate. Default is 8.

AConly

Logical, if FALSE (the default) the 27 FACT-G items will be generated in addition to items you supply to namesAC. If TRUE, then only the items you supply to namesAC are generated.

pmiss1

The proportion of items with missing answers in the first half of respondents.

pmiss2

The proportion of items with missing answers in the second half of respondents.

misscode

The value used for missing answers. Default is NA. FACTscorer functions consider values of NA, 8, and 9 to be missing answers, so these are the only 3 values for this argument useful for testing FACTscorer functions.

Details

This function is used to generate fake responses to FACT/FACIT questionnaires. It is a utility to generate example data for testing the functions and for demonstrating their usage. Missing item proportions can be specified separately for the first and second half of respondents in the generated data frame (using pmiss1 and pmiss2, respectively). If AConly = FALSE, the default, then FACT-G items will automatically be generated in addition to any "Additional Concerns" (AC) items given to namesAC. Set AConly = TRUE to generate only the AC items. If namesAC = NULL (the default), then only FACT-G items will be generated.

If AConly = TRUE then at least 2 item names must be given to namesAC.

Value

A data frame with N fake respondents (8 by default). The first half of respondents will have missing values (coded as 9) for roughly 10\ of the items, and the last half will have missing values for roughly 50\ the items.

Examples

(exampleDat <- make_FACTdata())
itemNames <- c('B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'P2')
(exampleDat <- make_FACTdata(namesAC = itemNames))
(exampleDat <- make_FACTdata(namesAC = itemNames, AConly = TRUE))

raybaser/FACTscorer documentation built on March 29, 2022, 7:50 p.m.