milanwiedemann / suddengains Goto Github PK
View Code? Open in Web Editor NEWAn R package for identifying sudden gains in longitudinal data
Home Page: https://milanwiedemann.github.io/suddengains/
License: Other
An R package for identifying sudden gains in longitudinal data
Home Page: https://milanwiedemann.github.io/suddengains/
License: Other
this is needed when the end of tx assessment should not be part of the sg_var_list
less copy&paste!
set sg criteria in function, enter 3 pregain and 3 postgain values as voctor list or input (maybe also base::readline ...), this would also work great as shiny app
see this paper for the method: Hayes, A. M., Feldman, G. C., Beevers, C. G., Laurenceau, J.-P., Cardaciotto, L., & Lewis-Smith, J. (2007). Discontinuities and cognitive changes in an exposure-based cognitive therapy for depression. Journal of Consulting and Clinical Psychology, 75(3), 409–421. https://doi.org/10.1037/0022-006X.75.3.409
As raised by a reviewer, it might be of interest to set individual cut offs for each participant. This would be similar to the modification of the third criterion used by Kelly et al 2005 and 2007 to assess stability.
This could be implemented in the R package as a modification of the first or third criterion. Computationally this approach is similar to the way the first criterion gets assessed.
Conceptually the way individual cut off scores are calculated would is closer to third criterion (stability). There could also be other useful applications of individual cut off scores calculated in a different way to Kelly et al.
Kelly, M. A. R., Cyranowski, J. M., & Frank, E. (2007). Sudden gains in interpersonal psychotherapy for depression. Behaviour Research and Therapy, 45(11), 2563–2572. https://doi.org/10.1016/j.brat.2007.07.007
Kelly, M. A. R., Roberts, J. E., & Ciesla, J. A. (2005). Sudden gains in cognitive behavioral treatment for depression: When do they occur and do they matter? Behaviour Research and Therapy, 43(6), 703–714. https://doi.org/10.1016/j.brat.2004.06.002
mode all the scripts I have for testing into a proper R package testing workflow
for example class by_sg_data by_person_data, maybe this could also contain info about which gain was selected for the by_person data set
As raised during peer review, consider implementing different approaches to calculate the standard deviation for criterion 3. The method currently implemented in the package represents an independent sample t test.
Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences. New York, NY: Routledge Academic.
Glass, G. V., McGaw, B., and Smith, M. L. (1981). Meta-Analysis in Social Research. Beverly Hills, CA: Sage.
similar to sgdata, but not as a sample dataset. this will just be for testing special cases of sudden gains, e.g. missing data in pre or post
this is already possible for the first sg_crit1_cutoff = 0
and second criterion sg_crit2_cutoff = 0
but not for the third criterion. in code this could look like this: sg_crit3_cutoff = NULL
. to unify the code NULL
could also be added to the sg_crit2_cutoff
and sg_crit2_cutoff
arguments.
at the moment the option to have different colours for multiple groups doesn't work
could use base::abs(stats::qt((0.05 / 2), 4)) or something similar to change alpha, e.g.:
#' @param sg_crit3_qtp Numeric, significance level of the two-tailed student t-test to determine the critical value to be used for the third criterion.
#' Degrees of freedom are based on the number of available data in the three sessions preceding the gain and the three sessions following the gain.
for example only one pre or post gain score needs to be available. there would be different options to think about adding this, for example:
I was thinking of something like this, get vector of all ids and then sum the duplicates and missings, this can then be checked and used for error msg
ids <- sgdata$id
sum_id_duplicates <- base::sum(base::duplicated(stats::na.omit(ids)))
sum_id_missings <- base::sum(base::is.na(ids))
v0.1.0 or v0.1.1 for next release
when using the plot_sg()
function to visualise changes of scores around a sudden gain for two groups both groups need to have:
sg_crit123 = 1
when using the function to plot changes for one group that did have a sudden gain and another group that didnt have a sudden gain, this currently needs to be changed manually but overwriting sg_crit123 = 1
for all participants. the information about which group participants belong to (e.g., "group_variable"
) need to be stored in another variable and used in the group_var_name
argument.
for bysg datasets need to filter for unique IDs so that start values of cases with multiple gains only get selected once and not as often as that case had a sg/sl.
for byperson need to filter for sg/sl cases only so that not whole sample gets included in calculations for start and end value
Implement checks that test whether specific variables are present in the data set, e.g. "sg_session_n", "sg_magnitude" ...
testing this in the development branch at the moment, seems like there are some problems with the way I use the write_ functions from haven
e.g. see \link[package]{function}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.