208 Assignment1.pdf - #1 data(ToothGrowth) #a...

This preview shows page 1 - 4 out of 7 pages.

The preview shows page 2 - 4 out of 7 pages.
#1data(ToothGrowth)#amode(ToothGrowth)[1] "list"class(ToothGrowth)[1] "data.frame"#bdim(ToothGrowth)[1] 603#csuppVC=ToothGrowth[ToothGrowth$supp=="VC",]suppOJ=ToothGrowth[ToothGrowth$supp=="OJ",]boxplot(suppOJ$len,suppVC$len,names = c("OJ","VC"))hist(suppVC$len)
hist(suppOJ$len)library(ggplot2)p=ggplot(ToothGrowth, aes(x = len))+ geom_density(aes(color=supp))p
Conclusion: Yes, OJ is much higher than VC. From boxplot we can see the median of OJ isaround 25 while the median of VC is about 16. Also we can easily see the difference in theirhistograms and density plots.#ep1 <- ggplot(ToothGrowth,aes(x=dose,y=len)) + geom_point(aes(color=supp)) +xlab("dose") +ylab("length")p1Yes, the nature of association depends on the type of supplement. From the scatterplot, boththe length of VC and OJ increase as dose increases. Obviously, the length of OJ is higher thanthe length of VC when they are at the same value of dose. The length of OJ increases slowerthan the VJ does.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 7 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
HenriDarmon
Tags
order statistic

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture