Presentation is loading. Please wait.

Presentation is loading. Please wait.

July, 2008 Presentation at Los Angeles Basin SAS Users Group Meeting The Dangers and Wonders of Statistics Using SAS or You Can Have it Right and You Can.

Similar presentations


Presentation on theme: "July, 2008 Presentation at Los Angeles Basin SAS Users Group Meeting The Dangers and Wonders of Statistics Using SAS or You Can Have it Right and You Can."— Presentation transcript:

1 July, 2008 Presentation at Los Angeles Basin SAS Users Group Meeting The Dangers and Wonders of Statistics Using SAS or You Can Have it Right and You Can Have it Right Away AnnMaria De Mars, Ph.D. The Julia Group http://www.thejuliagroup.com AnnMaria De Mars, Ph.D. The Julia Group http://www.thejuliagroup.com

2 Statistics are Wonderful

3 Three common statistical plots 1.Analyzing a large-scale dataset for population estimates 2.Small datasets for market information 3.Comparison of two groups to determine effectiveness 1.Analyzing a large-scale dataset for population estimates 2.Small datasets for market information 3.Comparison of two groups to determine effectiveness

4 How much time do people spend alone? 1. National Survey Example

5 Very quick, wrong answer

6 First problem: Data are wrong

7 Know your data. I said it twice because it was important. Get to intimately know your data before you do ANYTHING.

8 American Time Use Survey Conducted by U.S. Census Bureau Study of how a nationally representative sample of Americans spend their time

9 Common Survey Issue Samples are not simple random but often multi- stage stratified, meaning that … “Users need to apply weights when computing estimates with the ATUS data because simple tabulations of unweighted ATUS data produce misleading results. “

10 Equation provided by ATUS T i = ∑ fwgt T ij ------------ ∑fwgt In other words …. The average amount of time the population spends in activity j Tj is equal to The sum of the weight for each individual multiplied by the individual responses of how much time they spend on activity j Divided by the sum of the weights.

11 Really easy answer PROC SORT ; BY sex child ; PROC MEANS DATA= in.atus ; BY sex child ; WEIGHT tufinlwgt ;

12 Right procedure, wrong answer Data are coded with negative numbers, e.g., -1 = blank -2 = don’t know -3 = refused to answer With the result that for some procedures the means shown are actually negative time spent in an activity

13 Fixing the data DATA atus ; SET mylib.atus ; ARRAY rec{*} _numeric_ ; DO i = 1 TO DIM(rec) ; IF rec{i} < 0 THEN rec{i} =. ; END ;

14 How this impacts output # of minutes per day alone With and without weights Child at Home Unweighted Mean Weighted Mean FemaleNO404347 YES199207 MaleNO372324 YES201205

15 Generalizing to the Population

16 The Problem I would like to get an estimate of the population values. How many children are in the average household? How many hours does the average employed person work?

17 A bigger problem It is not acceptable to just calculate means and frequencies, not even weighted for percent of the population, because I do not have a random sample. My sample was stratified by gender and education.

18 Some common “messy data” examples Small, medium and large hospitals in rural and urban areas Students selected within classroms in high-, low- and average- performing schools

19 Data requiring special handling Cluster samples - subjects are not sampled individually, e.g., classrooms or hospitals are selected and then every person within that group is sampled. Non-proportional stratified samples - a fixed number is selected from, e.g., each ethnic group

20 PROC SURVEYMEANS DATA=in.atus40 TOTAL = strata_count ; WEIGHT samplingweight ; STRATA sex educ ; VAR hrsworked numchildren ; SAS PROCEDURE FOR A STRATIFIED SAMPLE

21 PROC SURVEYMEANS DATA=in.atus40 TOTAL = strata_count ; Gives a dataset with the population totals for each strata WEIGHT samplingweight ; STRATA sex educ ; VAR hrsworked numchildren ;

22 SURVEY MEANS OUTPUT

23 Surveymean Output

24 Dataset with total counts

25 Answers Price List Answers $1 Answers, Correct $100 Answers, Requiring Thought -- $1,000

