Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Other

STATISTICS WITH STATA

Rating
-
Sold
-
Pages
488
Uploaded on
26-11-2022
Written in
2013/2014

Stata and Stata resources are discussed, Data management, SURVEY data including Design weights, ANOVA and other companion methods, linear regression analysis, advanced regression methods and introduction to programming.

Institution
Course

Content preview

,Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

, Statistics
with



STATA
Updated for Version 12




Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

,This is an electronic version of the print textbook. Due to electronic rights restrictions, some third party content may be suppressed. Editorial
review has deemed that any suppressed content does not materially affect the overall learning experience. The publisher reserves the right to
remove content from this title at any time if subsequent rights restrictions require it. For valuable information on pricing, previous
editions, changes to current editions, and alternate formats, please visit www.cengage.com/highered to search by
ISBN#, author, title, or keyword for materials in your areas of interest.




Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

, Statistics
with



STATA
Updated for Version 12

Lawrence C. Hamilton
University of New Hampshire




Australia • Brazil • Japan • Korea • Mexico • Singapore • Spain • United Kingdom • United States




Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

, Statistics with STATA: Updated for Version 12 © , 2009, 2006 Brooks/Cole, Cengage Learning
Eighth Edition ALL RIGHTS RESERVED. No part of this work covered by the copyright
Lawrence C. Hamilton herein may be reproduced, transmitted, stored, or used in any form or by
any means graphic, electronic, or mechanical, including but not limited to
Publisher/Executive Editor: Richard Stratton photocopying, recording, scanning, digitizing, taping, Web distribution, in-
Senior Sponsoring Editor: Molly Taylor formation networks, or information storage and retrieval systems, except as
permitted under Section 107 or 108 of the 1976 United States Copyright Act,
Assistant Editor: Shaylin Walsh Hogan
without the prior written permission of the publisher.
Editorial Assistant/Associate: Alexander Gontar
Media Editor: Andrew Coppola For product information and technology assistance, contact us at
Marketing Assistant: Lauren Beck Cengage Learning Customer & Sales Support, 1-800-354-9706
Marketing Communications Manager: For permission to use material from this text or product,
Jason LaChappelle submit all requests online at www.cengage.com/permissions.
Further permissions questions can be emailed to
.

Library of Congress Control Number: 2012945319
ISBN-13: 978-0-8400-6463-9
ISBN-10: 0-8400-6463-2



Brooks/
k Cole
20 Channel Center Street
Boston, MA 02210
USA


Cengage Learning is a leading provider of customized learning solutions with
offi
ffice locations around the globe, including Singapore, the United Kingdom,
Australia, Mexico, Brazil and Japan. Locate your local office
ffi at
international.cengage.com/region


Cengage Learning products are represented in Canada by
Nelson Education, Ltd.


For your course and learning solutions, visit www.cengage.com.
Purchase any of our products at your local college store or at our preferred
online store www.cengagebrain.com.
Instructors: Please visit login.cengage.com and log in to access
instructor-specific
fi resources.




Printed in the United States of America
1 2 3 4 5 6 7 16 15 14 13 12



Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

, Contents


Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Notes on the Eighth Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

1 Stata and Stata Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
A Typographical Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
An Example Stata Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Stata’s Documentation and Help Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Searching for Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
StataCorp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
The Stata Journal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Books Using Stata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2 Data Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Example Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Creating a New Dataset by Typing in Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Creating a New Dataset by Copy and Paste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Specifying Subsets of the Data: in and if Qualifiers . . . . . . . . . . . . . . . . . . . . . . . 23
Generating and Replacing Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Missing Value Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Using Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Converting Between Numeric and String Formats . . . . . . . . . . . . . . . . . . . . . . . . . 36
Creating New Categorical and Ordinal Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Using Explicit Subscripts with Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Importing Data from Other Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Combining Two or More Stata Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Collapsing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Reshaping Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Using Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Creating Random Data and Random Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Writing Programs for Data Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

