Learn R Programming

bootstrap (version 2014.4)

scor: Open/Closed Book Examination Data

Description

This is data form mardia, Kent and Bibby on 88 students who took examinations in 5 subjects. Some where with open book and other with closed book.

Usage

data(scor)

Arguments

concept

bootstrap principal component analysis

source

Efron, B. and Tibshirani, R. (1993) An Introduction to the Bootstrap. Chapman and Hall, New York, London.

Details

The book uses this for bootstrap in principal component analysis.

Examples

Run this code
str(scor) 
if(interactive())par(ask=TRUE)
plot(scor) 
# The parameter of interest (theta) is the fraction of variance explained 
# by the first principal component.
# For principal components analysis svd is better numerically than 
# eigen-decomposistion, but for bootstrapping the later is MUCH faster.
theta <- function(ind) {
   vals <- eigen(var(scor[ind,]), symmetric=TRUE, only.values=TRUE)$values
   vals[1] / sum(vals) }
scor.boot <- bootstrap(1:88, 500, theta)
sd(scor.boot$thetastar) # bootstrap standard error
hist(scor.boot$thetastar)
abline(v=theta(1:88), col="red2")
abline(v=mean(scor.boot$thetastar), col="blue")

Run the code above in your browser using DataLab