100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
MATH CMTH 110 Discrete Math - Ryerson University. ASSIGNMENT in R_ Part 1 – Analysis of categorical data, Part 2 - ANOVA and Part 3 – SIMPLE and MULTIPLE REGRESSION with R. Spring-April 2023. Questions and Solutions $15.99   Add to cart

Exam (elaborations)

MATH CMTH 110 Discrete Math - Ryerson University. ASSIGNMENT in R_ Part 1 – Analysis of categorical data, Part 2 - ANOVA and Part 3 – SIMPLE and MULTIPLE REGRESSION with R. Spring-April 2023. Questions and Solutions

 14 views  0 purchase
  • Course
  • Institution

MATH CMTH 110 Discrete Math - Ryerson University. ASSIGNMENT in R_ Part 1 – Analysis of categorical data, Part 2 - ANOVA and Part 3 – SIMPLE and MULTIPLE REGRESSION with R. Spring-April 2023. Questions and Solutions

Preview 4 out of 32  pages

  • April 17, 2023
  • 32
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers
avatar-seller
ASSIGNMENT in R (part 1 – Analysis of categorical data)
For all problems, show the code, required to answer each of the questions, in blue,
and corresponding R output in black. Use copy & paste function in R environment
to copy and paste the code and the output. Problem 1. ( 5 marks)
Nearly 75% of all death in the United States are attributed to just 10 causes, with the top four of
these accounting for over 50% of all non -accidental deaths as follows: heart disease (23.4%),
cancer (22.5%), respiratory disease (5.6%), and stroke (5.1%). The study of the causes of n =308
non – accidental deaths at a local hospital gave the following counts.
Cause Heart Cancer Respiratory Stroke Other
Disease Disease

Deaths 78 81 28 16 105 308



Do the data provide sufficient information to indicate that the number of deaths at this hospital
differ significantly from the proportion in the population in large?
Test appropriate hypothesis at 5% level of significance using R. For
full solution
1. State the null and alternative hypotheses.
2. Represent frequency table with categories
Heart Disease Cancer Respiratory Disease Stroke Other
3. Perform chi - square test and represent its results.
Show the code, required to answer questions 2 and 3, in blue, and
corresponding R output in black. Use copy & paste function in R environment
to copy and paste the code and the output.
4. Make the conclusions about truth or falsity of stated hypotheses.




1

, We test the number of deaths at this hospital differ significantly from the
proportion in the population in large.

H0 : p1 = 23.4%, p2 = 22.5%, p3 = 5.6%, p4 = 5.1% , p5 = 1-( p1+ p2+ p3+ p4)=43.4%

H1 : at least two proportions are different from the values specified in null hypothesis



> A<-as.table(c(78 ,81 ,28 ,16 ,105))

> row.names(A)<- c("Heart Disease", "Cancer", "Respiratory Disease", "Stroke"
, "Other")
> A
Heart Disease Cancer Respiratory Disease Stroke
78 81 28 16
Other
105



> P<-c(0.234,0.225,0.056,0.051,1-(0.234+0.225+0.056+0.051))

> chisq.test(A, p=P)
Chi-squared test for given probabilities

data: A
X-squared = 15.321, df = 4, p-value = 0.00408




Since the p- value = 0.00408 < 0.05 we reject null hypothesis at α=0.05.
There is sufficient sample evidence that proportions p1 = 23.4%, p2 = 22.5%, p3
= 5.6%, p4 = 5.1% , p5 = 43.4% given in null hypothesis are incorrect.




2

,Problem 2 (5 marks)
Accident data were analyzed to determine the number of fatal accidents for the cars of three
sizes. The data for 346 accidents are as follows.
Small Medium Large

Fatal 67 26 16

Not Fatal 128 63 46

Do the data indicate that the frequency of fatal accidents is dependent on the size of the cars?
Test appropriate hypothesis using R. Assume 0.05 level of significance.
For full solution
1. State the null and alternative hypotheses.
2. Represent contingency table with two categorical variables Type of Accident
(levels Fatal and Not Fatal) and
Car Size (levels are Small, Medium, and Large)
3. Perform chi - square test and represent its results.
Show the code, required to answer questions 2 and 3, in blue, and
corresponding R output in black. Use copy & paste function in R environment
to copy and paste the code and the output.
4. Make the conclusions about truth or falsity of stated hypotheses.




3

, H0 : the frequency of fatal accidents is independent on the size of the car
H1 : the frequency of fatal accidents is depends on the size of the cars


> B<-matrix(c(67,128,26,63,16,46), nrow = 2,
+ dimnames = list(Type_of_Accident = c("Fatal", "Not Fatal"),
+ Car_Size = c("Small", "Median", "Large")))
> B
Car_Size
Type_of_Accident Small Median Large
Fatal 67 26 16
Not Fatal 128 63 46

> chisq.test(B)

Pearson's Chi-squared test

data: B
X-squared = 1.8857, df = 2, p-value = 0.3895



Since p- value = 0.3895 > 0.05 null hypothesis is not rejected. There is insufficient
sample evidence to conclude that the frequency of fatal accidents is independent on
the size of the car.




4

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller AllAcademic. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $15.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80202 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling

Recently viewed by you


$15.99
  • (0)
  Add to cart