UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Class Notes
More Statistics


1.0 Stata commands in this unit

. ttest
oneway
anova
test
regress
predict

2.0 Demonstration and Explanation

. use hsb2, clear

2.1 t-tests

. ttest write=50

. ttest write=read

. ttest write, by(female)
ttest write, by(female) unequal
sdtest write, by(female)

2.2 Analysis of Variance

. oneway write prog, tabulate
anova write prog
sort prog
by prog: summarize write
table prog, contents(n write mean write sd write)

. anova write female prog female*prog

2.3 Regression

. regress write read
regress write read, beta
predict pre1
generate pre2 = 23.95944 + .5517051*read
list pre1 pre2
graph pre1 write read, symbol(io) connect(L.)
graph pre1 write read, symbol(io) connect(L.) jitter(2)

. regress write read math
regress write read math female

2.4 Comments on anova & regress

3.0 Try the commands on your own

. use hsb2, clear
ttest math=50
ttest math, by(sch)
oneway math sci
oneway math prog
anova math prog ses prog*ses
test ses / prog*ses
regress science math
regress science math, beta
regress science math read
regress science math read write

4.0 Can you answer these questions?

  1. Could this sample have come from a population with a mean reading score of 53?
  2. Is there a significant difference in the means of low SES vs middle SES groups?
  3. Are the population means for social studies equals for all levels of SES?
  4. What is the regression equation for predicating social studies from reading and writing scores?

5.0 For More Information

6.0 Web Notes

The Stata Class Notes are available on the World Wide Web by visiting ...
      http://www.ats.ucla.edu/stat/stata/notes/

The dataset hsb2.dta can be loaded directly into Stata, over the Internet, using the following command:
use http://www.ats.ucla.edu/stat/stata/notes/hsb2


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.