Question
. A team of scientists recorded weight change experienced by each of n = 100 rats following treatment with an experimental drug. Their data is
. A team of scientists recorded weight change experienced by each of n = 100 rats following treatment with an experimental drug. Their data is stored in datafile.csv. Based on their data, the team concludes that no weight change occurred. (a) (8 marks) The "power" of a test gives the probability of not committing a Type-2 error. Suppose that it is later established that the drug unequivocally had an effect = 0.3 grams on weight change. make a simulation in Python to estimate the power of the team's ability to detect the change. Justify your parameterization of any distribution from which you simulate. Submit your code and your justification. You may build your own random number generator from scratch, or you may use 1 import numpy X = numpy . random . uniform () to generate a random variable X that comes from a uniform distribution on (0, 1). No other "builtin" pseudo-random number generator may be used. Moreover, if you use the built-in generator shown above you may only do so to generate random variables one at a time. You'll likely need to store simulated data in an array. When you generate a new random observation, you'll need to add it to the array. You can do that using the code below. # make an empty array in which to store data data = numpy . array ( [ ] ) # here , I'll just generate 10 uniform (0,1) RVs and add them to the data array one at a time for i in range ( 10 ): X = numpy . random . uniform () data = numpy . append ( data , X ) # adds X to the end of data array (b) (2 marks) Use your simulation in part (a) to estimate power given effect sizes (i) = 0.3, (ii) = 0.5, and (iii) = 0.2 based on 100 000 replicate experiments (don't be surprised if it takes a minute or two to run).