Title: | Unadjusted Group Comparisons For Likert Sum Scores |
---|---|
Description: | Performs unadjusted group comparisons for data that are sum scores of several Likert items, and produces plots that help describe patterns in the data. Models rely on Bayesian regularization and hierarchical ordinal regression. Regularization and hierarchical modeling help with stabilizing model parameters and inference about quantities of interest. Ordinal regression helps with describing the distribution of the data accurately. |
Authors: | James Uanhoro [aut, cre] |
Maintainer: | James Uanhoro <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.2.9001 |
Built: | 2024-11-14 05:02:21 UTC |
Source: | https://github.com/jamesuanhoro/ugcflss |
Performs unadjusted group comparisons for data that are sum scores of several Likert items, and produces plots that help describe patterns in the data. Models rely on Bayesian regularization and hierarchical ordinal regression. Regularization and hierarchical modeling help with stabilizing model parameters and inference about quantities of interest. Ordinal regression helps with describing the distribution of the data accurately.
For a demo, check out the vignette, vignette("ugcflss_tutorial")
Stan Development Team (NA). RStan: the R interface to Stan. R package version 2.32.6. https://mc-stan.org
Compute requested statistic for either entire sample or by group
ugcflss_describe( res_obj, by_group = FALSE, stat = "median", interval = 0.89, tau = 0.5, return_draws = FALSE )
ugcflss_describe( res_obj, by_group = FALSE, stat = "median", interval = 0.89, tau = 0.5, return_draws = FALSE )
res_obj |
Object returned by main function |
by_group |
If TRUE, compute by group. If FALSE, compute for entire sample. |
stat |
Statistic of interest, one of "median", "mean", "sd" or "quantile". |
interval |
Some quantile interval between 0 and 1 |
tau |
If stat = "quantile", the value of the probability between 0 and 1 |
return_draws |
If TRUE, do not summarize the draws. If FALSE, summarize the draws. |
Returns dataset.
Plot requested statistic for entire sample and by group
ugcflss_describe_plot(res_obj, stat = "median", interval = 0.89, tau = 0.5)
ugcflss_describe_plot(res_obj, stat = "median", interval = 0.89, tau = 0.5)
res_obj |
Object returned by main function |
stat |
Statistic of interest, one of "median", "mean", "sd" or "quantile". |
interval |
Some quantile interval between 0 and 1 |
tau |
If stat = "quantile", the value of the probability between 0 and 1 |
Returns plot
Compute CCDF for entire sample
ugcflss_exceed_all(res_obj, interval = 0.89, convergence = FALSE)
ugcflss_exceed_all(res_obj, interval = 0.89, convergence = FALSE)
res_obj |
Object returned by main function |
interval |
Some quantile interval between 0 and 1 |
convergence |
If TRUE, returns CCDF convergence statistics. If FALSE, creates dataset showing CCDF which can be used for plotting the CCDF. |
Returns dataset.
Plot CCDF for entire sample
ugcflss_exceed_all_plot(res_obj, interval = 0.89, show_intervals = FALSE)
ugcflss_exceed_all_plot(res_obj, interval = 0.89, show_intervals = FALSE)
res_obj |
Object returned by main function |
interval |
Some quantile interval between 0 and 1 |
show_intervals |
If TRUE, show intervals on plot, if FALSE, do not show intervals |
Returns plot
Compute CCDF by group
ugcflss_exceed_group(res_obj, interval = 0.89, convergence = FALSE)
ugcflss_exceed_group(res_obj, interval = 0.89, convergence = FALSE)
res_obj |
Object returned by main function |
interval |
Some quantile interval between 0 and 1 |
convergence |
If TRUE, returns CCDF convergence statistics. If FALSE, creates dataset showing CCDF which can be used for plotting the CCDF. |
Returns dataset.
Plot CCDF by group
ugcflss_exceed_group_plot(res_obj, interval = 0.89, show_intervals = FALSE)
ugcflss_exceed_group_plot(res_obj, interval = 0.89, show_intervals = FALSE)
res_obj |
Object returned by main function |
interval |
Some quantile interval between 0 and 1 |
show_intervals |
If TRUE, show intervals on plot, if FALSE, do not show intervals |
Returns plot
Major function for analyzing data.
See: vignette("ugcflss_tutorial")
for
a demonstration
ugcflss_fit_model( data, grouping_variable = NA_character_, sum_score = NA_character_, minimum_item_response = NA_integer_, maximum_item_response = NA_integer_, number_items = NA_integer_, 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), override_twenty_groups = FALSE, show_messages = TRUE )
ugcflss_fit_model( data, grouping_variable = NA_character_, sum_score = NA_character_, minimum_item_response = NA_integer_, maximum_item_response = NA_integer_, number_items = NA_integer_, 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), override_twenty_groups = FALSE, show_messages = TRUE )
data |
A dataset, ideally a data.frame. |
grouping_variable |
The name of the grouping_variable in the dataset. |
sum_score |
The name of the sum_score variable in the dataset. This variable must be whole numbers. |
minimum_item_response |
Theorical minimum value on items summed to
create sum score. For example, with Likert data with 5 response categories
coded 0,1,2,3,4, this argument would be |
maximum_item_response |
Theorical maximum value on items summed to
create sum score. For example, with Likert data with 3 response categories
coded 1,2,3, this argument would be |
number_items |
Number of items summed to create the sum score. Must be at least 1. |
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. |
override_twenty_groups |
By default, we assume your grouping_variable
does not have more than 20 levels. If you want to override this default,
add |
show_messages |
(Logical) If TRUE, show messages from Stan sampler, if FALSE, hide messages. |
Object containing analysis results.
See: vignette("ugcflss_tutorial")
for
a demonstration.
Perform pairwise comparisons of requested statistic
ugcflss_pairwise( res_obj, stat = "median", interval = 0.89, tau = 0.5, comparison = "difference", return_draws = FALSE )
ugcflss_pairwise( res_obj, stat = "median", interval = 0.89, tau = 0.5, comparison = "difference", return_draws = FALSE )
res_obj |
Object returned by main function |
stat |
Statistic of interest, one of "median", "mean", "sd", "quantile" or "ps". ps = probability of superiority. |
interval |
Some quantile interval between 0 and 1 |
tau |
If stat = "quantile", the value of the probability between 0 and 1 |
comparison |
One of difference, ratio or log-ratio. Log-ratio will lead to an error if any of the values to be logged are negative though this should not happen. |
return_draws |
If TRUE, do not summarize the draws. If FALSE, summarize the draws. |
Returns dataset
Perform pairwise comparisons of requested statistic
ugcflss_pairwise_plot( res_obj, stat = "median", interval = 0.89, tau = 0.5, comparison = "difference" )
ugcflss_pairwise_plot( res_obj, stat = "median", interval = 0.89, tau = 0.5, comparison = "difference" )
res_obj |
Object returned by main function |
stat |
Statistic of interest, one of "median", "mean", "sd", "quantile" or "ps". ps = probability of superiority. |
interval |
Some quantile interval between 0 and 1 |
tau |
If stat = "quantile", the value of the probability between 0 and 1 |
comparison |
One of difference, ratio or log-ratio. Log-ratio will lead to an error if any of the values to be logged are negative though this should not happen. |
Returns dataset
Compute posterior predictive distribution
ugcflss_ppd(res_obj, ppd_samples = 200)
ugcflss_ppd(res_obj, ppd_samples = 200)
res_obj |
Object returned by main function |
ppd_samples |
Number of iterations to use to obtain the posterior predictive distribution. |
Returns dataset
Basic PPD density overlay plot
ugcflss_ppd_plot(res_obj, ppd_samples = 200, by_group = FALSE)
ugcflss_ppd_plot(res_obj, ppd_samples = 200, by_group = FALSE)
res_obj |
Object returned by main function |
ppd_samples |
Number of iterations to use to obtain the posterior predictive distribution. |
by_group |
If TRUE, plot posterior predictive distribution by group. If FALSE, plot for entire sample. |
Returns density overlay plot