tests/testthat/test_estimate_valid.R

context("estimate_parms()")

x <- c(1.56686705285826, 2.13334006753374, 2.48389959160847, 2.48907956253638,
       1.62443028300905, 1.35295035569658, 1.50550985067319, 1.45411569712668,
       1.38445460407334, 1.61174906939096, 1.63342092459411, 2.32227782810227,
       1.85814066153445, 1.39603862015446, 2.43999473757215, 1.86081600562257,
       1.78217140151915, 1.35176621156136, 2.0978685916949, 1.81377081621283,
       1.35695234118531, 1.31404145602369, 1.83687087935907, 1.50152016122894,
       2.29170767937953, 1.34204072759526, 1.67421683587507, 1.63727511486325,
       2.14650636746764, 1.76863342818518, 1.63494650182574, 1.55299435496146,
       2.18528494847907, 1.45104368991411, 1.60414240964559, 1.67125670202533,
       1.99164393065032, 1.91148628346288, 2.3495887272592, 1.36487486172148,
       1.84099581479282, 2.31361743158107, 1.35992623703592, 1.29122842949562,
       1.38174834072904, 1.3780207694963, 1.34777978242813, 1.31152390216089,
       2.02668762273157, 2.2757165665942, 1.53892640915327, 1.80990854374957,
       1.35799686836082, 1.55304631247824, 1.63739002919363, 1.47758002483459,
       1.41587328333783, 2.01617655670887, 2.94689523878762, 1.31073471630291,
       1.49746528681063, 2.89315499679877, 1.4737212638824, 1.86881192775055,
       1.71738915038803, 2.73850828734135, 1.55227368167414, 1.56636394396369,
       2.60672457592059, 1.8163770205882, 1.85502099334633, 1.94856432680844,
       2.25964539314362, 1.72363806492179, 1.4300424481327, 1.57332767808409,
       1.36474679801742, 1.58746016052691, 1.87450740862375, 1.40086317821507,
       1.52087497363709, 1.47484660850736, 1.8258852406703, 1.56860269812374,
       1.55598403184435, 1.753445254129, 2.10161973815499, 1.63782671808321,
       1.45804486935767, 1.70227648298201, 3.17903130639463, 2.16318770774284,
       2.26556792852857, 1.58625666261542, 1.71288118216976, 2.75012877681226,
       1.32553696466976, 2.35151171309878, 1.98293656888149, 1.48560870063046,
       1.59920171499931, 1.67459565153267, 2.891472120386, 1.65039671210113,
       2.63828304778151, 1.88621683040879, 2.22013066775635, 3.19344466810026,
       2.43791635932932, 1.37843001205449, 1.58444753047964, 1.81050410381828,
       2.71947507366082, 1.57041210749784, 1.84319561215504, 2.01902317411974,
       2.42608791480896, 2.4926127174708, 1.31453863900006, 2.12519406326784,
       2.18835813689454, 2.67987740175887, 3.15881298550258, 1.91012959023502,
       2.50335246539986, 1.86075032440762, 1.97751004503486, 1.53283893166445,
       1.34940129862856, 1.83310926348632, 1.82852722900747, 1.81324009087198,
       2.23757391968692, 2.53956349661486, 1.31936845533991, 1.59588008735062,
       2.53628420370044, 2.00316103306427, 2.17717280212616, 2.07195703747304,
       1.53849966853207, 1.44106520920185, 1.33861395954947, 1.61070917164671,
       2.60573259538851, 1.55385834351834, 2.8156621245599, 1.34759201913765,
       1.57870829477216, 1.31338410649708, 1.74133270625606, 1.39273670126084,
       1.82913136228306, 1.49854677503077, 1.47138847195462, 1.35091044305375,
       2.00029680099808, 1.49451472266086, 1.42114246556031, 2.07812346048753,
       1.33532680145866, 1.83761653736659, 1.4779631359494, 2.82174931873438,
       2.01544572225579, 2.0245084529138, 1.37967053866279, 2.39916735610051,
       1.84844460681366, 1.41594952780507, 2.85255782905191, 1.60892056884744,
       1.99399949049884, 1.361302693932, 2.0316109769905, 1.9197938520871,
       1.91670587940605, 1.53758746076449, 2.03278575313507, 1.46881000883986,
       1.82293065797015, 2.04199744524635, 3.25722709430093, 2.44891549689718,
       1.70584479331884, 1.48615336726527, 1.6880342295829, 1.7445038479156,
       1.75341453311417, 2.57287461009678, 1.3003173806569, 2.26518330345506,
       1.79944971454944, 1.9841323722906, 1.31294397359311, 2.42141370074186,
       1.47423126050689, 2.50753900436195, 1.74455299594638, 2.95790745198419
)

# calculate the identification rate implied by the system parameters
id.rate <- 0.02665284

# calculate the nomination rate implied by the system parameters
nom.rate <- .1

expect_equal(
  as.numeric(estimate_valid(x=x, id.rate=id.rate, nom.rate=nom.rate)),
  0.3785884, tolerance=1e-3)
mcbeem/giftedCalcs documentation built on Nov. 20, 2019, 5:32 p.m.