R for Stata Users

Stata is the most flexible and extensible data analysis package available from a commercial vendor. R is a similarly flexible free and open source package for data analysis, with over 3,000 add-on packages available. This book shows you how to extend the

  • PDF / 6,533,669 Bytes
  • 549 Pages / 510.04 x 773.353 pts Page_size
  • 83 Downloads / 176 Views

DOWNLOAD

REPORT


Robert A.Muenchen·Joseph M.Hilbe

R for Stata Users 13

Statistics and Computing Series Editors J. Chambers D. Hand W. Härdle

For other titles published in this series, go to http://www.springer.com/series/3022

Robert A. Muenchen · Joseph M. Hilbe

R for Stata Users

123

Robert A. Muenchen University of Tennessee Office of Information Technology Statistical Consulting Center 916 Volunteer Blvd. Knoxville TN 37996-0520 Stokeley Management Center USA [email protected]

Joseph M. Hilbe 7242 W. Heritage Way Florence Arizona 85132 USA [email protected]

ISBN 978-1-4419-1317-3 e-ISBN 978-1-4419-1318-0 DOI 10.1007/978-1-4419-1318-0 Springer New York Dordrecht Heidelberg London Library of Congress Control Number: 2010921041 c Springer Science+Business Media, LLC 2010  All rights reserved. This work may not be translated or copied in whole or in part without the written permission of the publisher (Springer Science+Business Media, LLC, 233 Spring Street, New York, NY 10013, USA), except for brief excerpts in connection with reviews or scholarly analysis. Use in connection with any form of information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed is forbidden. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. Printed on acid-free paper Springer is part of Springer Science+Business Media (www.springer.com)

Preface

While R and Stata have many features in common, their languages are quite different. Our goal in writing this book is to help you translate what you know about Stata into a working knowledge of R as quickly and easily as possible. We point out how they differ using terminology with which you are familiar and we include many Stata terms in the table of contents and index. You can find any R function by looking up its counterpart in Stata and vice versa. We provide many example programs done in R and Stata so that you can see how they compare topic by topic. When finished, you should be able to use R to: • • • •

Read data from various types of text files and Stata data sets. Manage your data through transformations, recodes, and combining data sets from both the add-cases and add-variables approaches and restructuring data from wide to long formats and vice versa. Create publication quality graphs including bar, histogram, pie, line, scatter, regression, box, error bar, and interaction plots. Perform the basic types of analyses to measure strength of association and group differences and be able to know where to turn to cover much more complex methods.

Who This Book Is For This book is, of course, for people who already know Stata. It may also be useful to R users wishing to learn Stata. However, we explain none of the Stata programs, only the R ones and how the packages differ, so it is not ideal for that purpose. This book is based on R