[R] partial correlation

David Freedman 3.14david at gmail.com
Mon Dec 8 20:19:22 CET 2008


not sure which library 'pcor' is in, but why don't you just use the ranks of
the variables and then perform the correlation on the ranks:

x<-sample(1:10,10,rep=T)
y<-x+ sample(1:10,10,rep=T)
cor(x,y)
cor(rank(x),rank(y))

HTH
david freedman



Jürg Brendan Logue wrote:
> 
> Hej!
> 
>  
> 
> I have the following problem: 
> 
>  
> 
> I would like to do partial correlations on non-parametric data. I checked
> "pcor" (Computes the partial correlation between two variables given a set
> of other variables) but I do not know how to change to a Spearman Rank
> Correlation method [pcor(c("BCDNA","ImProd","A365"),var(PCor))]
> 
>  
> 
> Here's a glimpse of my data (data is raw data).
> 
> 
> A436
> 
> A365
> 
> Chla
> 
> ImProd
> 
> BCDNA
> 
> 
> 0.001
> 
> 0.003
> 
> 0.624889
> 
> 11.73023
> 
> 0.776919
> 
> 
> 0.138
> 
> 0.126
> 
> 0.624889
> 
> 27.29432
> 
> 0.357468
> 
> 
> 0.075
> 
> 0.056
> 
> 0.624889
> 
> 105.3115
> 
> 0.429785
> 
> 
> 0.009
> 
> 0.008
> 
> 0.312444
> 
> 55.2929
> 
> 0.547752
> 
> 
> 0.005
> 
> 0.002
> 
> 0.624889
> 
> 26.9638
> 
> 0.738775
> 
> 
> 0.018
> 
> 0.006
> 
> 0.312444
> 
> 31.14836
> 
> 0.705814
> 
> 
> 0.02
> 
> 0.018
> 
> 2.22E-16
> 
> 11.90303
> 
> 0.755003
> 
> 
> 0.002
> 
> 0.003
> 
> 0.624889
> 
> 7.829781
> 
> 0.712091
> 
> 
> 0.047
> 
> 0.044
> 
> 1.523167
> 
> 1.423823
> 
> 0.710939
> 
> 
> 0.084
> 
> 0.056
> 
> 13.7085
> 
> 1.533703
> 
> 0.280171
> 
>  
> 
> I’m really grateful for any help since I only recently started employing
> R.
> 
>  
> 
> Best regards, 
> JBL
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> 	[[alternative HTML version deleted]]
> 
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 


-----
David Freedman
Atlanta
-- 
View this message in context: http://www.nabble.com/partial-correlation-tp20900010p20901761.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list