pattern_char <- "++o+*-------+--+-o-o-o+o+"
### Defaults ###
# See how the weights map to the symbols (DO NOT use in practice)
weight_positive_visits(pattern_char, scale = FALSE)
# Score this use pattern via default settings
weight_positive_visits(pattern_char)
### Increase Static Weight of Missing UDS ###
# Because the score for a missing UDS from the Ling et al. (1976) paper was
# an estimated value from their data, other weights may better represent
# modern addiction behavior patterns. For instance, we believe that
# missing UDS values may be worse than a positive UDS in some instances,
# because they indicate that the subject is no longer participating in
# treatment at all. We then should change the static weights to reflect
# this.
weight_positive_visits(
pattern_char,
weights_num = c(`+` = 0.8, `*` = 0.4, `o` = 1, `-` = 0)
)
### Increasing Positive UDS Penalty ###
# Score this use pattern using an increasing positive UDS penalty (similar
# to that shown in Lint et al. (1976))
newPosPenal_num <- seq(
from = 1, to = 5,
length = stringr::str_length(pattern_char)
)
weight_positive_visits(pattern_char, posPenalty_num = newPosPenal_num)
### Variable Missing UDS Penalty ###
# Score this use pattern using a step-down missing UDS penalty (based on
# the idea that missing values during the treatment induction period are
# much worse than missing any other time in the study)
newMissPenal_num <- rep(1, stringr::str_length(pattern_char))
newMissPenal_num[1:4] <- 3
weight_positive_visits(pattern_char, missPenalty_num = newMissPenal_num)
### Composite Penalties ###
# Score this use pattern with both increasing positive UDS and step-down
# missing UDS penalties, while adjusting the weights.
weight_positive_visits(
pattern_char,
weights_num = c(`+` = 0.8, `*` = 0.4, `o` = 1, `-` = 0),
posPenalty_num = newPosPenal_num,
missPenalty_num = newMissPenal_num
)
Run the code above in your browser using DataLab