# Simple example
# Parameters
N=100000;
k1=0.3
A=8000; B=1.5; C=0.15; theta=c(A,B,C)
# True mean function
k2_true=function(n) powerlaw(n,theta)
# Values of n for which cost has been estimated
np=50 # this many points
nset=round(runif(np,1,N))
var_k2=runif(np,0.001,0.002)
k2=rnorm(np,mean=k2_true(nset),sd=sqrt(var_k2))
# Compute OHS
res1=optimal_holdout_size_emulation(nset,k2,var_k2,N,k1)
# Plot
plot(res1)
Run the code above in your browser using DataLab