13/12/2020

Previous projects featuring the dataset

Statistical Inference Week 4 Assignment (Part 2)

Developing Data Products Week 4 Assignment (Shiny Application)

Dataset Details

The Effect of Vitamin C on Tooth Growth in Guinea Pigs

  • Description: The response is the length of odontoblasts (cells responsible for tooth growth) in 60 guinea pigs. Each animal received one of three dose levels of vitamin C (0.5, 1, and 2 mg/day) by one of two delivery methods, orange juice or ascorbic acid (a form of vitamin C and coded as VC).

  • Format: A data frame with 60 observations on 3 variables.

  • Source: C. I. Bliss (1952). The Statistics of Bioassay. Academic Press.

  • References: McNeil, D. R. (1977). Interactive Data Analysis. New York: Wiley. // Crampton, E. W. (1947). The growth of the odontoblast of the incisor teeth as a criterion of vitamin C intake of the guinea pig. The Journal of Nutrition, 33(5), 491–504. doi: 10.1093/jn/33.5.491.

First glimpse of dataset

head(ToothGrowth)
##    len supp dose
## 1  4.2   VC  0.5
## 2 11.5   VC  0.5
## 3  7.3   VC  0.5
## 4  5.8   VC  0.5
## 5  6.4   VC  0.5
## 6 10.0   VC  0.5
  • [,1] len (numeric): Tooth length.
  • [,2] supp (factor): Supplement type (VC or OJ).
  • [,3] dose (numeric): Dose in milligrams/day

Embedded R Code (Boxplot and fit model)

library(shiny); library(datasets); library(ggpubr)
toothData <- ToothGrowth
shinyServer(function(input, output) {
    formulaTextPoint <- reactive
    ({paste("len ~", "as.integer(", input$variable, ")")})
    fit <- reactive
    ({lm(as.formula(formulaTextPoint()), data=toothData)})
    output$toothBoxPlot <- renderPlot
    ({boxplot(as.formula(formulaText()), data = toothData)})
    output$fit <- renderPrint({summary(fit())})
    output$toothPlot <- renderPlot({with(toothData, {
            plot(as.formula(formulaTextPoint()))
            abline(fit(), col=2)})
    })
})