param.boot.rm {curvecomp}R Documentation

Parameteric Bootstrap Multiple Curve Comparisons for Repeated Measures

Description

Resampling-based multiple comparisons of adjusted p-values for curve observations with repeated measures.

Usage

param.boot.rm(data, treatment, nboot = 1000, type, Cmat = NULL,
  comparison.names = NULL, plot.results = TRUE, conf.level = 0.95,
  xlab = "", adj = 1.5, rounds = 3, start = 0.05, end = 0.8,
  alphas = c(0.01, 0.05, 0.1), fix.seed = FALSE, description = "")

Arguments

data

A matrix specifying data. Each row in the data represents all observations from a specific subject. It is assumed that the same number of observations are stored for each time point.

treatment

An integer specifying the number of treatments used for the dataset. treatment gives the number of time points (treatments) used for the dataset.

nboot

An integer specifying the number of bootstraps. The default option is 1000. Note that, depending on the number of bootstraps, it may take a little while to compute the results.

type

A character string specifying the contrast matrix type corresponding to the ones in contrMat() in the multcomp package.

Cmat

A matrix specifying the contrast matrix. Useful if it is none of the ones in contrMat(). Either ‘type’ or ‘Cmat’ must be specified. The default option is NULL.

comparison.names

A character vector supplying names for the comparisons implied in the contrast matrix. The default option is NULL, in which case, they are automatically generated.

plot.results

A boolean specifying whether or not the visuals for the results should be created. The default option is TRUE. All the visuals (simultaneous confidence bands, adjusted p-values, and effect size plots) will be saved in the current directory.

conf.level

A numeric that specifies the confidence level of the simultaneous confidence bands. It is one minus the familywise error rate. The default option is 0.95.

xlab

A character string specifying the name to be used for the x-axis label of the plots. The default option is the empty character string.

adj

A numeric specifying the adjustment factor for the plots. By increasing the number, more white spaces will be created in the plots. The default option is 1.5.

rounds

An integer specifying the number of decimal places to be used. The default option is 3.

start

A numeric specifying the greyscale to be used for the plot of the simultaneous confidence bands. The value must be greater than zero and less than the value specified for 'end'. The default option is 0.05.

end

A numeric specifying the greyscale to be used for the plot of the simultaneous confidence bands. The value must be greater than the value specified for 'start' and less than one. The default option is 0.8.

alphas

A numeric vector specifying the FWER cut-off values to be displayed in the plot of the adjusted p-values. The default option is c(0.01,0.05,0.10).

fix.seed

A boolean specifying whether or not the seed for the random number generation should be set. This option is useful from the reproducibility point of view. The default option is FALSE.

description

A character string specifying the experiment. The default option is the empty character string.

Value

p.value.all

A matrix specifying all the adjusted p-values for each comparison at each time point. Each row corresponds to each comparison, and each column corresponds to each time point.

p.value.comps

A numeric vector specifying all the adjusted p-values for each comparison. This is the same as the minimum adjusted p-values from each row in p.value.all.

p.value.overall

A numeric specifying the adjusted p-value for the overall conclusion. This is the same as the minimum adjusted p-value in p.value.comps.

test.statistic.all

A matrix specifying all the t-test statistics for each comparison at each time point. Each row corresponds to each comparison, and each column corresponds to each time point.

test.statistic.comps

A numeric vector specifying all the test statistics for each comparison. This is the same as the maximum test statistics from each row in test.statistic.all.

test.statistic.overall

A numeric specifying the adjusted p-value for the overall conclusion. This is the same as the maximum test statistic in test.statistic.comps.

mean.diff.mat

A matrix specifying all the mean differences for each comparison at each time point. Each row corresponds to each comparison, and each column corresponds to each time point.

upper.diff.mat

A matrix specifying all the upper bounds of the simultaneous confidence intervals for the mean differences for each comparison at each time point. Each row corresponds to each comparison, and each column corresponds to each time point.

lower.diff.mat

A matrix specifying all the lower bounds of the simultaneous confidence intervals for the mean differences for each comparison at each time point. Each row corresponds to each comparison, and each column corresponds to each time point.

es.mat

A matrix specifying all the effect sizes for each comparison at each time point. es.mat is simply test.statistic.all divided by the square root of the number of subjects (analogous to Cohen's d). Each row corresponds to each comparison, and each column corresponds to each time point.

Examples

 ### Example with 10 subjects and 3 treatments having 100 observations per treatment.
 #nboot>=1000 is strongly recommended but we use nboot=5 here
 #to cut back on run time.
 nboot<-5
 n<-10
 treatment<-3
 m<-120
 range<-c(11:110)
 means<-c(0,0.003,0.006)
 sds<-c(0.01,0.015,0.02)

 smoother<-function(data, spar=0.95)
 {
   return(smooth.spline(x=data, spar=spar)$y)
 }

 data<-c()

 set.seed(1)
 for(i in 1:treatment)
 {
   mean<-means[i]
   sd<-sds[i]
   datamat<-matrix(rnorm((n*m),mean,sd),ncol=m)
   smoothdata<-t(apply(datamat,1,smoother))
   data<-cbind(data,smoothdata[,range])
 }

 #Visualizing the data having three treatments
 plot(data[1,]~c(1:300),type='n',main="Simulated Data",
      ylim=c(min(data),max(data)),xlab="Observation",ylab="Data")
 for(j in 1:n)
 {
   lines(data[j,c(1:100)]~c(1:100),col=j)
   lines(data[j,c(101:200)]~c(101:200),col=j)
   lines(data[j,c(201:300)]~c(201:300),col=j)
 }
 abline(v=100,lty=2)
 abline(v=200,lty=2)

 #Running the test
 #May take a little while to run.

 testresults<-param.boot.rm(data=data,treatment=treatment,nboot=nboot,
 type="Tukey",fix.seed=TRUE,description=" (test_rm)")
 testresults



[Package curvecomp version 0.1.0 Index]