genlog.Rd
This function implements the generalized logistic analysis introduced in
Verboon & Peters (2020). This analysis fits a logistic function (i.e. a
sigmoid) to a data series. This is useful when analysing single case
designs. The function enables easy customization of the main plot elements
and easy saving of the plot with anti-aliasing. ggGenLogPlot
does
most of the plotting, and can be useful when trying to figure out sensible
starting and boundary/constraint values. genlogCompleteStartValues
tries to compute sensible starting and boundary/constraint values based on
the data.
genlog( data, timeVar = 1, yVar = 2, phaseVar = NULL, baselineMeasurements = NULL, t_eval = NULL, yRange = NULL, startInflection = NULL, startBase = NULL, startTop = NULL, startGrowthRate = NULL, startV = 1, inflectionPointBounds = NULL, growthRateBounds = c(-2, 2), baseMargin = c(0, 3), topMargin = c(-3, 0), baseBounds = NULL, topBounds = NULL, vBounds = c(1, 1), changeDelay = 4, colors = list(bottomBound = viridis::viridis(4)[4], topBound = viridis::viridis(40)[37], curve = viridis::viridis(4)[3], mid = viridis::viridis(4)[2], intervention = viridis::viridis(4)[1], points = "black", outsideRange = "black"), alphas = list(outsideRange = 0.2, bounds = 0, points = 0.5, mid = 0), theme = ggplot2::theme_minimal(), pointSize = 2, lineSize = 0.5, yBreaks = NULL, initialValuesLineType = "blank", curveSizeMultiplier = 2, showPlot = TRUE, plotLabs = NULL, outputFile = NULL, outputWidth = 16, outputHeight = 16, ggsaveParams = list(units = "cm", dpi = 300, type = "cairo"), maxiter = NULL )
data | The dataframe containing the variables for the analysis. |
---|---|
timeVar | The name of the variable containing the measurement moments (or an index of measurement moments). An index can also be specified, and assumed to be 1 if omitted. |
yVar | The name of the dependent variable. An index can also be specified, and assumed to be 2 if omitted. |
phaseVar | The variable containing the phase of each measurement. Note that this normally should only have two possible values. |
baselineMeasurements | If no phaseVar is specified,
|
t_eval | Point at which effect size (delta) is evaluated. If null then last point is taken. |
yRange | This can be used to manually specify the possible values that
the dependent variable can take. If no |
startInflection, startBase, startTop, startGrowthRate, startV | The
starting values used when estimating the sigmoid using |
inflectionPointBounds, growthRateBounds, baseMargin, topMargin, baseBounds, topBounds, vBounds | These values specify constraints to respect when estimating the parameters
of the sigmoid function using |
changeDelay | The number of measurements to add to the intervention moment when setting the initial value for the inflection point. |
colors | The colors to use for the different plot elements. |
alphas | The alpha values (transparency, or rather, 'obliqueness', with 0 indicating full transparency and 1 indicating full visibility) to use for the different plot elements. |
theme | The theme to use in the plot. |
pointSize, lineSize | The sizes of points and lines in the plot. |
yBreaks | If |
initialValuesLineType | The line type to use for the initial values; by
default set to |
curveSizeMultiplier | A multiplyer for the curve size compared to the other lines (e.g. specify '2' to have a curve of twice the size). |
showPlot | Whether to show the plot or not. |
plotLabs | A list with arguments to the |
outputFile | If not |
outputWidth, outputHeight | The dimensions of the plot when saving it
(in units specified in |
ggsaveParams | The parameters to use when saving the plot, passed on to
|
maxiter | The maximum number of iterations used by |
Mainly, this function prints its results, but it also returns them in an object containing three lists:
The arguments specified when calling the function
Intermediate objects and values
The results such as the plot.
For details, see Verboon & Peters (2020).
Verboon, P. & Peters, G.-J. Y. (2020) Applying the Generalized Logistic Model in Single Case Designs: Modeling Treatment-Induced Shifts. Behavior Modification, 44(1) https://doi.org/10.1177/0145445518791255
Peter Verboon & Gjalt-Jorn Peters (both at the Open University of the Netherlands)
Maintainer: Gjalt-Jorn Peters gjalt-jorn@userfriendlyscience.com
### Load dataset data(Singh); ### Extract Jason dat <- Singh[Singh$tier==1, ]; ### Conduct generalized logistic analysis genlog(dat, timeVar='time', yVar='score_physical', phaseVar='phase');#> Generalized Logistic Analysis (N = 16) #> #> Estimated sigmoid association between time and score_physical. #> #> Parameter starting values [and constraints]: #> Curve base: 0* [0; 3]* #> Curve top: 4* [1; 4]* #> Growth rate: 0* [-2; 2] #> Inflection point: 7* [2; 12]* #> #> Note: Asterisks (*) denote values that were not specified manually (but inferred by genlog). #> #> Parameter estimates: #> #> Curve base (plateau after change): 0.031 #> Curve top (plateau before change): 4 #> Growth rate: -1.241 #> Inflection point: 4.355 #> #> Model fit and effect sizes estimates: #> #> Deviance: 2.374 #> R squared: 0.923 #> ESc (Cohen's d-based): 2.764 #> ESr (range-based): 0.992 #> ESt (delta_ts): 2.208