trendpowfn: Calculate power for multiple contrast tests

Description Usage Arguments Value Examples

View source: R/power.R

Description

Calculate power for a multiple contrast test for a specified trend type.

Usage

1
2
3
4
trendpowfn(mu = NULL, altModel = NULL, n = NULL, sigma = NULL,
  S = NULL, df = NULL, doses = NULL, trend = c("CPL", "MCP Mod",
  "Aug Williams", "Williams", "Dunnett", "Linear"), model = NULL,
  alternative = "one.sided", alpha = 0.05)

Arguments

mu,

altModel mu is mean values in all doses groups including placebo. It could be a vector of arbitrary values or an object from CPL. Need to be a matrix with rows equal to number of doses. altModel is an object of class "Mods", see Mods in DoseFinding package for detail. It is used to define mean values. Either mu or altModel needs to be specified. Specify mu if you want to an arbitrary mu or an object from CPL, or specify altModel if you want to use an object from MCP Mods.

n,

sigma, S n is a numeric vector of sample sizes in all doses groups including placebo. Either a vector n and sigma or S need to be specified it is assumed computation are made for a normal homoscedastic model with group sample sizes given by n and residual standard deviation sigma, i.e. the covariance matrix used for estiamtes is thus sigma^2*diag(1/n) and the degrees of freedom are caculated as sum(n)- length(mu). When S is specified this will be used as convariance matrix for the estimates.

df

degrees of freedom n, need to specify when S is given.

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. You can assign less levels of doses. mu will be adjusted correspondingly.

trend

a single character string, determining the trend for the multiple contrast trend test, one of "CPL", "MCP Mod","Aug Williams", "Williams", "Dunnett", "Linear". 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

alternative

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

alpha

significance level to use. If this argument is missing, alpha=0.05.

Value

true mean, optimal contrast, mean matrix, power.

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
N<-150
n0<-30
n1<-30
k<-5
n<-c(n0, rep(n1,k))
transdose<-function(F, k, T){
dose<-F^(seq(0, k-1, by=1)/(k-1)	)
log(1+T*dose)
}

transDose<-transdose(F=50, k=k, T=2)


models<-Mods(emax=c(log(1+2*0.01),log(1+2*0.25),log(1+2*4)),
          linear=NULL,
          exponential=c(log(1+2*0.25), log(1+2*0.75), log(1+2*3.5)),
          sigEmax=rbind(c(log(1+2*1),25), c(log(1+2*5),25), c(log(1+2*15),25),c(log(1+2*1),5), c(log(1+2*5),5), c(log(1+2*15),5) ),
          doses=c(0, transDose), placEff=0, maxEff=0.7)


MCP_models<-Mods(emax=c(log(1+2*0.01),log(1+2*0.25),log(1+2*4)),
                linear=NULL,
                exponential=c(log(1+2*0.25), log(1+2*0.75), log(1+2*3.5)),
                sigEmax=rbind( c(log(1+2*1),5), c(log(1+2*5),5), c(log(1+2*15),5) ),
                doses=c(0,transDose), placEff=0, maxEff=0.7)


trendpow<-trendpowfn(altModel=models,n=rep(30,6), sigma=1,doses=c(0,transDose), alpha=0.05, trend="MCP Mod", model=MCP_models)

mufrmCPL<-t(mu.piecewise(5,doses=transDose))

trendpow<-trendpowfn(mu=mufrmCPL,n=rep(30,6), sigma=1,doses=c(0,transDose), alpha=0.05, trend="MCP Mod", model=MCP_models)

paulmanser/Trend-test-package documentation built on May 24, 2019, 8:45 p.m.