BookmarkSubscribeRSS Feed
PeterBr
Obsidian | Level 7

Hi All, I have the time series data below. I would like to find out whether there has been a statistically significant shift in the proportion towards the variable "out". Any ideas as to how to achieve this?

 

My initial thought was to do the proc reg below with just year as the independent variable to show a positive and significant coefficient. However, I got the warning "The range of variable year is so small relative to its
mean that there may be loss of accuracy in the
computations. You may need to rescale the variable to
have a larger value of RANGE/abs(MEAN), for example,
by using PROC STANDARD M=0;". 

 

Am I still okay to use the results despite this warning? Or is there a better test I can use?

 

 data have;
 input year setting $ frequency proportion;
 cards;
2009 inp 770 0.77
2009 out 230 0.23
2010 inp 770 0.77
2010 out 230 0.23
2011 inp 700 0.7
2011 out 300 0.3
2012 inp 670 0.67
2012 out 330 0.33
2013 inp 650 0.65
2013 out 350 0.35
2014 inp 600 0.6
2014 out 400 0.4
2015 inp 580 0.58
2015 out 420 0.42
2016 inp 520 0.52
2016 out 480 0.48
2017 inp 520 0.52
2017 out 480 0.48
2018 inp 400 0.4
2018 out 600 0.6
 ;
 run;

 proc reg data = have;
model proportion = year;
where setting = 'out';
run;

 

 

4 REPLIES 4
PGStats
Opal | Level 21

No need to worry. But if you want to get rid of the warning, create

 

y = year - 2000;

 

and use y in your regression.

PG
PeterBr
Obsidian | Level 7

Okay great to know, thanks. Out of curiosity would you know how the proc reg method compares to simply using the correlation P value or a Mann-Kendall test like the code below? As in, are any of these methods superior to the others or are they all acceptable in my case? If they all are acceptable, I think I'd just stick with proc reg.

 

proc corr data = have plots(only)=scatter(ellipse=none);
var year proportion;
where setting = 'out';
run;


proc corr data = have kendall; var proportion; with year; by setting; ods output KendallCorr= MannKendall; where setting = 'out'; run;
PGStats
Opal | Level 21

The assumptions behind those p-values are not the same. Regression of proportion = year asumes that year is a known value and that proportion varies linearly with year plus an added random (unexplained) component distributed normally. Correlations assume that both variables are random quantities *. The Pearson correlation assumes normality and a linear relation between the two. Kendall correlation relaxes that requirement somewhat by assuming a monotonic relationship between the two variables (i.e. they increase or decrease systematicly relative to each other). 

 

Be aware that there is a vast amount of litterature on the detection and quantification of time trends. Each field of study has its favorites.

 

* To convince yourself of this, try exchanging the roles of year and proportion in the regression and correlations.

 

hth

PG
SteveDenham
Jade | Level 19

If you want to see if there is a shift toward 'out', consider creating a difference variable between inp and out for each year, and regressing that difference on year. If the difference is defined as diff=inp-out and the slope coefficient is less than zero, then there is evidence that inp is moving toward out.  If you do it in PROC REG, you should get a Durbin-Watson statistic telling you whether there is autoregression of the residuals that complicates things.  I worry a bit about the variables being proportions, but since they are all well bounded away from 0 and 1, the standard regression should be adequate to test this (provided there is no evidence for autoregression of the errors).

 

SteveDenham.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 2053 views
  • 4 likes
  • 3 in conversation