Description Usage Arguments Details Value Note References Examples
View source: R/sx-scoreFACT_COG.R
Generates all of the scores of the Functional Assessment of Cancer Therapy - Cognitive function issues - Patient Satisfaction (FACT-COG, v4) from item responses.
1 | scoreFACT_COG(df, updateItems = FALSE, keepNvalid = FALSE)
|
df |
A data frame with the FACT-COG items, appropriately-named. |
updateItems |
Logical, if |
keepNvalid |
Logical, if |
Given a data frame that includes all of the FACT-COG (Version 4) items as variables, appropriately named, this function generates all of the FACT-COG scale scores. It is crucial that the item variables in the supplied data frame are named according to FACT conventions. For example, the first Perceived Cognitive Impairments item should be named CogA1, the second CogA3, 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:
Perceived Cognitive Impairments subscale
Impact of perceived cognitive impairments on quality of life subscale
Comments from Others subscale
Perceived Cognitive Abilities subscale
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, scoreFACT_COG
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 scoreFACT_COG
.
FACT-COG Scoring Guidelines, available at http://www.facit.org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## Setting up item names for fake data
AC_names1 <- c('CogA1', 'CogA3', 'CogC7', 'CogM9', 'CogM10', 'CogM12', 'CogV13',
'CogV15', 'CogV16', 'CogV17b', 'CogF19', 'CogF23', 'CogF24', 'CogF25',
'CogC31', 'CogC32', 'CogC33a', 'CogC33c')
AC_names2 <- c('CogQ35', 'CogQ37', 'CogQ38', 'CogQ41')
AC_names3 <- c('CogO1', 'CogO2', 'CogO3', 'CogO4')
AC_names4 <- c('CogPC1', 'CogPV1', 'CogPM1','CogPM2', 'CogPF1', 'CogPCh1', 'CogPCh2')
AC_names <- c(AC_names1, AC_names2, AC_names3, AC_names4)
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 <- scoreFACT_COG(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 <- scoreFACT_COG(exampleDat, updateItems = TRUE, keepNvalid = TRUE)
names(scoredDat)
## Descriptives of scored scales
summary(scoredDat[, c('CogPCI', 'CogQOL', 'CogOth', 'CogPCA')])
|
[1] "ID" "CogA1" "CogA3" "CogC7" "CogM9" "CogM10" "CogM12"
[8] "CogV13" "CogV15" "CogV16" "CogV17b" "CogF19" "CogF23" "CogF24"
[15] "CogF25" "CogC31" "CogC32" "CogC33a" "CogC33c" "CogQ35" "CogQ37"
[22] "CogQ38" "CogQ41" "CogO1" "CogO2" "CogO3" "CogO4" "CogPC1"
[29] "CogPV1" "CogPM1" "CogPM2" "CogPF1" "CogPCh1" "CogPCh2" "CogPCI"
[36] "CogQOL" "CogOth" "CogPCA"
ID CogA1 CogA3 CogC7 CogM9 CogM10 CogM12 CogV13 CogV15 CogV16 CogV17b CogF19
1 ID1 3 3 1 2 2 9 9 1 2 1 1
2 ID2 4 4 4 3 0 4 3 2 4 2 2
3 ID3 0 3 3 3 9 3 3 2 3 0 0
4 ID4 1 9 9 4 4 0 1 1 2 0 4
5 ID5 4 9 1 9 9 3 9 2 0 9 9
6 ID6 9 9 9 9 3 9 3 9 9 4 9
7 ID7 9 9 3 9 9 9 9 9 9 1 1
8 ID8 2 2 9 1 9 3 2 2 9 1 9
CogF23 CogF24 CogF25 CogC31 CogC32 CogC33a CogC33c CogQ35 CogQ37 CogQ38
1 1 0 9 0 2 0 9 4 3 0
2 3 9 2 9 1 0 3 9 0 0
3 2 4 0 9 2 2 1 0 0 3
4 0 3 2 3 2 4 3 3 1 1
5 9 1 9 0 9 1 9 9 9 2
6 1 9 9 9 1 4 9 1 2 0
7 9 9 9 9 1 0 9 9 9 9
8 9 9 1 9 9 4 0 1 4 9
CogQ41 CogO1 CogO2 CogO3 CogO4 CogPC1 CogPV1 CogPM1 CogPM2 CogPF1 CogPCh1
1 3 2 0 1 2 2 4 2 9 2 3
2 3 3 3 2 0 2 2 3 3 4 4
3 3 2 2 2 1 0 4 3 3 0 2
4 1 4 1 2 0 2 1 2 9 2 3
5 9 9 9 2 0 0 9 3 9 3 9
6 0 2 9 9 3 9 0 9 0 1 9
7 9 3 0 2 9 9 4 0 1 4 9
8 3 9 4 4 9 3 9 9 3 1 1
CogPCh2 CogPCI CogQOL CogOth CogPCA
1 9 47.571 6.000 11.000 18.20
2 0 25.875 12.000 8.000 18.00
3 1 37.125 10.000 9.000 13.00
4 2 33.750 10.000 9.000 14.00
5 0 NA NA NA 10.50
6 9 NA 13.000 NA NA
7 9 NA NA 9.333 15.75
8 9 39.600 5.333 NA 14.00
[1] "ID" "COGA1" "COGA3" "COGC7" "COGM9" "COGM10"
[7] "COGM12" "COGV13" "COGV15" "COGV16" "COGV17B" "COGF19"
[13] "COGF23" "COGF24" "COGF25" "COGC31" "COGC32" "COGC33A"
[19] "COGC33C" "COGQ35" "COGQ37" "COGQ38" "COGQ41" "COGO1"
[25] "COGO2" "COGO3" "COGO4" "COGPC1" "COGPV1" "COGPM1"
[31] "COGPM2" "COGPF1" "COGPCH1" "COGPCH2" "CogPCI_N" "CogQOL_N"
[37] "CogOth_N" "CogPCA_N" "CogPCI" "CogQOL" "CogOth" "CogPCA"
CogPCI CogQOL CogOth CogPCA
Min. :25.88 Min. : 5.333 Min. : 8.000 Min. :10.50
1st Qu.:33.75 1st Qu.: 7.000 1st Qu.: 9.000 1st Qu.:13.50
Median :37.12 Median :10.000 Median : 9.000 Median :14.00
Mean :36.78 Mean : 9.389 Mean : 9.267 Mean :14.78
3rd Qu.:39.60 3rd Qu.:11.500 3rd Qu.: 9.333 3rd Qu.:16.88
Max. :47.57 Max. :13.000 Max. :11.000 Max. :18.20
NA's :3 NA's :2 NA's :3 NA's :1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.