therapyMonitoring.Rd
therapyMonitor & therapyMonitor.multi are useful for simple n-of-1 designs, and were written to make it easy for therapists or other practitioners to get some insight into the effects of their treatments.
therapyMonitor(dat = NULL, design = "AB", statistic = "|A-B|", conditionColumn = NULL, variableColumn = NULL, timeColumn = NULL, conditionMoment = NULL, limit = NULL, lines = NULL, ylab = NULL, xlab = NULL, outputFile = NULL, outputFormats = c("svg", "png"), plotTitle = "therapyMonitor results", plotWidth = 25, plotHeight = 15) therapyMonitor.multi(dat = NULL, variableColumn = NULL, conditionColumn = NULL, conditionMoment = NULL, minLevels = 5, outputFiles = FALSE, outputFilePath = getwd(), outputFormats = c("svg", "png"), silent = FALSE, ...)
dat | A dataframe containing the variables to analyse. If not dataframe
is specified, get |
---|---|
design | The design to use; see |
statistic | The statistic to use; see |
conditionColumn | The name of the variable containing, for each measurement, the condition, or the phase of the treatment. This variable should normally only have two levels (e.g. 'A' and 'B'), indicating when the treatment changed from condition 'A' to condition 'B'. |
variableColumn | For |
timeColumn | The variable containing the time (datetime) of each measurement moment. If not specified in R's POSIXct format, the function tries to guess whether SPSS, SAS, or Stata timestamps were specified, and tries to convert. If the timeColumn isn't specified, the function will assume that all measurements were equidistant, and they'll simply be assigned consecutive numbers als measurement moments. |
conditionMoment | The conditionMoment argument provides an alternative method of specifying when the condition changed; this can be the number of the first measurement in the new (second) condition/phase. For example, if the treatment started after the 6th measurement, this can be specified by passing 'conditionMoment=7'. |
limit | The minimum number of consecutive measurements that has to be
available within one condition/phase to enable the analysis (see
|
lines | Which lines in the |
ylab, xlab | Labels to use when creating the plots. |
outputFile | If not NULL, the filename to write the plot to. Note that
this filename should not include the extension - this is appended based on
the |
outputFormats | Which format to use for the plot or plots to export. |
plotTitle | The title for the plot. |
plotWidth, plotHeight | The size of the plot (in centimeters). |
minLevels | The minimum number of levels that a variable in the datafile has to have before it's included in the analyses. |
outputFiles | Whether to export the plots and regular output to files. |
outputFilePath | If |
silent | Whether to suppress messages about progress etc. |
... | Additional arguments to |
For therapyMonitor, an object with the input and several output variables, as well as a plot. For therapyMonitor.multi, an object containing several therapyMonitor objects, as well as collated output.
This function started as a wrapper to the pvalue.systematic
function in the SCRT-package
, but it now also does some extra
stuff.
### Explore and plot the weight of a chick in the ChickWeight dataset therapyMonitor(ChickWeight, variableColumn='weight', conditionMoment=6, lines=1:12);#> #> Call: #> stats::lm(formula = res$intermediate$formula, data = res$intermediate$dat.raw) #> #> Residuals: #> 1 2 3 4 5 #> -0.2 0.7 0.6 -2.5 1.4 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 34.1000 1.8267 18.67 0.000336 *** #> moment 8.1000 0.5508 14.71 0.000682 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> #> Residual standard error: 1.742 on 3 degrees of freedom #> Multiple R-squared: 0.9863, Adjusted R-squared: 0.9818 #> F-statistic: 216.3 on 1 and 3 DF, p-value: 0.0006819 #> #> #> Call: #> stats::lm(formula = res$intermediate$formula, data = res$intermediate$dat.raw) #> #> Residuals: #> 6 7 8 9 10 11 12 #> 4.1429 -3.1429 -4.4286 -0.7143 1.0000 8.7143 -5.5714 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) -32.857 9.705 -3.385 0.0196 * #> moment 20.286 1.053 19.270 6.94e-06 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> #> Residual standard error: 5.57 on 5 degrees of freedom #> Multiple R-squared: 0.9867, Adjusted R-squared: 0.9841 #> F-statistic: 371.3 on 1 and 5 DF, p-value: 6.941e-06 #>#> Measured variable: weight #> Condition (phase) variable: #> Observations in raw data: 578 #> Selected observations: lines 1:12 (12 observations) #> Values: A (A, 5 observations) and #> B (B, 7 observations) #> #> Testing the difference: mean of A = 58.4 (95% CI [42.39; 74.41]) #> mean of B = 149.71 (95% CI [108.91; 190.51]) #> p = 1 #> #> Regression coefficients: at A, ß = 8.1 (95% CI [6.35; 9.85]), p = .001 #> at B, ß = 20.29 (95% CI [17.58; 22.99]), p < .001