partial_and_semipartial_correlation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
partial_and_semipartial_correlation [2019/05/23 10:27] – [regression gpa against sat] hkimscil | partial_and_semipartial_correlation [2019/05/26 22:54] – [Semipartial cor] hkimscil | ||
---|---|---|---|
Line 331: | Line 331: | ||
> </ | > </ | ||
+ | < | ||
+ | > colnames(tests) <- c(" | ||
+ | > tests <- subset(tests, | ||
+ | > attach(tests) | ||
+ | > cors <- cor(tests) | ||
+ | > round(cors, | ||
+ | | ||
+ | sat 1.000 0.875 0.718 | ||
+ | clep 0.875 1.000 0.876 | ||
+ | gpa 0.718 0.876 1.000 | ||
+ | > lm.sat.clep <- lm(sat ~ clep, data = tests) | ||
+ | > summary(lm.sat.clep) | ||
+ | |||
+ | Call: | ||
+ | lm(formula = sat ~ clep, data = tests) | ||
+ | |||
+ | Residuals: | ||
+ | | ||
+ | -101.860 | ||
+ | |||
+ | Coefficients: | ||
+ | Estimate Std. Error t value Pr(> | ||
+ | (Intercept) | ||
+ | clep 17.665 | ||
+ | --- | ||
+ | Signif. codes: | ||
+ | |||
+ | Residual standard error: 48.2 on 8 degrees of freedom | ||
+ | Multiple R-squared: | ||
+ | F-statistic: | ||
+ | |||
+ | > res.lm.sat.clep <- lm.sat.clep$residuals | ||
+ | > | ||
+ | > install.packages(" | ||
+ | WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding: | ||
+ | |||
+ | https:// | ||
+ | Installing package into ‘C:/ | ||
+ | (as ‘lib’ is unspecified) | ||
+ | trying URL ' | ||
+ | Content type ' | ||
+ | downloaded 29 KB | ||
+ | |||
+ | package ‘ppcor’ successfully unpacked and MD5 sums checked | ||
+ | |||
+ | The downloaded binary packages are in | ||
+ | C: | ||
+ | > library(ppcor) | ||
+ | Loading required package: MASS | ||
+ | > spcor.gpa.sat.clep <- lm(gpa ~ res.lm.sat.clep) | ||
+ | > summary(spcor.gpa.sat.clep) | ||
+ | |||
+ | Call: | ||
+ | lm(formula = gpa ~ res.lm.sat.clep) | ||
+ | |||
+ | Residuals: | ||
+ | Min 1Q Median | ||
+ | -0.3756 -0.2694 -0.0092 | ||
+ | |||
+ | Coefficients: | ||
+ | Estimate Std. Error t value Pr(> | ||
+ | (Intercept) | ||
+ | res.lm.sat.clep -0.0007015 | ||
+ | --- | ||
+ | Signif. codes: | ||
+ | |||
+ | Residual standard error: 0.3382 on 8 degrees of freedom | ||
+ | Multiple R-squared: | ||
+ | F-statistic: | ||
+ | |||
+ | </ | ||
====== 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.txt · Last modified: 2023/05/31 08:56 by hkimscil