A First Course in Statistical Programming with R

Paperback (Print)
Buy New
Buy New from BN.com
Buy Used
Buy Used from BN.com
(Save 34%)
Item is in good condition but packaging may have signs of shelf wear/aging or torn packaging.
Condition: Used – Good details
Used and New from Other Sellers
Used and New from Other Sellers
from $27.50
Usually ships in 1-2 business days
(Save 49%)
Other sellers (Paperback)
  • All (15) from $27.50   
  • New (12) from $35.66   
  • Used (3) from $27.50   


This is the only introduction you'll need to start programming in R, the open-source language that is free to download and lets you adapt the source code for your own requirements. Co-written by one of the R Core Development Team, and by an established R author, this book comes with real R code that complies with the standards of the language: Self-contained first course in statistical computing, Accessible to any student familiar with university-level calculus, The basics of R syntax and statistical graphics are explained, and elementary programming is discussed, Programming applications in simulation and optimization as well as numerical linear algebra are introduced, Many worked examples with notes on "understanding the code", All examples are drawn from statistical applications, End-of-chapter review questions plus over 150 exercises; data sets and solutions all available on web.
Read More Show Less

Editorial Reviews

From the Publisher
"While it is rare to see in a book, denseness does not have to be difficult and this book is an example of that. The authors are terse and effective as they clearly demonstrate how to use the R package. If you lack the budget for the purchase of a commercial computational mathematics package, then R with this textbook provides a very low cost alternative for many classes."
Charles Ashbacher, Journal of Recreational Mathematics

" a useful introductory text..."
Andrew Schaffner, The American Statistician

"As an R novice, I appreciated the explanations. Several times, I reacted with 'Oh, that's how it is supposed to be done.' ... I like this book and I learned a lot. I am convinced that most readers (including regular R users and mature statisticians) will learn something useful from this book. Again, it is not a book for learning statistical data analysis in R, but it is the right book for a statistician to learn the structure of R, and it is a good book to study before (or after) learning data analysis. I highly recommend this book."
Myron Hlynka, Technometrics

Read More Show Less

Product Details

  • ISBN-13: 9780521694247
  • Publisher: Cambridge University Press
  • Publication date: 10/31/2007
  • Edition description: New Edition
  • Pages: 174
  • Sales rank: 1,527,758
  • Product dimensions: 7.44 (w) x 9.69 (h) x 0.39 (d)

Meet the Author

W. John Braun is an Associate Professor in the Department of Statistical and Actuarial Sciences at the University of Western Ontario. He is also a co-author, with John Maindonald, of Data Analysis and Graphics Using R, 2nd edition (Cambridge University Press, 2007).

Duncan J. Murdoch is an Associate Professor in the Department of Statistical and Actuarial Sciences at the University of Western Ontario. He is a member of the R Development Core Team and was columnist and column editor of the statistical computing column of Chance 1999-2000.

Read More Show Less

Table of Contents

Preface     ix
Getting started     1
What is statistical programming?     1
Outline of the book     2
The R package     3
Why use a command line?     3
Font conventions     4
Installation of R     4
Introduction to the R language     5
Starting and quitting R     5
Recording your work     6
Basic features of R     7
Calculating with R     7
Named storage     7
Functions     9
Exact or approximate?     9
R is case-sensitive     12
Listing the objects in the workspace     12
Vectors     12
Extracting elements from vectors     13
Vector arithmetic     14
Simple patterned vectors     15
Missing values and other special values     16
Character vectors     16
Factors     17
More on extracting elements from vectors     18
Matrices and arrays     18
Data frames     19
Dates and times     21
Built-in functions and online help     21
Built-in examples     22
Finding help when you don't know the function name     23
Built-in graphics functions     23
Additional elementary built-in functions     25
Logical vectors and relational operators     26
Boolean algebra     26
Logical operations in R     27
Relational operators     28
Data input and output     29
Changing directories     29
dump () and source ()     29
Redirecting R output     30
Saving and retrieving image files     31
Data frames and the read.table function     31
Lists     31
Chapter exercises     32
Programming statistical graphics     33
High-level plots     33
Bar charts and dot charts     34
Pie charts     35
Histograms     35
Box plots     36
Scatterplots     38
QQ plots     39
Choosing a high-level graphic     41
Low-level graphics functions     42
The plotting region and margins     42
Adding to plots     43
Setting graphical parameters     45
Chapter exercises      46
Programming with R     47
Flow control     47
The for () loop     47
The if () statement     50
The while () loop     54
Newton's method for root finding     55
The repeat loop, and the break and next statements     57
Managing complexity through functions     59
What are functions?     59
Scope of variables     62
Miscellaneous programming tips     63
Using fix ()     63
Documentation using #     64
Some general programming guidelines     65
Top-down design     67
Debugging and maintenance     72
Recognizing that a bug exists     72
Make the bug reproducible     73
Identify the cause of the bug     73
Fixing errors and testing     75
Look for similar errors elsewhere     75
The browser () and debug () functions     75
Efficient programming     77
Learn your tools     77
Use efficient algorithms     78
Measure the time your program takes     79
Be willing to use different tools     80
Optimize with care     80
Chapter exercises     80
Simulation     82
Monte Carlo simulation     82
Generation of pseudorandom numbers     83
Simulation of other random variables     88
Bernoulli random variables     88
Binomial random variables     89
Poisson random variables     93
Exponential random numbers     97
Normal random variables     99
Monte Carlo integration     101
Advanced simulation methods     104
Rejection sampling     104
Importance sampling     107
Chapter exercises     109
Computational linear algebra     112
Vectors and matrices in R     113
Constructing matrix objects     113
Accessing matrix elements; row and column names     115
Matrix properties     117
Triangular matrices     118
Matrix arithmetic     118
Matrix multiplication and inversion     119
Matrix inversion     120
The LU decomposition     121
Matrix inversion in R     122
Solving linear systems     123
Eigenvalues and eigenvectors     124
Advanced topics      125
The singular value decomposition of a matrix     125
The Choleski decomposition of a positive definite matrix     126
The QR decomposition of a matrix     127
The condition number of a matrix     128
Outer products     129
Kronecker products     129
apply ()     129
Chapter exercises     130
Numerical optimization     132
The golden section search method     132
Newton-Raphson     135
The Nelder-Mead simplex method     138
Built-in functions     142
Linear programming     142
Solving linear programming problems in R     145
Maximization and other kinds of constraints     145
Special situations     146
Unrestricted variables     149
Integer programming     150
Alternatives to lp ()     151
Quadratic programming     151
Chapter exercises     157
Review of random variables and distributions     158
Index     161
Read More Show Less

Customer Reviews

Average Rating 3.5
( 5 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 5 Customer Reviews
  • Posted May 25, 2012

    Its okay

    I thought It was well written for a beginner. I don't think that it had enough cool statistical stuff you can do in R though. I would have liked to see a beginners book about the "statistical" stuff you can accomplish using R.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted July 16, 2009

    No text was provided for this review.

  • Anonymous

    Posted June 8, 2009

    No text was provided for this review.

  • Anonymous

    Posted November 7, 2009

    No text was provided for this review.

  • Anonymous

    Posted June 23, 2010

    No text was provided for this review.

Sort by: Showing all of 5 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)