Question: In RStudio, use the warpbreaks data frame. Define a new vector, median_breaks, and append it to the warpbreaks data frame. For each value of breaks,

In RStudio, use the warpbreaks data frame. Define a new vector, median_breaks, and append it to the warpbreaks data frame.

For each value of "breaks," the value of median_breaks should indicate if "breaks" is less than or greater than | equal to the median number of breaks.

median_breaks should equal "below" when "breaks" is less than the median; "above" when it is greater than or equal to.

The ifelse() function can be used to define median_breaks.

factor() can then be used to coerce the vector to a factor.

#You can check your median_breaks vector by checking the first six (6) elements against the below:

#[1] above above above below above above

#Use median_breaks to answer the following question:

Perform a chi-squared test of independence on the tension and median_breaks variables. From the options below, select the correct chi-squared statistic and associated p-value. This can be done using the chisq.test() function.

(a) chi-squared = 9.0869, p-value = 0.01064

(b) chi-squared = 62.5, p-value = 0.3875

(c) chi-squared = 0.29793, p-value = 0.5852

(d) chi-squared = 54, p-value = 0.004597

Please provide R code as well.

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 Mathematics Questions!