partial_and_semipartial_correlation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
partial_and_semipartial_correlation [2024/10/16 08:07] – [e.g. Using ppcor.test with 4 var] hkimscil | partial_and_semipartial_correlation [2024/10/17 10:28] (current) – [e.g. Using ppcor.test with 4 var] hkimscil | ||
---|---|---|---|
Line 441: | Line 441: | ||
# install.packages(" | # install.packages(" | ||
library(ppcor) | library(ppcor) | ||
+ | |||
+ | reg.g.sh <- lm(GREV ~ SATV + HSGPA) | ||
+ | res.g.sh <- resid(reg.g.sh) | ||
+ | |||
+ | reg.g.fh <- lm(GREV ~ FGPA + HSGPA) | ||
+ | res.g.fh <- resid(reg.g.fh) | ||
+ | |||
+ | reg.g.sf <- lm(GREV ~ SATV + FGPA) | ||
+ | res.g.sf <- resid(reg.g.sf) | ||
reg.f.sh <- lm(FGPA ~ SATV + HSGPA) | reg.f.sh <- lm(FGPA ~ SATV + HSGPA) | ||
Line 460: | Line 469: | ||
summary(reg.2) | summary(reg.2) | ||
summary(reg.3) | summary(reg.3) | ||
+ | |||
+ | reg.1a <- lm(res.g.sh~res.f) | ||
+ | reg.2a <- lm(res.g.fh~res.s) | ||
+ | reg.3a <- lm(res.g.sf~res.h) | ||
reg.1$coefficient[2] | reg.1$coefficient[2] | ||
reg.2$coefficient[2] | reg.2$coefficient[2] | ||
reg.3$coefficient[2] | reg.3$coefficient[2] | ||
+ | |||
+ | reg.1a$coefficient[2] | ||
+ | reg.2a$coefficient[2] | ||
+ | reg.3a$coefficient[2] | ||
spr.y.f <- spcor.test(GREV, | spr.y.f <- spcor.test(GREV, |
partial_and_semipartial_correlation.1729033662.txt.gz · Last modified: 2024/10/16 08:07 by hkimscil