Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In “Cabbage” data set under MASS package, there is a study comparing ascorbic ac

ID: 3338748 • Letter: I

Question

In “Cabbage” data set under MASS package, there is a study comparing ascorbic acid (one form of vitaminC) content between two different cultivars (c39 and c52) of cabbage. In this data set, the two different cultivars were planted on three different dates, denoted as d16, d20, or d21. The variable Data is a factor that specifies the planting date for each cabbage. Run an appropriate test to evaluate the relationship between the vitamin C content and cultivars while controlling for the effect of planting dates.

Abbreviations:

Cult:

Factor giving the cultivar of the cabbage, two levels: c39 and c52.

Date:

Factor specifying one of three planting dates: d16, d20 or d21.

HeadWt:

Weight of the cabbage head (

kg

)

.

VitC:

Ascorbic acid content, in undefined units.

Use R to solve this problem.

Explanation / Answer

We will be running One Way Anova test to evaluate the relationship between the vitamin C content and cultivars while controlling for the effect of planting dates.

H0: There is no relationship between vitamin C content and cultivars. That is the mean vitamin C content is same for all cultivars.

H1: There is a relationship between vitamin C content and cultivars. That is the mean vitamin C content is different for atleast for one cultivar.

Run the linear regresion model with Vitamin C content as response variable and Cultivar as the predictor variable.

model = lm(VitC ~ Cult, data = cabbages)

Run the anova test on the regression model.

anova(model)

The output of the command is shown below.

Analysis of Variance Table

Response: VitC
Df Sum Sq Mean Sq F value Pr(>F)
Cult 1 2496.1 2496.15 40.843 3.065e-08 ***
Residuals 58 3544.7 61.12
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

As, p-value of the anova test (3.065e-08) is close to 0 and is less than the significance level (0.05), we reject the null hypothesis and conclude that there is a significant relationship between vitamin C content and cultivars.