User Tools

Site Tools


partial_and_semipartial_correlation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
partial_and_semipartial_correlation [2019/05/26 22:54] – [Semipartial cor] hkimscilpartial_and_semipartial_correlation [2019/05/26 23:05] – [Semipartial cor] hkimscil
Line 323: Line 323:
  
 ====== Semipartial cor ====== ====== Semipartial cor ======
-<code>> spcor.gpa.sat.clep <- spcor.test(gpa,sat,clep) 
-> spcor.gpa.sat.clep 
-     estimate   p.value  statistic  n gp  Method 
-1 -0.09948786 0.7989893 -0.2645326 10  1 pearson 
-> spcor.gpa.sat.clep$estimate^2 
-[1] 0.009897835 
-> </code> 
- 
 <code>> tests <- read.csv("http://commres.net/wiki/_media/r/tests_cor.csv") <code>> tests <- read.csv("http://commres.net/wiki/_media/r/tests_cor.csv")
 > colnames(tests) <- c("ser", "sat", "clep", "gpa") > colnames(tests) <- c("ser", "sat", "clep", "gpa")
Line 365: Line 357:
  
 > install.packages("ppcor") > install.packages("ppcor")
-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://cran.rstudio.com/bin/windows/Rtools/ 
-Installing package into ‘C:/Users/Hyo/Documents/R/win-library/3.6’ 
-(as ‘lib’ is unspecified) 
-trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/ppcor_1.1.zip' 
-Content type 'application/zip' length 30230 bytes (29 KB) 
-downloaded 29 KB 
- 
-package ‘ppcor’ successfully unpacked and MD5 sums checked 
- 
-The downloaded binary packages are in 
- C:\Users\Hyo\AppData\Local\Temp\Rtmp61tIED\downloaded_packages 
 > library(ppcor) > library(ppcor)
 Loading required package: MASS Loading required package: MASS
 +
 +> # regression test for semipartial correlation (holding clep constant)
 > spcor.gpa.sat.clep <- lm(gpa ~ res.lm.sat.clep) > spcor.gpa.sat.clep <- lm(gpa ~ res.lm.sat.clep)
 > summary(spcor.gpa.sat.clep) > summary(spcor.gpa.sat.clep)
Line 400: Line 381:
 Multiple R-squared:  0.009898, Adjusted R-squared:  -0.1139  Multiple R-squared:  0.009898, Adjusted R-squared:  -0.1139 
 F-statistic: 0.07997 on 1 and 8 DF,  p-value: 0.7845 F-statistic: 0.07997 on 1 and 8 DF,  p-value: 0.7845
- 
 </code> </code>
 +
 +From the above: Multiple R-squared: 0.009898
 +From the below: spcor.gpa.sat.clep%%$%%estimate^2: 0.009897835
 +
 +<code>> spcor.gpa.sat.clep <- spcor.test(gpa,sat,clep)
 +> spcor.gpa.sat.clep
 +     estimate   p.value  statistic  n gp  Method
 +1 -0.09948786 0.7989893 -0.2645326 10  1 pearson
 +> spcor.gpa.sat.clep$estimate^2
 +[1] 0.009897835
 +> </code>
 +
 +
 +
 ====== 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

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki