Question: a ) Write a function of the form function ci = hrci ( B , alpha ) that takes the number of bootstrap replicates and

a) Write a function of the form
function ci = hrci(B, alpha)
that takes the number of bootstrap replicates and the confidence level as input argu-
ments and returns an confidence interval for HR.(Run your function with >=1,000
to get reliable estimates.) For example, hrci(1000,0.95) should return a 95% confidence
interval based on 1,000 bootstrap replicates.
Hint: sort(hr) returns a sorted list of hazard ratios. For example, if =1,000 and
=0.95, then the required confidence interval can be found with
hr = sort(hr); % overwrite with sorted array
ci =[hr(25), hr(975)];
Your code should work with any positive value of and any value of between 0 and 1.
(You do not need to check that 0<<1 in your code.) The expression round(B(1
alpha)/2) returns the nearest integer index in the sorted array corresponding to the
lower (1)/2 point of the confidence interval. You will need to determine an analo-
gous expression for the upper index. Include a copy of your code in your writeup.
(b) Run your code five times with =1000 and =0.95 and list the results that you
get

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!