BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Yughaber
Quartz | Level 8

I have a dataset where I want to see if the time of the day (divided into categories of 4 hour intervals) has an effect/makes a difference in the length of stay of visitors. I thought to use one way ANOVA, however, when running the Levene's Test for homogeneity, I got a significant p-value which doesn't meet my assumption of equal variance. Any suggestions of what is the best test to use in this case? Thanks in advance! 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Take out outliers if they are truly aberrant (i.e. measurement errors or measurements outside the scope of your study). But don't throw them out just for the sake of running a parametric test. Use a robust test like the one I suggested instead.

PG

View solution in original post

10 REPLIES 10
PGStats
Opal | Level 21

First, check your data for outliers. Otherwise, the Wilcoxon test provided in proc NPAR1WAY is a good alternative.

PG
Yughaber
Quartz | Level 8
take out outliers if there are any?
PGStats
Opal | Level 21

Take out outliers if they are truly aberrant (i.e. measurement errors or measurements outside the scope of your study). But don't throw them out just for the sake of running a parametric test. Use a robust test like the one I suggested instead.

PG
Yughaber
Quartz | Level 8
I see, ok that sounds nice. How would I code for the proc NPAR1WAY?
PGStats
Opal | Level 21

Simple. For example, does car engine size differ among car models of different origins?

 

proc npar1way data=sashelp.cars wilcoxon;
class origin;
var enginesize;
run;

Note, the Wilcoxon test is called Kruskal-Wallis when comparing more than 2 categories.

PG
Yughaber
Quartz | Level 8
awesome! Thanks!!
Yughaber
Quartz | Level 8
For the median plot in NPAR1WAY, do you know how I can display how many counts/frequencies are above the median and how many are below? The plot only gives a total N and just shows a graph of above and below the median but I need to also know the frequencies above and below...
jiltao
SAS Super FREQ

You might also consider using PROC MIXED. PROC MIXED allows you to model the unequal variances. For example,

 

proc mixed;

   class hour;

   model y=hour;

   repeated / group=hour;

run;

This program estimates different variances in y for different groups in HOUR, and the inferences would take into account different variance estimates. 

Yughaber
Quartz | Level 8
this will only explain the variance right? I can't go further with proving any significant differences between the different time stamped visitor stays
jiltao
SAS Super FREQ
Yes, you can use the LSMEANS statement in PROC MIXED to do comparisons.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 10 replies
  • 2372 views
  • 8 likes
  • 3 in conversation