A First Course in Statistical Programming with R
This new, color edition of Braun and Murdochs bestselling textbookintegrates use of the RStudio platform and adds discussion ofnewer graphics systems, extensive exploration of Markov chainMonte Carlo, expert advice on common error messages, motivatingapplications of matrix decompositions, and numerous new examplesand exercises.
This is the only introduction youll need to start programming in R,the computing standard for analyzing data. Co-written by an R CoreTeam member and an established R author, this book comes withreal R code that complies with the standards of the language. Unlikeother introductory books on the R system, this book emphasizesprogramming, including the principles that apply to most computinglanguages, and techniques used to develop more complex projects.Solutions, datasets, and any errata are available from the bookswebsite. The many examples, all from real applications, make itparticularly useful for anyone working in practical data analysis.
W. John Braun is Deputy Director of the Canadian StatisticalSciences Institute. He is also Professor and Head of the Departmentsof Computer Science, Physics, Mathematics and Statistics at theUniversity of British Columbia Okanagan. His research interestsare in the modeling of environmental phenomena, such as wildfire,as well as statistical education, particularly as it relates to the Rprogramming language.
Duncan J. Murdoch is a member of the R Core Team of developers,and is co-president of the R Foundation. He is one of the developersof the rgl package for 3D visualization in R, and has also developednumerous other R packages. He is also a professor in the Departmentof Statistical and Actuarial Sciences at the University of WesternOntario.
AFirstCourseinStatisticalProgrammingwithR
Second Edition
W. John Braun and Duncan J. Murdoch
32AvenueoftheAmericas,NewYorkNY10013
CambridgeUniversityPressispartoftheUniversityofCambridge.
ItfurtherstheUniversitysmissionbydisseminatingknowledgeinthepursuitofeducation,learning,andresearchatthehighestinternationallevelsofexcellence.
www.cambridge.org
Informationonthistitle:www.cambridge.org/9781107576469
W.JohnBraunandDuncanJ.Murdoch2007,2016
Thispublicationisincopyright.Subjecttostatutoryexceptionandtotheprovisionsofrelevantcollectivelicensingagreements,noreproductionofanypartmaytakeplacewithoutthewrittenpermissionofCambridgeUniversityPress.
Firstpublished2007
Secondedition2016
PrintedintheUnitedStatesofAmericabySheridanBooks,Inc.
AcataloguerecordforthispublicationisavailablefromtheBritishLibrary.
ISBN978-1-107-57646-9Hardback
Additionalresourcesforthispublicationatwww.cambridge.org/9781107576469.
CambridgeUniversityPresshasnoresponsibilityforthepersistenceoraccuracyofURLsforexternalorthird-partyInternetWebsitesreferredtointhispublicationanddoesnotguaranteethatanycontentonsuchWebsitesis,orwillremain,accurateorappropriate.
A lot of things have happened in the R community since we wrote thefirst edition of this text. Millions of new users have started to use R,and it is now the premier platform for data analytics. (In fact,the term data analytics hardly existed when we wrote the firstedition.)
RStudio, a cross-platform integrated development environment for R,has had a large influence on the increase in popularity. In this edition werecommend RStudio as the platform for most new users, and haveintegrated simple RStudio instructions into the text. In fact, wehave used RStudio and the knitr package in putting together themanuscript.
We have also added numerous examples and exercises, and cleanedup existing ones when they were unclear. Chapter (Computationallinear algebra), some applications have been added to give studentsa better idea of why some of the matrix decompositions are soimportant.
Once again we have a lot of people to thank. Many students haveused the first edition, and we are grateful for their comments andcriticisms. Some anonymous reviewers also provided some helpfulsuggestions and pointers so that we could make improvements to thetext. We hope our readers find this new edition as interesting andeducational as we think it is.