AnalyzePerformanceSimon2: Performance of estimation methods

Description Usage Arguments Details Value Author(s) See Also Examples

Description

It takes the results produced by AnalyzeSimonDsgn and AnalyzeSimonDsgnAdaptN and produces a dataframe containing bias, mean square error and variance of the estimators. It also calculates the power and the expected sample size (EN) where applicable.

Usage

1
AnalyzePerformanceSimon2(designs = "all", basedir = NA)

Arguments

designs

Taking values "fixed", "adaptive" or "all", indicating whether only classical, adaptive or all designs should be included. The default is "all".

basedir

The root directory in which simulations were performed. The current working directory is assumed by default. It must contain all the files and folders created by SimulateSimonDsgn and/or SimulateSimonDsgnAdaptN.

Details

It is the same as AnalyzePerformanceSimon, but here the estimation is done only for two sets: all trials (unconditional), and only trials that continued to final stage (conditional).

Value

Dataframe containing bias, mean square error and variance of the estimators, power, expected sample size, and design information.

Author(s)

Arsenio Nhacolo

See Also

AnalyzeSimonDsgn, AnalyzeSimonDsgnAdaptN, pdata and AnalyzePerformanceSimon.

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
## Not run: 
AnalyzePerformanceSimon2()

# Simulation example
seed = 1986
p0 <- 0.1
alpha <- 0.05
beta <- 0.1
repl <- 100 # number of replicated trials for each p
if (file.exists("PerforAll.csv")) unlink("PerforAll.csv")
coln <- TRUE
while (p0 < 0.5){
  pv <- seq(p0+0.2,p0+0.4,0.1) # p to simulate data
  p1v <- seq(p0+0.2,p0+0.3,0.1) # p to get design
  for (p1 in p1v){
    designParam <- CalculateSimonDsgn(p0, p1, alpha, beta)
    pstart <- p0+0.1
    SimulateSimonDsgn(repl, designParam, pstart, seed = seed)
    SimulateSimonDsgnAdaptN(repl, designParam, pstart, seed = seed)
    AnalyzeSimonDsgn()
    AnalyzeSimonDsgnAdaptN()
    perf <- AnalyzePerformanceSimon2()
    for (p in pv){
      SimulateSimonDsgn(repl, designParam, p, seed = seed)
      SimulateSimonDsgnAdaptN(repl, designParam, p, seed = seed)
      AnalyzeSimonDsgn()
      AnalyzeSimonDsgnAdaptN()
      perf <- rbind(perf, AnalyzePerformanceSimon2())
    }
    write.csv(perf, file = paste("PerforAll_a",alpha,"b",beta,"p0",p0,"p1",
                                 p1,".csv", sep = ""), row.names = F)
    write.table(perf, file ="PerforAll.csv", append = T, sep = ",", row.names = F, col.names = coln)
    coln <- FALSE
  }
  p0 <- p0+0.1
}

## End(Not run)

arsenionhacolo/InferenceBEAGSD documentation built on May 9, 2019, 4:10 a.m.