trendtesting: Performs multiple contrast test

Description Usage Arguments Value Examples

View source: R/trendtest.R

Description

This function performs a multiple contrast test. Optimal contrasts are derived based on the trend you choose.

Usage

1
2
3
4
trendtesting(muHat, S, df = NULL, doses = NULL,
  alternative = c("one.sided", "two.sided"), trend = c("CPL", "MCP Mod",
  "Aug Williams", "Williams", "Dunnett", "Linear", "Arbitrary"), model = NULL,
  muMat = NULL)

Arguments

muHat

a numeric vector of expected values in all doses groups including placebo.

S

convariance matrix.

df

specify degree freedom for multivariate t. If this argument is missing, df=0 corresponding multivariate normal.

doses

a numeric vector of specified doses. When this argument is missing, doses are the object in the specified model if model is given for MCP Mod trend test, or doses are 0 to k by 1 for all other trend test.

alternative

a single character string, specifying the alternative for the multiple contrast trend test. If this argument is missing, alternative="one.sided".

trend

a single character string, determining the trend for the multiple contrast trend test, one of "CPL", "MCP Mod","Aug Williams", "Williams", "Dunnett", "Linear","Arbitrary". Note that when "MCP_Mod" is specified for trend, model needs to be specified. When "Arbitrary" is specified, muMat needs to be specified.

model

specify models if you choose trend to be MCP Mod trend test.

muMat

a numeric vector or matrix specified for mu when trend is specified to be "Arbitrary".

Value

doses, optimal contrast, correlation contrast, test statisticis, p values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
load(DoseFinding)
transformDoses<-function(doses,mindose,mult) {
log(1+(mult/mindose)*doses)
}

itransDoses<-function(doses,mindose,mult) {
 (exp(doses)-1)*mindose/mult
}

origDose<-c(0,2.5,5,10,20,50,100,200)

transDose<-transformDoses(doses=origDose,mindose=2.5,mult=5)

dat<-data.frame(dose=as.factor(origDose),n=c(133,32,44,63,63,65,59,58),
               respn=c(13,4,5,16,12,14,14,21))
dat$resprate<-dat$respn/dat$n

dat$txeff<-dat$resprate-dat$resprate[1]

logfit<-glm(cbind(respn,n-respn)~dose+0,family=binomial,data=dat)
muHat<-coef(logfit)
S<-vcov(logfit)

model<-Mods(
 logistic=c(log(1+2*10),0.5),
 sigEmax=c(log(1+2*10),4),
 emax=c(log(1+2*0.1),log(1+2*1.0)),
 linear=NULL,
 exponential=log(1+2*1.0),
 quadratic= -1/log(1+2*550),
 doses=transDose)

test_MCP<-trendtesting(muHat=muHat, S=S, doses=transDose, alternative="one.sided", trend="MCP Mod", model=model)

#with arbitrary trend
#arbitrary mu
mu<-mu.linear(7, doses=seq(0,7,1))
test_MCP<-trendtesting(muHat=muHat, S=S, doses=transDose, alternative="one.sided", trend="Arbitrary", muMat=mu)

paulmanser/Trend-test-package documentation built on May 24, 2017, 1:40 a.m.