26 Survey Procedures Surveymeans - can provide estimates of means, standard errors, confidence intervals Surveyfreq - provides estimates of population totals, standard errors, confidence limits

27 And now for something completely different … 2. Using SAS Enterprise Guide to analyze target market survey data in the hour before your meeting

28 It’s not always rocket science There may be a tendency to use the most sophisticated statistical techniques we can find when what the customer really wants is a bar chart

29 Customer Need Our target market is Native Americans with chronic illness in the Great Plains region. We want to know how people get most of their information so that we can develop a marketing strategy.

30 Questions 1.How often do people read the newspaper versus use the Internet? 2.Is it the same people who are using a lot of media, e.g. email, radio, Internet, or do different people use different sources of information?

31

32 Creating Enterprise Graphs 1.Double-click on SAS dataset to open 2.Select Graph > Bar Chart > Colored Bars 3.Select Task Roles 4.Click on Internet_Use 5.Select Analysis Variable Repeat steps for second chart for newspaper readership

33

34

35 Correlations 1.Select Analyze > Correlations 2.Select variables from list 3.Click RUN

36

37

38 Frequency Distribution Select Describe > One-Way Frequencies

39

40 Recommendations Create a website and an email list to contact potential customers on the reservations Advertise on the radio and in the newspaper That will be $4,000, please.

41 Nice theory, but does it work? 3. Evaluating program effectiveness

42 We changed something. Did it work ? A two-day staff training program was offered. A pre-test was given before training occurred and at the conclusion of training. The test consisted of multiple choice questions and case studies.

43 Just for fun …. I decided to do the whole project using only two procedures, PROC CORR and PROC GLM

44 Wonder of SAS: One step produces multiple steps in psychometric analysis PROC CORR DATA = tests ALPHA ; WHERE test_type = “pre” ; VAR q1 – - q40 ; PROC CORR DATA = tests ALPHA ; WHERE test_type = “pre” ; VAR q1 – - q40 ;

45 Descriptive statistics output from PROC CORR Check for data entry errors, restriction in range, low variance

46 My alpha is not very good and I am sad

47 Item Analysis (continued) Are two different factors being measured?

48 Inspect the correlation matrix Items with negative item-total correlations are not intercorrelated

49 The General Linear Model It really is general. You may now jump for joy at this obvious revelation. It really is general. You may now jump for joy at this obvious revelation.

50

51 REGRESSION PROC GLM DATA=in.test2 ; MODEL score = age years_of_ed ; WHERE test_type = "pre" ; PROC GLM DATA=in.test2 ; MODEL score = age years_of_ed ; WHERE test_type = "pre" ;

52 PROC GLM OUTPUT

53 2 x 2 Analysis of Variance PROC GLM DATA=in.test2 ; CLASS disability job; MODEL score = disability job disability*job ; WHERE test_type = "pre" ; PROC GLM DATA=in.test2 ; CLASS disability job; MODEL score = disability job disability*job ; WHERE test_type = "pre" ;

54

55 Repeated Measures ANOVA Uh - maybe someone should have mentioned this …..

56 One record per subject

57 REPEATED MEASURES ANOVA PROC GLM DATA = in.mrgfiles ; CLASS test_group ; MODEL score score2 = test_group ; REPEATED test 2 ; LSMEANS test_group ; PROC GLM DATA = in.mrgfiles ; CLASS test_group ; MODEL score score2 = test_group ; REPEATED test 2 ; LSMEANS test_group ;

58 Repeated Measures ANOVA

59

60 LSMEANS OUTPUT

61 CONCLUSIONS  SAS has made it possible to obtain output of statistical procedures without ever needing to understand the underlying assumptions. This is a mixed blessing.  Enterprise Guide makes statistics accessible to a wider audience. This is a good thing.  The best statistical analysis is not the one that the fewest people can understand but that the most people can understand.


Download ppt "July, 2008 Presentation at Los Angeles Basin SAS Users Group Meeting The Dangers and Wonders of Statistics Using SAS or You Can Have it Right and You Can."

Similar presentations


Ads by Google