Teaching with Stata

advertisement
Teaching with Stata
Alan C. Acock
&
Peter Lachenbruch
Oregon State University
alan.acock@oregonstate.edu
peter.lachenbruch@oregonstate.edu
Teaching with Stata in a SPSS
College
• When I started teaching with Stata
– 90% of the faculty used SPSS
– 10% used SAS
• Stat Transfer is a powerful argument
• SPSS can save a Stata file for people use to
using SPSS for data management
• Faculty using SPSS rely mostly on its
excellent menu system
• Students who know Stata can use SPSS
menu
2007 WCSUG Presentation
2
Need Colleagues
• College had good fortune of hiring Tony
– Impeccable statistical qualifications
– Long history of using Stata
• Use Stata’s strengths to get colleague
support
– Long & Freese Limited Dependent Variables
– gllamm
– Complex sample capabilities
– ice, mim
– Many of these are user written
2007 WCSUG Presentation
3
Need Colleagues
• College Methodology Core presentations
– Students’ presentations doing things not possible with
SPSS
– Recruit Faculty Projects to using Stata & have Faculty
presentations
– Emphasize what Stata can do rather than attacking
SPSS--advantages are obvious
• Faculty inertia is like herding cats
2007 WCSUG Presentation
4
It’s Hard to Convince Menu
Addicts
• Most colleagues have a research team &
need to coordinate their work
–
–
–
–
–
–
–
Need to plan data management & analysis
Need to maintain a record of all changes to data
Need to have comments
Need to organize & understand datasets
Need to replicate data modifications
Need to replicate results
Need to do “revise & resubmit” re-analysis
2007 WCSUG Presentation
5
Convincing Menu Addicts
Appropriate use of menu system
– Nobody ever needs to replicate your results
– No other people working as part of a team
– All your manuscripts are published without
need for revisions
– Learning about options w/o reading the
manuals
– I use them with graphs & then copy to a dofile
2007 WCSUG Presentation
6
Convincing Menu Addicts
• Refuse to help student w/o all
relevant do-files
– I should be able to stick their flash drive in my
PC and have their data created and analyzed
• Require appropriate comments
– Students never imagine how much they can
forget
– Need write comments so somebody else can
use the program
2007 WCSUG
Presentation
7
Command Structure--Stata’s
Great Strength
• I show the Stata program in class
• I require the Stata program to be submitted with all labs
• In presentations, I sometime[s] show SPSS or SAS code
that can duplicate Stata
– without stressing how bizarre it is
– ”type a little, get a little” is compelling by comparison to
SPSS/SAS
•
•
•
•
regress y x1 x2, beta
logit y x1 x2, or
poisson y x1 x2
factor x1 - x12, pcf
2007 WCSUG Presentation
8
Working with Graphs
• Many introductory statistics courses minimize graphic
presentations
• Many students & colleagues rely on Excel for graphs
• Stata 10 has a professional quality graphs
• Graphics editor in Stata 10 gives students a sense of
efficacy it is hard to get with most statistics procedures
• Stress knowing their audience--bar chart or histogram
may be most effective for non-technical audience
• Stress need to have strong statistical evidence behind
the graph, even when not reported
• Two-way graphs with multiple overlays--scatter, linear,
quadratic
2007 WCSUG Presentation
9
What to do in Labs--Motivations
• My undergraduates are in the social &
behavioral/health sciences
• All state programs in Oregon are required to justify
their existence on a regular basis
• Funding for new programs is part of many
positions
• Substantive content gets first job; ability to
write/evaluate program proposals get promotions
• Labs focus on statistics/graphs, data access, &
analysis that facilitate evaluating programs
2007 WCSUG Presentation
10
What to do in Labs--Activities
• Class/group conduct a survey near start of
course
– N of 100 is nice, 50 is critical
– Let class/group pick the topic
– Each enters some data & then use append
– Label variables, values, missing values
– Create a scale using rowmean/rowtotal
– Cover alpha after corr
– Use their survey data to write short advocacy
– Use their survey for several types of analysis
2007 WCSUG Presentation
11
What to do in Labs--Activities
• Class/group survey
– Require them to have some items that are not
simple to code
• Skips
• Select all that apply
• Ranking of five items
– This helps them with coding, data entry, &
data management tasks
– Lab reports should emphasize interpretation
rather than just getting the right “number.”
2007 WCSUG Presentation
12
What to do in Labs--UCLA Stata
Portal
• Give them assignments to find instruction on selected
topics, for example
– http://www.gseis.ucla.edu/courses/ed230a2/notes/eff
ect.html for effect size
– Search Stata’s FAQ for some topic we provide
– Do exercise based on UCLA video
• Students played jeopardy as review for tests
• Elements of research methods introduced wherever I
can—This helps to make statistics seem more relevant
2007 WCSUG Presentation
13
What to do in Labs--Activities
• Use real data for most analyses
– Require some data management for many of
the assignments
• W/O this, they quickly forget how to manage data
• W/O this, they don’t understand importance of data
management
– Require a do-file for many of the assignments
• Regular use of display for calculations
gets them used to keeping Stata open
2007 WCSUG Presentation
14
What to do in Labs--Activities
• Have them keep a portfolio
– Include all lab activities
– Include notes from lecture
– Include exercises they did that were not
required
– Include activities for class
• I give them full credit if this looks fairly
complete. It is a small portion of the grade
• They often go back to these in subsequent
coursework
2007 WCSUG Presentation
15
What User Written Commands?
• Introductory graduate statistics can utilize
user written commands
• Here are some I like them to have in first
year course
– fre
• Those who have SPSS background love this
– ice, mim, misschk
• Missing values are a profound problem in
social/behavioral/health sciences
2007 WCSUG Presentation
16
What User Written Commands?
• Here are a couple more user written
commands
– Long & Freese commands for categorical &
count outcomes
– corrtab
• Nicer display of correlations including significance
• I use this when searching for examples of small,
medium, & large correlations for lecture use
pathreg
This does path analysis quite simply & insures
each equation has same N.
2007 WCSUG Presentation
17
What User Written Commands?
• More user commands I include for data
management
– Center
• Simple, but useful
• User written commands like this are a great way to
introduce them to writing their own commands
– zscore
– revrs
• Handy for reversing scores on ordinal variables
2007 WCSUG Presentation
18
What User Written Commands?
• User written commands I use as teaching tools
to help students visualize. Many students find a
visual approach more accessible than a
mathematical approach
– beamplot mpg, over(rep78)
• Balance mean for interval over categorical variables
– clt
• Nice demo of Central Limit Theorem
• chidemo df p for df = 1, 5, 30, 50 reminds them of the
CLT
– cordemo
• Does r = .5 mean the relationship is strong?
2007 WCSUG Presentation
19
What User Written Commands?
• User written commands I use as teaching tools
– pwrdemo2, n(x) diff(x) alpha(x)
• Where diff is the effect size
• Helps students understand effect size concept that is widely
used in psychology
– ftable, ttable, ztable
• Students often forget their textbook
– Simanova
• Unequal N’s do not matter much when variances are similar
• Unequal variances do not matter much when N’s are similar
• When both are unequal the nominal alpha is meaningless.
2007 WCSUG Presentation
20
Classroom Management
• We have a server that any student can access
from anyplace with internet connectivity
• We have a cart with 25 very cheap laptops that
basically work as dumb terminals to connect to
server
• Many students bring their own laptops
• Biggest problem is to keep them from email/web
browsing/game playing
– Apply cell phone policy to laptops
– Walk around room or have lab assistant sit at back to
monitor
2007 WCSUG Presentation
21
Classroom Management
• Lecture focuses on statistics; lab on Stata--but some
computer work during lecture
– Reinforces what they are being taught
– Keeps them awake—especially if they are doing it
• Students can easily produce the correct statistics using
Stata, but they have difficulty interpreting the results
– A statistically significant result can be trivial
– A confidence interval may highlight that a result is trivially
different from zero effect
– Need to assess both substantive & statistical significance
– Discuss pitfalls such as explaining rare events
• Simulations can help them understand assumptions
2007 WCSUG Presentation
22
Room for Improvement
• corr does not give significance, just pwcorr or
corrtab. Beginners do not understand why.
• Effect size post estimation command for all
appropriate tests—APA expects to see effect
size reported—would open up a huge market
• Add icon on menus that will copy command at
the end of the do-file, if only one do-file is open
• Enhance do-file editor
• Add professional quality three-dimensional
graphics
2007 WCSUG Presentation
23
Room for Improvement
• Missing values package including complex
survey, longitudinal, & multilevel data
• Develop factor analysis commands
• Nice to have some way that Stata could
validate the most powerful user written
commands
• Need book who how to systematically
manage data using Stata—more than just the
commands—including the philosophy behind
it
2007 WCSUG Presentation
24
Room for Improvement
• Need menu icon in Stata to copy directly
to a do-file
– Experienced users often have several
concurrent do-files & Stata wouldn’t know
which do-file should get the command
– Beginning students usually have a single dofile
– Single click option would be nice, when you
have only one do-file open
2007 WCSUG Presentation
25
Discussion Topics
• Experience gaining support for Stata
– Barriers
– Solutions to overcome barriers
• Ideas for Labs
• Favorite user written commands for beginners
– Instruction
– Data Management
– Analysis
• Suggested Stata enhancements to make it a
better tool for instruction
2007 WCSUG Presentation
26
Download