partial_and_semipartial_correlation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
partial_and_semipartial_correlation [2024/10/16 08:03] – [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, | ||
Line 576: | Line 593: | ||
> attach(scholar) | > attach(scholar) | ||
The following objects are masked from scholar (pos = 3): | The following objects are masked from scholar (pos = 3): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 4): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 5): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 6): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 7): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 8): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 9): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from ivs.orthogonal (pos = 10): | ||
- | |||
- | FGPA, HSGPA, SATV | ||
- | |||
- | The following objects are masked from ivs.orthogonal (pos = 11): | ||
- | |||
- | FGPA, HSGPA, SATV | ||
- | |||
- | The following objects are masked from ivs.orthogonal (pos = 12): | ||
- | |||
- | FGPA, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 13): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 14): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 15): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 16): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 17): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 18): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 19): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 22): | ||
- | |||
- | FGPA, GREV, HSGPA, SATV | ||
- | |||
- | The following objects are masked from scholar (pos = 23): | ||
FGPA, GREV, HSGPA, SATV | FGPA, GREV, HSGPA, SATV | ||
Line 821: | Line 766: | ||
multiple regression 분석을 보면 독립변인의 coefficient 값은 각각 | multiple regression 분석을 보면 독립변인의 coefficient 값은 각각 | ||
- | * HSGPA -25.475 | + | * HSGPA 8.3214 |
- | * FGPA | + | * FGPA |
- | * SATV | + | * SATV 0.8143 |
이 기울기에 대해서 t-test를 각각 하여 HSGPA와 FGPA의 설명력이 significant 한지를 확인하였다. 그리고 이 때의 R< | 이 기울기에 대해서 t-test를 각각 하여 HSGPA와 FGPA의 설명력이 significant 한지를 확인하였다. 그리고 이 때의 R< | ||
- | * 0.672 (67.2%) | + | * 0.799 이었다. |
그런데 이 coefficient값은 독립변인 각각의 고유의 설명력을 가지고 (spcor.test(GREV, | 그런데 이 coefficient값은 독립변인 각각의 고유의 설명력을 가지고 (spcor.test(GREV, | ||
- | < | + | 또한 세 독립변인이 공통적으로 설명하는 부분은 |
- | > reg.1$coefficient[2] | + | |
- | res.f | + | 임을 알 수 있다. |
- | 17.68 | + | |
- | > reg.2$coefficient[2] | + | |
- | | + | |
- | 0.1305 | + | |
- | > reg.3$coefficient[2] | + | |
- | res.h | + | |
- | 16.97 | + | |
- | > | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | + | ||
====== e.g., 독립변인 들이 서로 독립적일 때의 각각의 설명력 ====== | ====== e.g., 독립변인 들이 서로 독립적일 때의 각각의 설명력 ====== | ||
In this example, the two IVs are orthogonal to each other (not correlated with each other). Hence, regress res.y.x2 against x1 would not result in any problem. | In this example, the two IVs are orthogonal to each other (not correlated with each other). Hence, regress res.y.x2 against x1 would not result in any problem. |
partial_and_semipartial_correlation.1729033433.txt.gz · Last modified: 2024/10/16 08:03 by hkimscil