STATA bys CategExplanatoryVar CategThirdVar tab CategResponseVar SAS proc sort

# Stata bys categexplanatoryvar categthirdvar tab

This preview shows page 14 - 18 out of 20 pages.

STATA bys CategExplanatoryVar CategThirdVar : tab CategResponseVar SAS proc sort; by CategThirdVar ; proc freq; tables CategResponseVar * CategExplanatoryVar ; by CategThirdVar ; R tab1 <- ftable( myData \$ CategResponseVar , myData \$ CategExplanatoryVar , myData \$ CategThirdVar ) tab1 tab1__colProp <- prop.table( tab1 , 2) tab1_colProp Note: If your 3rd variable is continuous, for graphing purposes, create meaningful categories and then use the code above. Bivariate Analysis ANOVA SPSS UNIANOVA QuantResponseVar BY CategExplanatoryVar . STATA oneway QuantResponseVar CategExplanatoryVar , tabulate SAS proc anova; class CategExplanatoryVar ; model QuantResponseVar = CategExplanatoryVar ; means CategExplanatoryVar ; R myAnovaResults <- aov( QuantResponseVar ~ CategExplanatoryVar , data = myData ) summary( myAnovaResults )
Pearson Correlation SPSS CORRELATIONS /VARIABLES= QuantResponseVar QuantExplanatoryVar /STATISTICS DESCRIPTIVES. STATA corr QuantResponseVar QuantExplanatoryVar r OR pwcorr QuantResponseVar QuantExplanatoryVar , sig SAS Proc corr; var QuantResponseVar QuantExplanatoryVar ; R cor.test( myData \$ QuantResponseVar, myData \$ QuantExplanatoryVar ) Chi-Square Test SPSS CROSSTABS /TABLES= CategResponseVar by CategExplanatoryVar /STATISTICS=CHISQ. STATA tab CategResponseVar CategExplanatoryVar , chi2 row col SAS Proc freq; tables CategResponseVar * CategExplanatoryVar / chisq; R myChi <- chisq.test( myData \$ CategResponseVar , myData \$ CategExplanatoryVar ) myChi myChi \$observed # for actual, observed cell counts prop.table( myChi \$observed, 2) # for column percentages prop.table( myChi \$observed, 1) # for row percentages
POST HOC TESTS WITHIN ANOVA SPSS UNIANOVA QuantResponseVar BY CategExplanatoryVar /POSTHOC= CategExplanatoryVar (TUKEY) /PRINT=ETASQ DESCRIPTIVE. STATA oneway QuantResponseVar CategExplanatoryVar , sidak SAS Proc anova; class CategExplanatoryVar ; model QuantResponseVar = CategExplanatoryVar ; means CategExplanatoryVar /duncan; R myAnovaResults <- aov( QuantResponseVar ~ CategExplanatoryVar, data = myData ) TukeyHSD( myAnovaResults ) POST HOC TESTS FOR CHI SQUARE (must subset data in order to conduct 2X2 comparisons) SPSS TEMPORARY. SELECT IF CategExplanatoryVar =1 OR CategExplanatoryVar =3. CROSSTABS /TABLES= CategResponseVar CategExplanatoryVar /STATISTICS=CHISQ. STATA tab CategResponseVar CategExplanatoryVar If CategExplanatoryVar ==1 | CategExplanatoryVar ==3, chi2 SAS IF ( CategExplanatoryVar = 1) AND ( CategExplanatoryVar = 3); (in data step) Proc freq; tables CategResponseVar * CategExplanatoryVar / chisq; R myDataSubset <- myData [ myData \$ CategExplanatoryVar == 1 | myData \$ CategExplanatoryVar == 3, ] myChi <- chisq.test( myDataSubset \$ CategResponseVar , myDataSubset \$ CategExplanatoryVar ) myChi myChi \$observed # for actual, observed cell counts prop.table( myChi \$observed, 2) # for column percentages prop.table( myChi \$observed, 1) # for row percentages
Statistical Interactions: Testing for Moderation ANOVA SPSS SORT CASES BY CategThirdVar .

#### You've reached the end of your free preview.

Want to read all 20 pages?

• Summer '16
• naveen rathi
• Statistics