# How to test significance of vector with correlation coefficients

I am new to R so please apolozige if I should use wrong terms etc.

Let's say I investigated married couples as subjects, and (amongst other) tested if their amount of consumed alcohol is correlated to each other. For this, I assed amount of alcohol consumed every day for a year, for both wife and husband in diffrent couples. I then assessed the cross-correlations (ccf function in R) for each couple.

I now have a vector containing cross-correlations coefficient (at lag 0) between the wife's amount of consumed alcohol and the husband's amount of consumed alcohol for each of the tested couples:

 0.15
 0.03
 0.17
 -0.33


... and so on (total of 200 subjects).

I now want to test, if these correlations are significantly greater than 0, using a t-test. Does this make sense? If yes, how can I do this in R?

## migrated from stackoverflow.comJun 5 at 8:32

This question came from our site for professional and enthusiast programmers.

Since you run a cross correlation the critical values (at the 5% level) are $$± 2/ \sqrt[]{n}$$. In your case the critical values are <0.1414214 and >0.1414214. See here.

Also keep in mind that for lag 0 you can simply use the Pearson correlation in cor(). See here:

set.seed(1)
x <- rnorm(200)
y <- x* .2 + rnorm(200)

corcoef <- ccf(x, y, lag.max = 0)[["acf"]]
corcoef
0.1605629
cor(x, y)
0.1605629


This means that if you are interested about lag= 0 you can use cor.test() which shows $$p$$ value. Here:

cor.test(x, y)
p-value = 0.02313
...
{"ft_lang_label":"__label__en","ft_lang_prob":0.9411539,"math_prob":0.90609205,"size":820,"snap":"2019-43-2019-47","text_gpt3_token_len":211,"char_repetition_ratio":0.12254902,"word_repetition_ratio":0.0,"special_character_ratio":0.25853658,"punctuation_ratio":0.12571429,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98862594,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-11-19T06:12:30Z\",\"WARC-Record-ID\":\"<urn:uuid:d69dd566-1a88-4c9e-950c-ad8b0e3975d1>\",\"Content-Length\":\"132018\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8bfe451b-6b3a-4098-bc7c-261c3a42969f>\",\"WARC-Concurrent-To\":\"<urn:uuid:778d080c-1ac0-4e53-8b14-bbc9580f8164>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://stats.stackexchange.com/questions/411599/how-to-test-significance-of-vector-with-correlation-coefficients\",\"WARC-Payload-Digest\":\"sha1:UGAUCDZ3IBPR5VPDQWVEIPXKP42HPUOR\",\"WARC-Block-Digest\":\"sha1:JUPSKYHDH3WHEWZ4O6DODHFMAFMDADM3\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-47/CC-MAIN-2019-47_segments_1573496670006.89_warc_CC-MAIN-20191119042928-20191119070928-00516.warc.gz\"}"}