# NOT RUN {
# Importing from a CSV-file, using most of the defaults: variable
# separator colon, decimal separator period, no outlier-analyis,
# print to file.
# Note: You must adapt the path-variables. The example reads from
# the data provided by the library. Write-permissions must be granted
# for 'path.out' in order to save the result file. Here the default
# (R's temporary folder) is used. If you don't know where it is,
# type tempdir() in the console.
path.in <- paste0(find.package("replicateBE"), "/extdata/")
method.B(path.in = path.in, file = "DS", set = "01", ext = "csv")
# Should result in:
# CVwT : 35.16%
# swT : 0.34138
# CVwR : 46.96% (reference-scaling applicable)
# swR : 0.44645
# Expanded limits : 71.23% ... 140.40% [100exp(<U+00B1>0.760<U+00B7>swR)]
# swT / swR : 0.7647 (similar variabilities of T and R)
# sw-ratio (upper CL): 0.9324 (comparable variabilities of T and R)
# Confidence interval: 107.17% ... 124.97% pass
# Point estimate : 115.73% pass
# Mixed (CI & PE) : pass
#
# Internal reference dataset 01 used and results to R's temporary
# folder. Additional outlier-analyis and box plot saved as PNG.
method.B(ola = TRUE, plot.bxp = TRUE, data = rds01)
# Should give the same as above. Additionally:
# Recalculation due to presence of 2 outliers (subj. 45|52)
# CVwR (outl. excl.) : 32.16% (reference-scaling applicable)
# swR (recalc.) : 0.31374
# Expanded limits : 78.79% ... 126.93% [100exp(<U+00B1>0.760<U+00B7>swR)]
# swT / swR (recalc.): 1.0881 (similar variabilities of T and R)
# sw-ratio (upper CL): 1.3282 (comparable variabilities of T and R)
# Confidence interval: pass
# Point estimate : pass
# Mixed (CI & PE) : pass
#
# Same dataset. Show information about outliers and the model-table.
method.B(ola = TRUE, print = FALSE, verbose = TRUE, data = rds01)
# }
# NOT RUN {
# data.frame of results (full precision) shown in the console.
x <- method.B(ola = TRUE, print = FALSE, details = TRUE, data = rds01)
print(x, row.names = FALSE)
# Compare Method B with Method A for all reference datasets.
# }
# NOT RUN {
ds <- substr(grep("rds", unname(unlist(data(package = "replicateBE"))),
value = TRUE), start = 1, stop = 5)
for (i in seq_along(ds)) {
A <- method.A(print=FALSE, details=TRUE, data=eval(parse(text=ds[i])))$BE
B <- method.B(print=FALSE, details=TRUE, data=eval(parse(text=ds[i])))$BE
r <- paste0("A ", A, ", B ", B, " - ")
cat(paste0(ds[i], ":"), r)
if (A == B) {
cat("Methods A and B agree.\n")
} else {
if (A == "fail" & B == "pass") {
cat("Method A is conservative.\n")
} else {
cat("Method B is conservative.\n")
}
}
}
# }
# NOT RUN {
# should give
# rds01: A pass, B pass - Methods A and B agree.
# ...
# rds14: A pass, B fail - Method B is conservative.
# ...
# }
# NOT RUN {
# Health Canada: Only the PE of Cmax has to lie within 80.0-125.0%
# (i.e., no CI is required). With alpha = 0.5 the CI is practically
# supressed (zero width) and ignored in the assessment.
x <- method.B(alpha = 0.5, regulator = "HC", option = 1,
data = rds03, print = FALSE, details = TRUE)[19:20]
x[1] <- round(x[1], 1) # only one decimal place for HC
print(x, row.names = FALSE)
# Should result in:
# PE(%) GMR
# 124.5 pass
# }
Run the code above in your browser using DataLab