2025-11-02

The Dataset Used

  • This project is based round the chickwts dataset that is built into R through the package ‘datasets’.

  • The dataset contains data on weights of chicks fed with different types of feed.

  • This dataset includes 71 observations and 2 columns:

    • weight: measures the weight of the chick in grams

    • feed: categories of the type of feed given to the chick (6 types)

  • The purpose of this being collected was to study the effect different feed types have on chick growth.

Overview

This project will explore the data through different visuals to analyze the data set through different means.

  • Boxplot: shows the distribution of chick weights for each different feed type

  • Bar Chart: displays the average chick weight for each feed type with error bars showing the variance in the data points.

  • Pie Chat: shows the proportion of chicks fed by each feed type

  • Scatterplot: displays the individual chick weights

  • Statistical Analysis: provides an ANOVA test to determine whether differences in the mean chick weights by feed are statistically significant.

ggplot Pie Chart Code

To visualize the proportion of chicks fed by each feed type, a pie chart was created to show the frequency of each feed in the given dataset. The following code was used to create this pie chart visual:

feed_counts <- chickwts %>%
  count(feed) %>%
  mutate(percent=round(100*n/sum(n),1),
         label=paste0(feed, "\n", percent, "%"))

ggplot(feed_counts,aes(x="", y=n, fill=feed))+
  geom_col(width=1, color="white")+
  coord_polar(theta="y")+
  geom_text(aes(label = label),
            position=position_stack(vjust=0.5),
            size=4, color="white", fontface="bold")+
  labs(title="Feed Type Usage Breakdown",
       fill="Feed Type")+
  theme_void()+
  theme(plot.title=element_text(hjust=0, vjust=1.5, size=14))

ggplot Feed Type Usage Breakdown

From the plot, soybean appears to be highest used feed type among the chicks. Sunflower, casein and linseed all have the same proportion usage among the chicks in this data set. Horsebean is evidently the lowest used feed type in this dataset as well.

ggplot: Boxplot of Weight by Feed Type

The boxplot here shows the distribution of chick weights for each feed type, and shows how the median and variability in growth differ between each feed type.

plotly: Bar Chart

The bar chart displays the average weight of the chicks for each feed type, which is highlighting the feeds that are associated with higher or lower average growth.

plotly: 3D Scatterplot

The following is a 3D Scatter Plot of Chick ID #, Feed Type (numbered), and Weight (grams). The colors represent different feed types used in the experiment.

3D Scatter Plot Analysis

This 3D plot visualizes the individual chicks, which are numbered from 1 to 71, across different feed types and their individual weights. The feed types are represented by colors, while the numbered axis from 1 to 6 for feed type seperates the categories to make the visual more clear. Weight in grams is shown on the vertical axis, indicating growth outcomes for each individual chick.

  • Linseed and horsebean diets appear to produce the lightest chicks based on the given dataset.

  • Sunflower and casein feed types appear to derive similar weight results in chicks from this data set.

  • It is evident that chicks raised on the feed type of horsebean (1) appear to have the lowest average weight.

  • It is evident that chicks raised on the feed type of sunflower (6) appear to have the highest average weight.

Statistical Analysis: ANOVA Test

  • The ANOVA results show a significant effect of feed type on chick weight (F = 15.37, p < 0.0001).

  • This means the average weight differs depending on which feed the chicks received.

  • The low p-value (< 0.05) indicates that these differences are unlikely due to random chance.

  • Therefore, feed type has a statistically significant impact on chick growth.

data("chickwts")

anova_result <- aov(weight~feed, data=chickwts)
summary(anova_result)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## feed         5 231129   46226   15.37 5.94e-10 ***
## Residuals   65 195556    3009                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Analysis Summary and Conclusion

Based on the visualizations and statistical analysis, it is evident that feed type significantly impacts chick weight. The boxplots and bar charts show strong noticeable differences in growth across the six feed types, with sunflower and casein feeds generally producing heavier chicks based on this dataset. The ANOVA test conducted prior confirms these differences are statistically significant, demonstrating how important the feed choise of chicks is on their overall development. Overall, this analysis highlights the importance of nutrition and how it influences growth outcomes in young chicks, and presents that idea of ensuring chicks are given the appropriate feed types for the healthiest weight gain results.