(1) Construct the following table that summarizes the number of people who have car accidents in a school.(do question(2) and using R I need R code)thank you
Age Accidents 18-24 33 25-29 18 30-34 17 35-39 5
No Accidents 124
94
109
60
>40 2 30
(2) Use the Chi-Square test to conclude if the group (Accidents and No Accidents) and the Age range effects are independent. Test by using α= .10. (using R)
The R code for question 2 is pasted below.
# SETTING UP THE DATA
x=c(rep("18-24",33),rep("25-29",18),rep("30-34",17),rep("35-39",5),rep(">40",2),rep("18-24",124),rep("25-29",94),rep("30-34",109),rep("35-39",60),rep(">40",30))
y=c(rep("Accidents",75),rep("No Accidents",417))
data=data.frame(Age.Group = x,Whether.Accidents = y)
data
# SETTING UP THE FREQUENCY DISTRIBUTION
tbl = table(data$Age.Group,data$Whether.Accidents)
tbl
# WE CONDUCT A CHI-SQUARE TEST OF INDEPENDENCE
chisq.test(tbl)
# SINCE P-VALUE IS LESS THAN ALPHA = 0.10, WE REJECT H0 AND
CONCLUDE THAT THERE IS ENOUGH EVIDENCE TO SUGGEST THAT THE GROUP
(ACCIDENTS AND NO ACCIDENTS) AND THE AGE RANGE EFFECTS ARE NOT
INDEPENDENT.
Get Answers For Free
Most questions answered within 1 hours.