2

I have the following data, which I'm analysing in matlab:

d = [1901   17.5    11.5
1902    12.5    8.5
1903    12.5    11.5
1904    18.5    18.5
1905    12.5    10.5
1906    10.5    8.5
1907    19.5    16.5
1908    12.5    13.5
1909    8.5 9.5
1910    16.5    11.5
1911    16.5    10.5
1912    9.5 13.5
1913    25.5    15.5
1914    20.5    17.5
1915    18.5    15.5
1916    16.5    18.5
1917    26.5    20.5
1918    30.5    25.5
1919    20.5    20.5
1920    19.5    19.5
1921    24.5    13.5
1922    23.5    18.5];

plot(d(:,1),[d(:,2) d(:,3)],'o');
lsline;

enter image description here

I would like to find out if the slope of these two lines are different, using some sort of statistical test. I can calculate the slope of each with:

lm = fitlm(d(:,1),d(:,2),'linear');
lm2 = fitlm(d(:,1),d(:,3),'linear');

whch shows that, lm:

Estimated Coefficients:
                   Estimate      SE        tStat      pValue  
                   ________    _______    _______    _________

    (Intercept)    -1070.1      299.31    -3.5752    0.0018944
    x1             0.56917     0.15659     3.6349     0.001649

and lm2:

Estimated Coefficients:
                   Estimate      SE        tStat       pValue  
                   ________    _______    _______    __________

    (Intercept)    -872.26      224.69    -3.8821    0.00092669
    x1             0.46414     0.11754     3.9487    0.00079318

This means that the slopes are different, but is this difference statisitcaly signficant? Is there a test that I can do to show that the slopes are different or the same, in a statistical sense (considering the error in the regression model)?

  • 1
    The slopes will be different if and only if the slope of the differences in the yearly values differs from zero. – whuber Jun 13 '16 at 20:53

1 Answers1

1

There may be a specific test for comparisons of means, but you probably don't need it for this example.

Because the difference in the slopes is only 0.1050 (from 0.56917-0.46414), and this is less than the Standard Error in the estimate for either one (0.11754 and 0.15659), I think that we can say there is insufficient evidence for a difference.

MikeP
  • 2,147
  • Very good--provided the two datasets are independent. But these are paired data with strong positive correlation, clearly violating that assumption. – whuber Jun 13 '16 at 20:52