Learn R Programming

userfriendlyscience (version 0.7.2)

therapyMonitor: therapyMonitor & therapyMonitor.multi

Description

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.

Usage

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,
                     ...)

Arguments

dat

A dataframe containing the variables to analyse. If not dataframe is specified, get getData function is used to present a dialog to the user.

design

The design to use; see pvalue.systematic in the SCRT-package for more information. Note that currently, this function always assumes an "AB" design; changing this only changes the way pvalue.systematic is called.

statistic

The statistic to use; see pvalue.systematic in the SCRT-package for more information. Note that currently, this function always assumes the "|A-B|" statistic; changing this only changes the way pvalue.systematic is called.

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 therapyMonitor, this must be a single value: the name of the variable to analyse as dependent variable. For therapyMonitor.multi, this can be a vector, in which case all the specified variables are analysed sequentially. In any case, the variable(s) specified here must have the 'interval' measurement level (i.e. be roughly continuous). For therapyMonitor.multi, if this argument is empty, all variables are used, provided they have at least minLevels levels.

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 pvalue.systematic).

lines

Which lines in the dat dataframe to use.

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 argument.

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 outputFiles is TRUE, the path where to store the output files.

silent

Whether to suppress messages about progress etc.

...

Additional arguments to therapyMonitor.multi are passed on to therapyMonitor.

Value

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.

Details

This function started as a wrapper to the pvalue.systematic function in the SCRT-package, but it now also does some extra stuff.

Examples

Run this code
# NOT RUN {
### Explore and plot the weight of a chick in the ChickWeight dataset
therapyMonitor(ChickWeight, variableColumn='weight',
               conditionMoment=6, lines=1:12);
# }

Run the code above in your browser using DataLab