BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jonatan_velarde
Lapis Lazuli | Level 10

I have this dataset:

 

data have;
length day$ 20;
input week day$ sell_item;
format sell_item sell_item_.;
datalines;
1 Monday 6
1 Tuesday 51
1 Wednesday 69
1 Thursday 68
1 Friday 28
1 Saturday 16
1 Sunday 94
;
proc freq data=have;
tables day / nopercent norow nocol deviation expected chisq;
weight sell_item;
run;

 

 

here i see information of selling items in a store. Regarding chi squared test, can be found statistical significance (p<0.01), but i would like to estimate individual difference of selling between each day.

 

thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

For that hypothesis you only need the Type 3 test for DAY from this code:

proc genmod data=have;
class day;
model sell_item=day/dist=poisson type3;
run;

View solution in original post

8 REPLIES 8
sbxkoenk
SAS Super FREQ

The Chi-Square Test you do is testing for Equal Proportions.

 

Here's how to compare two proportions in SAS (between two days if you want):

I haven't read above blog and usage note myself (I'm in a hurry) but it may be that you still have to correct for an inflation of the TYPE-I error when doing multiple comparisons (like a BONFERRONI correction).

 

Cheers,

Koen

PaigeMiller
Diamond | Level 26

You can't find a statistical difference between days unless you have replicates of Monday, and replicates of Tuesday, and so on.

--
Paige Miller
jonatan_velarde
Lapis Lazuli | Level 10
I thought the same my friend, later i posted current question.

What can be done with this code:
data have;
length day$ 20;
input week day$ sell_item;
format sell_item sell_item_.;
datalines;
1 Monday 6
1 Tuesday 51
1 Wednesday 69
1 Thursday 68
1 Friday 28
1 Saturday 16
1 Sunday 94
2 Monday 16
2 Tuesday 41
2 Wednesday 29
2 Thursday 28
2 Friday 78
2 Saturday 6
2 Sunday 4
3 Monday 16
3 Tuesday 71
3 Wednesday 19
3 Thursday 18
3 Friday 18
3 Saturday 36
3 Sunday 64

;
proc freq data=have;
tables day / nopercent norow nocol deviation expected chisq;
weight sell_item;
run;





PaigeMiller
Diamond | Level 26

Okay, what hypothesis do you want to test to determine if the difference between days is statistically significant?

--
Paige Miller
jonatan_velarde
Lapis Lazuli | Level 10
Hypothesis: At least 1 day has better sells at week.
StatDave
SAS Super FREQ

For that hypothesis you only need the Type 3 test for DAY from this code:

proc genmod data=have;
class day;
model sell_item=day/dist=poisson type3;
run;
Ksharp
Super User
Also could try TESTP= option:
proc freq data=have;
tables day / testp=(.....);
weight sell_item;
run;
StatDave
SAS Super FREQ

If there is only the one predictor, then you can fit a Poisson model. Note that in this case, the model is saturated, so the predicted values are exactly the observed values.

proc genmod;
class day;
model sell_item=day/dist=poisson;
lsmeans day / diff ilink; 
run;

If there is a second categorical predictor, resulting in a 2-way table with your SELL_ITEM variable giving the cell counts, then this note shows ways you can proceed, including analyzing subtables or fitting a model. 

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
  • 8 replies
  • 674 views
  • 5 likes
  • 5 in conversation