Learn R Programming

bootstrap (version 2019.6)

law: Law school data from Efron and Tibshirani

Description

The law school data. A random sample of size \(n=15\) from the universe of 82 USA law schools. Two measurements: LSAT (average score on a national law test) and GPA (average undergraduate grade-point average). law82 contains data for the whole universe of 82 law schools.

Usage

data(law)

Arguments

Format

A data frame with 15 observations on the following 2 variables.

LSAT

a numeric vector

GPA

a numeric vector

Details

In the book for which this package is support software, this example is used to bootstrap the correlation coefficient.

See Also

law82.

Examples

Run this code
# NOT RUN {
str(law)
if(interactive())par(ask=TRUE)
plot(law)
theta <- function(ind) cor(law[ind,1], law[ind,2])
theta(1:15) # sample estimate
law.boot <- bootstrap(1:15, 2000, theta)
sd(law.boot$thetastar) # bootstrap standard error
hist(law.boot$thetastar)
# bootstrap t confidence limits for the correlation coefficient:
theta <- function(ind) cor(law[ind,1], law[ind,2])
boott(1:15, theta, VS=FALSE)$confpoints
boott(1:15, theta, VS=TRUE)$confpoints
# Observe the difference! See page 162 of the book. 
# abcnon(as.matrix(law), function(p,x) cov.wt(x, p, cor=TRUE)$cor[1,2]  )$limits
# The above cannot be used, as the resampling vector can take negative values! 
# }

Run the code above in your browser using DataLab