title: “Using favstats( )” |
output: html_document |
If necessary, install the Mosaic package.
install.packages("mosaic")
Rather than calling individual statistics for R to compute, we can use favstats( ) in the Mosaic package to get a variety of statistics with a single command. Let’s use the data from Table 7 in Section 3.2 to illustrate how to use favstats( ).
Table7 <- read.csv("https://sullystats.github.io/Statistics6e/Data/Chapter3/Table7.csv")
head(Table7,n=4)
## University IQ
## 1 A 136
## 2 A 81
## 3 A 80
## 4 A 85
library(mosaic)
favstats(IQ ~ University,data=Table7)
## University min Q1 median Q3 max mean sd n missing
## 1 A 60 90 102 110 141 100.00 16.080605 100 0
## 2 B 86 94 98 107 119 100.01 8.357535 100 0
We will determine the standard deviation of each schools’ IQ score to verify University A has more dispersion.
sd(IQ ~ University,data=Table7)
## A B
## 16.080605 8.357535
The standard deviation for University A is 16.1 and the standard deviation for University B is 8.4. University A has more dispersion in IQ scores.