3 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Example Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Box Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Scatterplots and Overlays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Line Plots and Connected-Line Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Other Twoway Plot Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

v




Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

, vi Statistics with Stata


Bar Charts and Pie Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Symmetry and Quantile Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Adding Text to Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Graphing with Do-Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Retrieving and Combining Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Graph Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Creative Graphing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

4 Survey Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Example Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Declare Survey Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Design Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Poststratification Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Survey-Weighted Tables and Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Bar Charts for Multiple Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

5 Summary Statistics and Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Example Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Summary Statistics for Measurement Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Exploratory Data Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Normality Tests and Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Frequency Tables and Two-Way Cross-Tabulations . . . . . . . . . . . . . . . . . . . . . . 133
Multiple Tables and Multi-Way Cross-Tabulations . . . . . . . . . . . . . . . . . . . . . . . 136
Tables of Means, Medians and Other Summary Statistics . . . . . . . . . . . . . . . . . . 139
Using Frequency Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

6 ANOVA and Other Comparison Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Example Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
One-Sample Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Two-Sample Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
One-Way Analysis of Variance (ANOVA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Two- and N-Way Analysis of Variance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Factor Variables and Analysis of Covariance (ANCOVA) . . . . . . . . . . . . . . . . . 155
Predicted Values and Error-Bar Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

7 Linear Regression Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Example Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Simple Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Correlation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Multiple Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Hypothesis Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Dummy Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Interaction Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Robust Estimates of Variance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Predicted Values and Residuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Other Case Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Diagnosing Multicollinearity and Heteroskedasticity . . . . . . . . . . . . . . . . . . . . . . 202




Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

, Contents vii


Confidence Bands in Simple Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Diagnostic Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

8 Advanced Regression Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Example Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Lowess Smoothing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Robust Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Further rreg and qreg Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Nonlinear Regression — 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Nonlinear Regression — 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Box–Cox Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Multiple Imputation of Missing Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Structural Equation Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244

9 Logistic Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Example Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Space Shuttle Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Using Logistic Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Marginal or Conditional Effects Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Diagnostic Statistics and Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Logistic Regression with Ordered-Category y . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Multinomial Logistic Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Multiple Imputation of Missing Values — Logit Regression Example . . . . . . . . 278

10 Survival and Event-Count Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Example Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Survival-Time Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Count-Time Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Kaplan–Meier Survivor Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Cox Proportional Hazard Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Exponential and Weibull Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Poisson Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Generalized Linear Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

11 Principal Component, Factor and Cluster Analysis . . . . . . . . . . . . . . . . . 313
Example Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Principal Component Analysis and Principal Component Factoring . . . . . . . . . . 315
Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Factor Scores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Principal Factoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Maximum-Likelihood Factoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Cluster Analysis — 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Cluster Analysis — 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Using Factor Scores in Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Measurement and Structural Equation Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 344




Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

Written for

Course

Document information

Uploaded on
November 26, 2022
Number of pages
488
Written in
2013/2014
Type
OTHER
Person
Unknown

Subjects

$8.19
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
BESTLEC Notes
Follow You need to be logged in order to follow users or courses
Sold
443
Member since
3 year
Number of followers
33
Documents
773
Last sold
3 days ago
BESTLEC

Welcome to AllStudyGuides! The place to find the best study materials for various subjects. You can be assured that you will receive only the best which will help you to ace your exams. All the materials posted are A+ Graded. Please rate and write a review after using my materials. Your reviews will motivate me to add more materials. Note - Beware of other fake accounts that are stealing my documents. They copy/paste people's work and just throw documents together to make a quick sale! Be careful . My documents are 100% authentic and created by me! I only sell documents that I can speak for myself :). All are based on my experiences with Nursing school. **Feel free to message me with any questions, happy to help!** Please Note: I recently re-uploaded some docs due to some silly person reporting my TB study guides again. Enjoy! :)

Read more Read less
3.9

63 reviews

5
36
4
5
3
11
2
4
1
7

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions