Description Usage Arguments Details Value Note References Examples
View source: R/tx-scoreFACT_BL_CYS.R
Generates all of the scores of the Functional Assessment of Cancer Therapy - BL-CYS (FACT-BL-CYS, v4) from item responses.
1 | scoreFACT_BL_CYS(df, updateItems = FALSE, keepNvalid = FALSE)
|
df |
A data frame with the FACT-BL-CYS items, appropriately-named. |
updateItems |
Logical, if |
keepNvalid |
Logical, if |
Given a data frame that includes all of the FACT-BL-CYS (Version 4) items as variables, appropriately named, this function generates all of the FACT-BL-CYS 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
Social/Family Well-Being subscale
Emotional Well-Being subscale
Physical Well-Being subscale
FACT-G Total Score (i.e., PWB+SWB+EWB+FWB)
BL-CYS subscale
FACT-BL-CYS Total Score (i.e., PWB+SWB+EWB+FWB+BL_CYS)
FACT-BL-CYS Trial Outcome Index (e.g., PWB+FWB+BL_CYS)
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_BL-CYS
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_BL-CYS
.
FACT-BL-CYS 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
G_names <- c(paste0('GP', 1:7),
paste0('GS', 1:7),
paste0('GE', 1:6),
paste0('GF', 1:7))
AC_names <- c('C2', 'C3', 'C4', 'C6', 'C7', 'BL1', 'ITU7',
'ITU6', 'C9', 'ITU3', 'ITU4', 'ITU5', 'ITU1', 'VC1', 'ITU2')
itemNames <- c(G_names, 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_BL_CYS(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_BL_CYS(exampleDat, updateItems = TRUE, keepNvalid = TRUE)
names(scoredDat)
## Descriptives of scored scales
summary(scoredDat[, c('PWB', 'SWB', 'EWB', 'FWB', 'FACTG',
'BL_CYS', 'FACT_BL_CYS_TOTAL', 'FACT_BL_CYS_TOI')])
|
[1] "ID" "GP1" "GP2"
[4] "GP3" "GP4" "GP5"
[7] "GP6" "GP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 9 9 9 2 0 9 3 9 4
7 4 9 2 9 0 9 9 4 9 9 9 4 0 9 4 0 9 4 2 9
8 2 9 1 9 9 2 0 3 9 9 9 3 0 9 0 9 2 0 9 2
ITU5 ITU1 VC1 ITU2 PWB SWB EWB FWB FACTG BL_CYS FACT_BL_CYS_TOTAL
1 4 3 2 4 14 7.00 13.0 10.000 44.000 21.923 65.923
2 2 2 2 1 16 13.00 13.2 19.833 62.033 32.308 94.341
3 1 2 0 2 16 13.00 7.2 8.000 44.200 31.071 75.271
4 9 0 9 0 12 17.00 17.0 5.833 51.833 28.750 80.583
5 9 1 1 9 NA 16.80 NA NA NA NA NA
6 0 1 4 1 NA NA NA 12.600 NA 35.000 NA
7 3 9 0 4 NA 14.00 NA NA NA 18.333 NA
8 2 0 9 9 NA 8.75 NA 10.500 NA 31.875 NA
FACT_BL_CYS_TOI
1 45.923
2 68.141
3 55.071
4 46.583
5 NA
6 NA
7 NA
8 NA
[1] "ID" "GP1" "GP2"
[4] "GP3" "GP4" "GP5"
[7] "GP6" "GP7" "GS1"
[10] "GS2" "GS3" "GS4"
[13] "GS5" "GS6" "GS7"
[16] "GE1" "GE2" "GE3"
[19] "GE4" "GE5" "GE6"
[22] "GF1" "GF2" "GF3"
[25] "GF4" "GF5" "GF6"
[28] "GF7" "C2" "C3"
[31] "C4" "C6" "C7"
[34] "BL1" "ITU7" "ITU6"
[37] "C9" "ITU3" "ITU4"
[40] "ITU5" "ITU1" "VC1"
[43] "ITU2" "PWB_N" "SWB_N"
[46] "EWB_N" "FWB_N" "FACTG_N"
[49] "PWB" "SWB" "EWB"
[52] "FWB" "FACTG" "BL_CYS_N"
[55] "FACT_BL_CYS_TOTAL_N" "BL_CYS" "FACT_BL_CYS_TOTAL"
[58] "FACT_BL_CYS_TOI"
PWB SWB EWB FWB
Min. :12.0 Min. : 7.00 Min. : 7.20 Min. : 5.833
1st Qu.:13.5 1st Qu.:10.88 1st Qu.:11.55 1st Qu.: 8.500
Median :15.0 Median :13.00 Median :13.10 Median :10.250
Mean :14.5 Mean :12.79 Mean :12.60 Mean :11.128
3rd Qu.:16.0 3rd Qu.:15.40 3rd Qu.:14.15 3rd Qu.:12.075
Max. :16.0 Max. :17.00 Max. :17.00 Max. :19.833
NA's :4 NA's :1 NA's :4 NA's :2
FACTG BL_CYS FACT_BL_CYS_TOTAL FACT_BL_CYS_TOI
Min. :44.00 Min. :18.33 Min. :65.92 Min. :45.92
1st Qu.:44.15 1st Qu.:25.34 1st Qu.:72.93 1st Qu.:46.42
Median :48.02 Median :31.07 Median :77.93 Median :50.83
Mean :50.52 Mean :28.47 Mean :79.03 Mean :53.93
3rd Qu.:54.38 3rd Qu.:32.09 3rd Qu.:84.02 3rd Qu.:58.34
Max. :62.03 Max. :35.00 Max. :94.34 Max. :68.14
NA's :4 NA's :1 NA's :4 NA's :4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.