Skip to content
Prev 392469 / 398502 Next

Correlate

Dear Val,
On 2022-08-22 1:33 p.m., Val wrote:
This seems backwards to me, but I'll refrain from commenting further on 
whether what you want to do makes sense and instead address how to do it 
(not, BTW, because I disagree with Bert's and Tim's remarks).

Please see below:
Because of missing data, this computes the correlations on different 
subsets of the data. A simple solution is to filter the data for NAs:

D <- na.omit(dat)

More comments below:
This data manipulation is unnecessary. Just specify the argument 
na.strings="." to read.table().
Taking a somewhat different approach from cor.test(), you can apply 
Fisher's z-transformation (recall that D is the data filtered for NAs):

 > 2*pnorm(abs(atanh(data_cor)), sd=1/sqrt(nrow(D) - 3), lower.tail=FALSE)
         [,1]
x2 0.2462807
x3 0.3812854
x4 0.1156939

I hope this helps,
  John
Message-ID: <52b30ece-7746-a64f-b3a2-207a2724611a@mcmaster.ca>
In-Reply-To: <20234_1661189640_27MHY0f9000811_CAJOiR6as5387rVr-ff6gbiTdsyh=15Dvz2ECgqpW1S0-oxwf_A@mail.gmail.com>