Function to get the required N given by the accuracy and the learning curve model

getN(res, acc = 0.9)

Arguments

res

model results returned by learning_curve function

acc

accuracy that are quired

Value

sample size that are required

Examples

set.seed(2019) n <- seq(20, 10000, 100) accMat <- do.call(cbind, lapply(1:length(n), function(i){ tmp_n <- rep(n[i], 50) y <- -2/(tmp_n^0.8) + 0.95 + rnorm(length(tmp_n), 0, 0.02) })) res <- learningCurve(accMat = accMat, n)
#> #> Formula: acc ~ I(1/n^(c) * a) + b #> #> Parameters: #> Estimate Std. Error t value Pr(>|t|) #> a.(Intercept) -1.8730006 0.1480680 -12.65 <2e-16 *** #> c.log(max(acc) + 0.001 - acc) 0.7759121 0.0248888 31.18 <2e-16 *** #> b 0.9496806 0.0005534 1716.21 <2e-16 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Residual standard error: 0.003151 on 97 degrees of freedom #> #> Number of iterations to convergence: 6 #> Achieved convergence tolerance: 1.49e-08 #> #> #> Formula: acc ~ I(1/n^(c) * a) + b #> #> Parameters: #> Estimate Std. Error t value Pr(>|t|) #> a.(Intercept) -1.9661577 0.1927579 -10.20 <2e-16 *** #> c.log(max(acc) + 0.001 - acc) 0.7936628 0.0309733 25.62 <2e-16 *** #> b 0.9360079 0.0006414 1459.30 <2e-16 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Residual standard error: 0.003764 on 97 degrees of freedom #> #> Number of iterations to convergence: 11 #> Achieved convergence tolerance: 1.49e-08 #> #> #> Formula: acc ~ I(1/n^(c) * a) + b #> #> Parameters: #> Estimate Std. Error t value Pr(>|t|) #> a.(Intercept) -1.8151635 0.1898262 -9.562 1.18e-15 *** #> c.log(max(acc) + 0.001 - acc) 0.7702072 0.0328869 23.420 < 2e-16 *** #> b 0.9624993 0.0007365 1306.788 < 2e-16 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Residual standard error: 0.004153 on 97 degrees of freedom #> #> Number of iterations to convergence: 5 #> Achieved convergence tolerance: 1.49e-08 #>
N <- getN(res, acc = 0.9)