Correlation between given day and mean of previous days

Hey guys, I would appreciate your help....
I need to find corr coef between daily mortality data and daily pollutant concentrations. I need to do it in 2 ways:
1. Correlation between given day of mortality and the same day of pollutant (e.g. mortality 03/01/2006-pollutant 03/01/2006),
2. Correlation between given day of mortality and mean concentration of pollutant on given day plus 2 days ago ( e.g. mortality 03/01/2006-pollutant 03/01/2006-02/01/2006-01/01/2006).
I am attaching an indicative .xlsx containing the necessary data. Could anyone help me on this?
PS. I'm on Matlab 2019a

댓글 수: 6

It appears you are trying calculate the correlation between one point and another point. This isn't possible. Correlation is calculated between a range of values for one variable (e.g., mortality) and the corresponding values in another variable (e.g., concentration of a certain pollutant).
What about this: what if I calculate movmean of each pollutant with 3-days window? Could I then calculate corrcoef between mortality on 01/01/2006 and moving average pollutant that corresponds to that day?
Sure, you can calculate the correlation between three points in one variable and three corresponding points in another variable. However, with only three points, the corresponding p-value will be high, which is to say, you can't put much faith in the computed correlation. For example, here's what you get using the first three days in your data set (mortality in column B vs. concentration of PM10_g_m3 in column G):
x = [12, 17, 21]; % B2:B4
y = [33, 29, 58]; % G2:G4
[R, P] = corrcoef(x,y)
r =
1 0.75492
0.75492 1
p =
1 0.45535
0.45535 1
Sorry, I didn't mean that...
I meant to first caclulate the movmean of the pollutant (e.g. concentration of PM10_g_m3 in column G) with a 3-day window, thus creating a new "column" with 4018 rows, and then find the corrcoef between the first item of this new "column" and the first item of mortality in column B .
You've just circled back to my original point:
find the corrcoef between the first item of ... and the first item of ...
Yes right, but I want to see if there is a way I can do it without using movmean in case something is being calculated incorrectly.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

질문:

2021년 6월 25일

댓글:

2021년 6월 25일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by