[R] Estimating correlation in multiple measures data

Peter Langfelder peter.langfelder at gmail.com
Wed Mar 23 21:31:48 CET 2011


On Wed, Mar 23, 2011 at 1:17 PM, Michal Figurski
<figurski at mail.med.upenn.edu> wrote:
> Dear R-helpers,
>
> This may sound simple to you, but I'm a beginner in this, so please be
> forgiving.
> I have a following problem: two analytes were measured in patient's blood on
> 4 occasions: ProteinA and ProteinB. How to correctly evaluate correlation
> between ProteinA and ProteinB?
>
> I tried:
> x <- data.frame(Patient.ID=rep(1:10, each=4), Visit=rep(c(1:4),10),
> ProteinA=rnorm(m=10, n=40), ProteinB=rnorm(m=13,s=0.7,n=40))

simply use

cor(x$ProteinA, x$ProteinB)

If you want a p-value and confidence intervals, use

cor.test(x$ProteinA, x$ProteinB)


Peter



More information about the R-help mailing list