Dear All,

Sorry to bother you again. As my previous mail was messy to understand,
please find it again to give me a solution. I'd like to do a partial
correaltion test ['pcor.test ()' or 'parcor()'] between Irid.area and
Casa.PC1 variables controlling the influence of SL (co-variate) according
to categorical group factors (Quantity or Quality group).

Can anyone give me any example or source of package that will be
appreciated. I already tried with "ggm" (doesn't work in R now), "ppcor",
but failed to modify or adjust with my data to anlyse as I want.

My effort:

> data1   Quantity Quality    SL Irid.area    Casa.PC1
1      High     Low 16.38     10.31  1.71173956
2      High    High 15.95     16.52  0.01338354
3      High    High 15.69     12.74  2.22849088
4      High     Low 14.76      9.80  1.55497583
5      High     Low 14.63     12.95  1.82376797
6      High    High 14.32     14.21  3.15205984
7      High    High 14.95     12.57  2.06926504
8      High     Low 15.37     13.55  1.88602742
9      High     Low 14.73     14.18  1.12744060
10     High    High 16.08     15.98  1.43556331
11      Low     Low 13.95     16.05 -1.44961267
12      Low     Low 14.03     12.58 -1.68596884
13      Low    High 14.82     13.57 -0.09742642
14      Low    High 14.32     12.16 -1.40351201
15      Low     Low 14.33      7.66 -1.33665471
16      Low     Low 15.01     10.15 -1.25701927
17      Low    High 14.01      9.79 -0.71540450
18      Low     Low 14.25     17.38 -1.29695402
19      Low    High 14.55     16.11 -0.61689594
20      Low    High 13.98     11.49 -0.65401736

> ### Correlation test according to group> library("MASS")> with(data1, 
> cor.test(~ Irid.area + Casa.PC1, subset=(Quantity=="High")))# gives cor, 
> df+2, p-values
        Pearson's product-moment correlation

data:  Irid.area and Casa.PC1
t = -1.0507, df = 8, p-value = 0.3241
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.8020154  0.3604104
sample estimates:
       cor
-0.3482398
> with(data1, cor.test(~ Irid.area + Casa.PC1, subset=(Quantity=="Low")))# 
> gives cor, df+2, p-values
        Pearson's product-moment correlation

data:  Irid.area and Casa.PC1
t = 0.1209, df = 8, p-value = 0.9068
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.6031431  0.6547228
sample estimates:
       cor
0.04269795

> ### ppcor tests:> y.data <- data.frame(+   v1=data1$Irid.area,+   
> v2=data1$Casa.PC1,+   f1=data1$Quantity,+   f2=data1$Quality)> 
> library(ppcor)> pcor(y.data)Error in pcor(y.data) : 'x' must be numeric ## I 
> also tried it with numeric values, but didn't give me the results same as 
> JMP> # partial correlation between "v1" and "v2" given "f1" and "f2"> 
> pcor.test(y.data$v1,y.data$v2,y.data[,c("f1","f2")])Error: is.numeric(y) || 
> is.logical(y) is not TRUE???

 Then I tried with

> #####pcor with ggm#####> library(ggm)# suggested by Andy Field et al. on 
> their book "Discovering statistics using R".Loading required package: 
> graphError: package ‘graph’ could not be loaded> examData2<- data1[, 
> c("Irid.area", "Casa.PC1", "SL")]> maleExam<-subset(data1, Quantity == 
> "High", select= c("Irid.area", "Casa.PC1"))> femaleExam<-subset(data1, 
> Quantity == "Low", select= c("Irid.area", "Casa.PC1"))> cor(maleExam)         
>   Irid.area   Casa.PC1
Irid.area  1.0000000 -0.3482398
Casa.PC1  -0.3482398  1.0000000> cor(femaleExam)           Irid.area   Casa.PC1
Irid.area 1.00000000 0.04269795
Casa.PC1  0.04269795 1.00000000> # partial correlation between two
var.> pcor.test(examData2$Irid.area, examData2$Casa.PC1,
examData2$SL..COVARIATE.,Quantity == "High")Error in
pcor.test(examData2$Irid.area, examData2$Casa.PC1,
examData2$SL..COVARIATE.,  :
  'use' should be either "rec" or "mat"!In addition: Warning
messages:1: In if (use == "mat") { :
  the condition has length > 1 and only the first element will be
used2: In if (use == "rec") { :
  the condition has length > 1 and only the first element will be used



So, again can anyone help me to find out the solution, and sorry in advance
to disturb you with the same issue.

Cheers,


Jewel
e-mail:moshiu...@yahoo.com
g-mail: mrahmankuf...@gmail.com

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to