Compare running times with the function - compare the


Problem 1.

(A comparison of running times) Write a function permIndepChisqTest(tab, B = 2000) that takes in a table of joint counts tab and returns an estimate of the permutation p-value for the Pearson statistic based on B random permutations.

Compare the running time of your function to chisq.test for the same B = 1e6.

Use the attached School Admissions data

[Hint: to compute the processing time, use the function proc.time. Try not to use your computer in other ways while performing these computations so as not to bias the results.]

Problem 2.

(Bootstrap confidence interval) Write a function bootCI(x, conf=0.99, B=1e4) that takes in one-sample numerical data in the form of a vector x, a number conf in (0,1), and a large positive integer B, and produces a bootstrap Studentized confidence interval for the mean at level conf based on B bootstrap samples.

Problem 3.

(Using the package boot) boot is one of the main packages in R implementing bootstrap methodology. Instead of writing the function from scratch as was done in Problem 2, write a function bootCIpackage(x, conf=0.99, B=1e4) based on that package to produce a bootstrap Studentized confidence interval for the mean at level conf based on B bootstrap samples. Compare running times with the function from Problem 2 above with B = 1e6.

Attachment:- Ch03_Magnet_schools.txt

Request for Solution File

Ask an Expert for Answer!!
Applied Statistics: Compare running times with the function - compare the
Reference No:- TGS02265351

Expected delivery within 24 Hours