Title: | Hierarchical ordinal models for analyzing single subject designs |
---|---|
Description: | Hierarchical ordinal models for analyzing single subject designs using Bayesian models fit with Stan. |
Authors: | James Uanhoro [aut, cre] |
Maintainer: | James Uanhoro <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.0.3.9002 |
Built: | 2024-11-17 05:41:20 UTC |
Source: | https://github.com/jamesuanhoro/ssrhom |
The 'ssrhom' package.
Stan Development Team (NA). RStan: the R interface to Stan. R package version 2.32.6. https://mc-stan.org
Report an effect of interest
ssrhom_get_effect(res_obj, stat = "nap", interval = 0.95, return_draws = FALSE)
ssrhom_get_effect(res_obj, stat = "nap", interval = 0.95, return_draws = FALSE)
res_obj |
Object returned by main function |
stat |
One of |
interval |
Some quantile interval between 0 and 1 |
return_draws |
If TRUE, do not summarize the posterior samples. If FALSE, summarize the posterior samples. |
Returns dataset.
Function to list out effects computed by package.
ssrhom_list_stats(table = TRUE)
ssrhom_list_stats(table = TRUE)
table |
If TRUE, report statistics in a table describing each statistic. If FALSE, simply return statistics as a list. |
Analyze AB design
ssrhom_model_ab( data, grouping = NA_character_, condition = NA_character_, time = NA_character_, outcome = NA_character_, case = NA_character_, increase = TRUE, warmup = 750, sampling = 750, refresh = max((warmup + sampling)%/%10, 1), adapt_delta = 0.9, max_treedepth = 10, chains = 3, cores = min(chains, max(parallel::detectCores() - 2, 1)), seed = sample.int(.Machine$integer.max, 1), show_messages = TRUE )
ssrhom_model_ab( data, grouping = NA_character_, condition = NA_character_, time = NA_character_, outcome = NA_character_, case = NA_character_, increase = TRUE, warmup = 750, sampling = 750, refresh = max((warmup + sampling)%/%10, 1), adapt_delta = 0.9, max_treedepth = 10, chains = 3, cores = min(chains, max(parallel::detectCores() - 2, 1)), seed = sample.int(.Machine$integer.max, 1), show_messages = TRUE )
data |
A dataset, ideally a data.frame. |
grouping |
The name of the grouping variable in the dataset. |
condition |
The level of the grouping variable that identifies the treatment condition. |
time |
The name of the time variable. This must be a series of positive whole numbers signifiying the time the outcome was measured. |
outcome |
The name of the outcome variable. |
case |
The name of the variable that identifies different cases in the dataset. |
increase |
TRUE (Default) if increase in outcome is desirable. Set FALSE if increase in outcome is undesirable. |
warmup |
Number of iterations used to warmup the sampler, per chain. |
sampling |
Number of iterations retained for inference, per chain. |
refresh |
(Positive whole number) How often to print the status of the sampler. |
adapt_delta |
Number in (0,1). Increase to resolve divergent transitions. |
max_treedepth |
(Positive whole number) Increase to resolve problems with maximum tree depth. |
chains |
Number of chains to use. |
cores |
Number of cores to use. |
seed |
Random seed. |
show_messages |
(Logical) If TRUE, show messages from Stan sampler, if FALSE, hide messages. |
Object containing analysis results.
## Not run: tasky_model <- ssrhom_model_ab( data = tasky, grouping = "phase", condition = "B", time = "time", outcome = "count", case = "person" ) ssrhom_get_effect(tasky_model, stat = "nap") ## End(Not run)
## Not run: tasky_model <- ssrhom_model_ab( data = tasky, grouping = "phase", condition = "B", time = "time", outcome = "count", case = "person" ) ssrhom_get_effect(tasky_model, stat = "nap") ## End(Not run)
Dataset from Tasky et al. (2008)
tasky
tasky
tasky
A data frame with 70 rows and 5 colums:
The case label
Intervention phase where "B" is treatment
The count of on-task intervals out of 6
The count as a proportion
Session number
Tasky et al. (2008). Using Choice to Increase On-Task Behavior in Individuals with Traumatic Brain Injury. Journal of Applied Behavior Analysis, 41(2), 261–265. https://doi.org/10.1901/jaba.2008.41-261