View source: R/sx-scoreFACIT_CD.R
scoreFACIT_CD | R Documentation |
Generates all of the scores of the Functional Assessment of Chronic Illness Therapy - Cervical Dysplasia (FACIT_CD, v4) from item responses.
scoreFACIT_CD(df, updateItems = FALSE, keepNvalid = FALSE)
df |
A data frame with the FACIT-CD items, appropriately-named. |
updateItems |
Logical, if |
keepNvalid |
Logical, if |
Given a data frame that includes all of the FACIT-CD (Version 4) items as variables, appropriately named, this function generates all of the FACIT-CD scale scores. It is crucial that the item variables in the supplied data frame are named according to FACT conventions. For example, the first physical well-being item should be named GP1, the second GP2, and so on. Please refer to the materials provided by http://www.facit.org for the particular questionnaire you are using. In particular, refer to the left margin of the official questionnaire (i.e., from facit.org) for the appropriate item variable names.
The original data frame is returned (optionally with modified
items if updateItems = TRUE
) with new variables corresponding to
the scored scales. If keepNvalid = TRUE
, for each scored scale an
additional variable is returned that contains the number of valid
responses each respondent made to the items making up the given scale.
These optional variables have names of the format SCALENAME_N
.
The following scale scores are returned:
Physical Well-Being subscale
Treatmnet Satisfation subscale
General Perceptions subscale
Emotional Well-Being subscale
Relationships subscale
FACIT-CD Total Score (i.e., PWB+TS+GP+EWB+REL)
Keep in mind that this function (and R in general) is case-sensitive.
All variables should be in numeric or integer format.
This scoring function expects missing item responses to be coded as NA, 8, or 9, and valid item responses to be coded as 0, 1, 2, 3, or 4. Any other value for any of the items will result in an error message and no scores.
Some item variables are reverse coded for the purpose of generating the
scale scores. The official (e.g., from http://www.facit.org) SAS
and SPSS scoring algorithms for this questionnaire automatically replace
the original items with their reverse-coded versions. This can be
confusing if you accidentally run the algorithm more than once on your
data. As its default, scoreFACIT_CD
DOES NOT replace any of your
original item variables with the reverse coded versions. However, for
consistentcy with the behavior of the other versions on
http://www.facit.org, the updateItems
argument is
provided. If set to TRUE
, any item that is supposed to be
reverse coded will be replaced with its reversed version in the data
frame returned by scoreFACIT_CD
.
FACIT-CD Scoring Guidelines, available at http://www.facit.org
## Setting up item names for fake data AC_names1 <- c('CD1', 'CD2', 'CD3', 'Cx1', 'GP5', 'ES8', 'CD4', 'CD5') AC_names2 <- c('GR1', 'CD6', 'CD7', 'CD8') AC_names3 <- c('GF1', 'GF3', 'HI11', 'Sp9', 'GF7', 'CD9', 'CD10') AC_names4 <- c('CD11', 'CD12', 'CD13', 'BMT18', 'CD14', 'CD15', 'CD16', 'CD17', 'CD18', 'CD19', 'CD20') AC_names5 <- c('CD21', 'CD22', 'GS1', 'HI3') AC_names <- c(AC_names1, AC_names2, AC_names3, AC_names4, AC_names5) itemNames <- AC_names ## Generating random item responses for 8 fake respondents set.seed(6375309) exampleDat <- t(replicate(8, sample(0:4, size = length(itemNames), replace = TRUE))) ## Making half of respondents missing about 10% of items, ## half missing about 50%. miss10 <- t(replicate(4, sample(c(0, 9), prob = c(0.9, 0.1), size = length(itemNames), replace = TRUE))) miss50 <- t(replicate(4, sample(c(0, 9), prob = c(0.5, 0.5), size = length(itemNames), replace = TRUE))) missMtx <- rbind(miss10, miss50) ## Using 9 as the code for missing responses exampleDat[missMtx == 9] <- 9 exampleDat <- as.data.frame(cbind(ID = paste0('ID', 1:8), as.data.frame(exampleDat))) names(exampleDat) <- c('ID', itemNames) ## Returns data frame with scale scores and with original items untouched scoredDat <- scoreFACIT_CD(exampleDat) names(scoredDat) scoredDat ## Returns data frame with scale scores, with the appropriate items ## reverse scored, and with item values of 8 and 9 replaced with NA. ## Also illustrates the effect of setting keepNvalid = TRUE. scoredDat <- scoreFACIT_CD(exampleDat, updateItems = TRUE, keepNvalid = TRUE) names(scoredDat) ## Descriptives of scored scales summary(scoredDat[, c('PWB', 'TS', 'GP', 'EWB', 'REL', 'FACIT_CD_TOTAL')])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.