# NOT RUN {
air.flow = stackloss[,1]
water.temperature = stackloss[,2]
acid = stackloss[,3]
# Partial using Kendall (nonparametric) correlation
partial.cor(air.flow, water.temperature, acid)
scholar <- data.frame(
HSGPA=c(3.0, 3.2, 2.8, 2.5, 3.2, 3.8, 3.9, 3.8, 3.5, 3.1),
FGPA=c(2.8, 3.0, 2.8, 2.2, 3.3, 3.3, 3.5, 3.7, 3.4, 2.9),
SATV =c(500, 550, 450, 400, 600, 650, 700, 550, 650, 550))
# Standard Pearson's correlations between HSGPA and FGPA
cor(scholar[,1], scholar[,2])
# Partial correlation using Pearson (parametric) between HSGPA
# and FGPA, controlling for SATV
partial.cor(scholar, statistic="pearson")
# Semipartial using Pearson (parametric) correlation
partial.cor(x=scholar[,2], y=scholar[,1], z=scholar[,3],
method="semipartial", statistic="pearson")
# }
Run the code above in your browser using DataLab