Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Using RStudio, please provide code 2-4) Are cardiac arrests (or heart attacks) equally likely to occur throughout the year? Or are some weeks more likely

image text in transcribed

Using RStudio, please provide code

2-4) Are cardiac arrests (or heart attacks) equally likely to occur throughout the year? Or are some weeks more likely than others to produce heart attacks? One way to look at this issue is to ask whether heart attacks occur according to a probability model in which such events are independent of each other and equally likely at all times. If so, then the number of heart attacks per week will follow a Poisson distribution. The data file cardiac arrests out of hospital.csv" contains data on the number of heart attacks per week from one hospital over five years. It records the number of heart attacks that occurred to individuals outside of the hospital who were then brought in for treatment (from Skogvoll and Lindqvist 1999). [5 points] a. Calculate a table of the observed frequencies of heart attacks per week. b. What is the mean number of heart attacks per week? c. For the mean you just calculated, use dpois() to calculate the probability of O heart attacks in a week assuming a Poisson distribution. Multiply that probability by the number of data points to calculate the expected frequency of O in these data under the null hypothesis of a Poisson distribution. d. Below is a table of the expected frequencies under the null hypothesis. (The expected frequency for zero heart attacks should match your calculation above.) Are these frequencies acceptable for use in a x? goodness of fit test? e. Create vectors in R for the observed and expected frequencies and use these to calculate they? test statistic for a test of goodness of fit to a Poisson distribution. f. How many degrees of freedom should this x? goodness of fit test have? g. Calculate the P-value for this test. h. Based on your P-value, does the frequency distribution of out-of-hospital cardiac events follow a Poisson distribution? a 2-4) Are cardiac arrests (or heart attacks) equally likely to occur throughout the year? Or are some weeks more likely than others to produce heart attacks? One way to look at this issue is to ask whether heart attacks occur according to a probability model in which such events are independent of each other and equally likely at all times. If so, then the number of heart attacks per week will follow a Poisson distribution. The data file cardiac arrests out of hospital.csv" contains data on the number of heart attacks per week from one hospital over five years. It records the number of heart attacks that occurred to individuals outside of the hospital who were then brought in for treatment (from Skogvoll and Lindqvist 1999). [5 points] a. Calculate a table of the observed frequencies of heart attacks per week. b. What is the mean number of heart attacks per week? c. For the mean you just calculated, use dpois() to calculate the probability of O heart attacks in a week assuming a Poisson distribution. Multiply that probability by the number of data points to calculate the expected frequency of O in these data under the null hypothesis of a Poisson distribution. d. Below is a table of the expected frequencies under the null hypothesis. (The expected frequency for zero heart attacks should match your calculation above.) Are these frequencies acceptable for use in a x? goodness of fit test? e. Create vectors in R for the observed and expected frequencies and use these to calculate they? test statistic for a test of goodness of fit to a Poisson distribution. f. How many degrees of freedom should this x? goodness of fit test have? g. Calculate the P-value for this test. h. Based on your P-value, does the frequency distribution of out-of-hospital cardiac events follow a Poisson distribution? a

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Accounting questions