Skip to content
Prev 385819 / 398503 Next

Problem with contour(): typo

Dear Duncan,

Duncan Murdoch wrote on 2020-09-29 11:57:
I see. Here it would require to give the result as a matrix, 
data.frame,... Substantial change in the code though doable.
library(PowerTOST)
theta0 <- unique(sort(c(0.95, seq(0.95*0.95, 1, length.out = 10))))
CV???? <- unique(sort(c(0.25, seq(0.25*0.8, 0.25*1.2, length.out = 10))))
power.TOST.vectorized <- Vectorize(power.TOST, c("theta0", "CV", "n"))
and
power.TOST.vectorized(theta0 = theta0, CV = CV, n = 28)
gives the diagonal elements of the desired 11*11 matrix:
z <- matrix(ncol = length(theta0), nrow = length(CV))
for (i in seq_along(CV)) {
 ? z[i, ] <- power.TOST(theta0 = theta0, CV = CV[i], n = 28)
}

Helmut