[R-sig-teaching] Computing correlations including the p values
Ista Zahn
istazahn at gmail.com
Wed Apr 4 04:32:33 CEST 2012
On Tue, Apr 3, 2012 at 10:24 PM, AbouEl-Makarim Aboueissa
<aaboueissa at usm.maine.edu> wrote:
> Hi,
>
> I am able to get the correlations as:
>
> xxx<-cbind(x1,x2,x3)
> yyy<-cbind(y1,y2,y3)
> cor(xxx,yyy)
> This yields same results as yours.
>
> But I could not get the p values yet.
What have you tried? What went wrong? Getting the p.values is not a
straightforward extension of the approach I illustrated earlier, but
it is something you can figure out with a few google searches. If you
run into problems I'll be glad to help, but please do make an effort
to figure it out on your own.
Best,
Ista
>
> thanks
> abou
>
>
>>>> Ista Zahn <istazahn at gmail.com> 4/3/2012 8:05 PM >>>
>
> Hi,
>
> For the correlations you just need to understand how matrix indecies work in
> R:
>
> cor(cbind(x1, x2, x3, y1, y2, y3))[4:6, 1:3]
>
> I'll leave it to you to figure out the p values part.
>
> Best,
> Ista
>
> On Tue, Apr 3, 2012 at 7:48 PM, AbouEl-Makarim Aboueissa
> <aaboueissa at usm.maine.edu> wrote:
>> Dear All: (revise of the previous message)
>>
>> I have another silly question. How I can compute the correlations of two
>> groups of variables including the p values. For example how to compute the
>> correlations of the X's with Y's only of these two groups of variables
>>
>> x1<-c(12,3,45,32,34,56,7,89)
>> x2<-c(6,8,9,6,7,44,33,22)
>> x3<-c(45,7,6,89,23,45,67,22)
>>
>> y1<-c(21,43,77,32,23,45,78,90)
>> y2<-c(32,56,78,90,34,23,11,23)
>> y3<-c(8,90,34,68,72,17,27,35)
>>
>>
>> This what I need to get:
>>
>> y1 y2 y3
>>
>> x1 corr(x1,y1) corr(x1,y2) corr(x1,y3)
>> p value p value p value
>>
>> x2 corr(x2,y1) corr(x2,y2) corr(x2,y3)
>> p value p value p value
>>
>> x3 corr(x3,y1) corr(x3,y2) corr(x3,y3)
>> p value p value p value
>>
>>
>>
>> Thank you very much
>> abou
>>
>>
>> ==========================
>> AbouEl-Makarim Aboueissa, Ph.D.
>> Associate Professor of Statistics
>> Graduate Program Coordinator
>> Department of Mathematics & Statistics
>> University of Southern Maine
>> 96 Falmouth Street
>> P.O. Box 9300
>> Portland, ME 04104-9300
>> USA
>>
>>
>> Tel: (207) 228-8389
>> Fax: (207) 780-5607
>> Email: aaboueissa at usm.maine.edu
>> aboueiss at yahoo.com
>>
>> Office: 301C Payson Smith
>>
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-teaching at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
More information about the R-sig-teaching
mailing list