Bootstrap analysis for partial correlations

#1
Hello, I was hoping someone could please help or direct me to another page that explains bootstrapping with partial correlations (i.e., correlations between two variables after controlling for a third variable)?

For example, correlating posttest performance with another variable (e.g., SAT score) AFTER controlling for pretest performance. Given our low N, we thought a bootstrap analysis would be useful, but my google-fu has been unsuccessful thus far in terms of how-to.

Note: this does not necessarily have to be in R, though I'm assuming it's my best bet.

Thanks so much for reading my question!
 

Lazar

Phineas Packard
#2
Not overly familiar with boot strapping BUT would something like the following work:
Code:
#stolen from https://stat.ethz.ch/pipermail/r-help/2009-March/193523.html
partial.cor <- function (X, ...) 
{
  R <- cor(X, ...)
  RI <- solve(R)
  D <- 1/sqrt(diag(RI))
  R <- -RI * (D %o% D)
  diag(R) <- 0
  rownames(R) <- colnames(R) <- colnames(X)
  R
}

#Create some fake data set
myData <- data.frame(xPre = rnorm(100), xPost = rnorm (100), SAT = rnorm(100))
#Partial correlation
partial.cor(myData)

#creat bootstrap sample
R <- 100 #number of replications
#Bootstrap samples
boots<- list()
for (i in 1:R){
                boots[[i]] <- as.data.frame(myData[sample(1:nrow(myData),nrow(myData), replace=TRUE),])
                }

#Bootstrap responses for xPost SAT partial correlation ONLY
#change index [3,2] if you want a different one.
boot.partial <- sapply(boots, function(x) partial.cor(x)[3,2])
hist(boot.partial)
quantile(boot.partial, probs=c(.025, .975))
 
#3
Sounds like "An introduction to bootstrap methods with applications to R" is good for you ... Authors Chernick & LaBudde.

A good one that's focused on regression analysis only (and hence probably not what you're after) is Bootstrap Tests for Regression Models by Leslie Godfrey.