Using Matlab c Using the command rlagaxcorrx to find the aut
Using Matlab:
c. Using the command [r,lag]=axcorr(x) to find the autocorrelation between consecutive reports of asthma cases.
d. Using the command [r,lag]=axcorr(x,y) to find the cross-correlation between the number of asthma cases and the number of upper respiratory infections given by the last two columns of the file included below.
Data given is a .xls file called \'athma\'
| Asthma, Principal (493) | Asthma, Any (493) | Respiratory minus asthma, Principal (460-519, exclude 493) | Respiratory minus asthma, Any (460-519, exclude 493) | ||
| 1 | 1/1/2005 | 23 | 56 | 228 | 308 |
| 2 | 1/2/2005 | 35 | 61 | 207 | 292 |
| 3 | 1/3/2005 | 27 | 50 | 172 | 235 |
| 4 | 1/4/2005 | 26 | 50 | 128 | 191 |
| 5 | 1/5/2005 | 21 | 55 | 174 | 237 |
| 6 | 1/6/2005 | 15 | 47 | 134 | 201 |
| 7 | 1/7/2005 | 20 | 61 | 152 | 215 |
| 8 | 1/8/2005 | 36 | 60 | 182 | 269 |
| 9 | 1/9/2005 | 32 | 65 | 248 | 319 |
| 10 | 1/10/2005 | 36 | 65 | 167 | 217 |
| 11 | 1/11/2005 | 21 | 55 | 133 | 201 |
| 12 | 1/12/2005 | 22 | 51 | 144 | 197 |
| 13 | 1/13/2005 | 24 | 58 | 140 | 212 |
| 14 | 1/14/2005 | 34 | 52 | 131 | 210 |
| 15 | 1/15/2005 | 31 | 55 | 156 | 234 |
| 16 | 1/16/2005 | 29 | 82 | 178 | 273 |
| 17 | 1/17/2005 | 29 | 63 | 136 | 188 |
| 18 | 1/18/2005 | 30 | 67 | 136 | 194 |
| 19 | 1/19/2005 | 30 | 72 | 142 | 205 |
| 20 | 1/20/2005 | 33 | 75 | 142 | 211 |
Solution
num1 = xlsread(\'asthma.xls\');
[r1,lag1]=xcorr(num1(:,3));%autocorrelation of column 3
[r2,lag2]=xcorr(num1(:,4));%autocorrelation of column 4
[r3,lag3]=xcorr(num1(:,5));%autocorrelation of column 5
[r4,lag4]=xcorr(num1(:,6));%autocorrelation of column 6
%cross correlation of last two columns
[r5, lag5]=xcorr(num1(:,5),num1(:,6));
![Using Matlab: c. Using the command [r,lag]=axcorr(x) to find the autocorrelation between consecutive reports of asthma cases. d. Using the command [r,lag]=axcor Using Matlab: c. Using the command [r,lag]=axcorr(x) to find the autocorrelation between consecutive reports of asthma cases. d. Using the command [r,lag]=axcor](/WebImages/18/using-matlab-c-using-the-command-rlagaxcorrx-to-find-the-aut-1036137-1761537641-0.webp)