Robert_V._Hogg,_Joseph_W._McKean,_Allen_T._Craig

(Jacob Rumans) #1

B.6. Packages 701


robust and nonparametric procedures. There are thousands of free packages avail-
able to users at the site CRAN. The packagehmcpkgcontains all the R functions
and R data sets discussed in this text. It can be downloaded at the site:
http://www.stat.wmich.edu/mckean/hmchomepage/Pkg/
Once it is installed on your computer use the library command as shown next to use
the package in an R session. The next segment of code prints out the first 3 lines
of the baseball data set discussed in Example 4.2.4. The attach command allows us
to access the variables of the data set, as we show for the variableheight.
library(hmcpkg)
head(bb,3)
hand height weight hitind hitpitind average
1 1 74 218 1 0 3.330
2 0 75 185 1 1 0.286
3 1 77 219 2 0 3.040
attach(bb); head(height,4) # accessing the variable height
[1] 74 75 77 73
In Example 1.3.3, the derivation of the probability that in a group ofnpeople at
least 2 have the same birthday is given. The R functionbday, included in the
package, computes this probability. The following segment of code computes it for
a group of size 10.
library(hmcpkg)
bday(10)
[1] 0.1169482

Free download pdf