Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Mastering Scientific Computing with R
Mastering Scientific Computing with R

Mastering Scientific Computing with R: Employ professional quantitative methods to answer scientific questions with a powerful open source data analysis environment

eBook
$22.99 $32.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Mastering Scientific Computing with R

Chapter 2. Statistical Methods with R

This chapter will present an overview of how to summarize your data and get useful statistical information for downstream analysis. We will also show you how to plot and get statistical information from probability distributions and how to test the fit of your sample distribution to well-defined probability distributions. We will also go over some of the functions used to perform hypothesis testing including the Student's t-test, Wilcoxon rank-sum test, z-test, chi-squared test, Fisher's exact test, and F-test.

Before we begin, we will load the gene expression profiling data from the E-GEOD-19577 study entitled "MLL partner genes confer distinct biological and clinical signatures of pediatric AML, an AIEOP study" from the ArrayExpress website to use as a sample dataset for some of our examples. For simplicity, we will not go into the details of how the data was generated, except to mention that the study evaluates the expression...

Descriptive statistics

A useful tool to evaluate your data before you begin your analysis is the summary() function, which provides a summary of the non-parametric descriptors of a sample, as follows:

> summary(probeA)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  4.211   4.645   4.774   4.774   4.892   5.231

You can also get a summary for each column of the matrix using the summary() function, as follows:

> summary(MLLpartner.mx) #output truncated
   GSM487973        GSM487972        GSM487971     
 Min.   : 2.112   Min.   : 1.805   Min.   : 1.994  
 1st Qu.: 3.412   1st Qu.: 3.410   1st Qu.: 3.411  
 Median : 4.736   Median : 4.745   Median : 4.731  
 Mean   : 5.342   Mean   : 5.346   Mean   : 5.355  
 3rd Qu.: 6.870   3rd Qu.: 6.851   3rd Qu.: 6.933  
 Max.   :14.449   Max.   :14.453   Max.   :14.406  

We can also get this information by calling the individual functions used to determine these parameters, namely the mean, median, min, max, and quantile functions, as follows:

&gt...

Probability distributions

R makes it very easy to plot and get statistical information on many probability distributions. For those who are not familiar with probability distributions, they are defined as a table or an equation that links each outcome of a statistical experiment with its probability of occurrence. A summary of many common probability distributions available in R is available in the following table:

Probability distribution

R name

Beta

beta

Binomial

binom

Cauchy

cauchy

Chi square

chisq

Exponential

exp

F

f

Gamma

gamma

Geometric

geom

Hypergeometric

hyper

Logistic

logis

Lognormal

lnorm

Negative Binomial

nbinom

Normal

norm

Poisson

pois

Student t

t

Uniform

unif

Tukey

tukey

Weibull

weib

Wilcoxon

wilcox

You can also get this summary in R by entering help("distributions"). For additional probability distributions, and the packages needed to load them, you can consult the CRAN distributions page at http://cran.r-project.org/web/views...

Fitting distributions

Now that we have seen how to plot and gain statistical information from probability distributions, we will show you how to use R to fit your data to theoretical distributions. There are several methods you can use to test whether your sample distribution fits a theoretical distribution. For example, you may want to see if your sample distribution fits a normal distribution using a Quantile-Quantile plot (Q-Q plot). In R, you can use the qqnorm() function to create a Q-Q plot to evaluate the data. R also has a more generic version of this function called qqplot() to create Q-Q plots for any theoretical distribution. To illustrate the use of these functions, let's create a Q-Q plot to test whether the gene expression values of probeA follow a normal or gamma distribution.

First, let's set the plot settings to display two figures in the same layout:

> par(mfrow=c(1,2))

Use qqnorm() to fit the data to a normal distribution:

qqnorm(probeA)

Add the theoretical line...

Hypothesis testing

Often when we analyze data, we would like to know whether the mean of our sample distribution is different from some theoretical value or expected average. Suppose we measured the height of 12 females and wanted to know if the average we calculated from our sample population is significantly different from the theoretical average height of females, which is 171 cm. A simple test we could perform to test this hypothesis would be the Wilcoxon signed-rank test. To do this in R, we will use the wilcox.test() function with the mu argument set to 171:

> female.heights <- c(117, 162, 143, 120, 183, 175, 147, 145, 165, 167, 179, 116)
> mean(females.heights)
[1] 151.5833
> wilcox.test(female.heights, mu=171)
Wilcoxon signed rank test with continuity correction
data:  female.heights
V = 11.5, p-value = 0.0341
alternative hypothesis: true location is not equal to 171
Warning message:
In wilcox.test.default(female.heights, mu = 171) :
  cannot compute exact p-value with...

Summary

In this chapter, we saw how to obtain useful statistical information from sample populations and probability distributions. You should now be able to summarize your data and obtain useful statistical information such as the mean, median, variance, and so on. You should also be able to plot and obtain useful statistics from theoretical probability distributions, fit your sample data to theoretical probability distributions, perform hypothesis testing using parametric and non-parametric statistical tests, and plot and test whether time series data is stationary using statistical tests.

Now that you have a foundation of how to apply statistical methods to your sample datasets, we will be moving on to linear models in the next chapter, where you will find out how to study the relationship between variables.

Left arrow icon Right arrow icon

Description

If you want to learn how to quantitatively answer scientific questions for practical purposes using the powerful R language and the open source R tool ecosystem, this book is ideal for you. It is ideally suited for scientists who understand scientific concepts, know a little R, and want to be able to start applying R to be able to answer empirical scientific questions. Some R exposure is helpful, but not compulsory.

Who is this book for?

If you want to learn how to quantitatively answer scientific questions for practical purposes using the powerful R language and the open source R tool ecosystem, this book is ideal for you. It is ideally suited for scientists who understand scientific concepts, know a little R, and want to be able to start applying R to be able to answer empirical scientific questions. Some R exposure is helpful, but not compulsory.

What you will learn

  • Master data management in R
  • Perform hypothesis tests using both parametric and nonparametric methods
  • Understand how to perform statistical modeling using linear methods
  • Model nonlinear relationships in data with kernel density methods
  • Use matrix operations to improve coding productivity
  • Utilize the observed data to model unobserved variables
  • Deal with missing data using multiple imputations
  • Simplify highdimensional data using principal components, singular value decomposition, and factor analysis

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 31, 2015
Length: 432 pages
Edition : 1st
Language : English
ISBN-13 : 9781783555260
Category :
Languages :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 31, 2015
Length: 432 pages
Edition : 1st
Language : English
ISBN-13 : 9781783555260
Category :
Languages :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 164.97
Mastering Scientific Computing with R
$54.99
R for Data Science
$54.99
Mastering Predictive Analytics with R
$54.99
Total $ 164.97 Stars icon
Banner background image

Table of Contents

11 Chapters
1. Programming with R Chevron down icon Chevron up icon
2. Statistical Methods with R Chevron down icon Chevron up icon
3. Linear Models Chevron down icon Chevron up icon
4. Nonlinear Methods Chevron down icon Chevron up icon
5. Linear Algebra Chevron down icon Chevron up icon
6. Principal Component Analysis and the Common Factor Model Chevron down icon Chevron up icon
7. Structural Equation Modeling and Confirmatory Factor Analysis Chevron down icon Chevron up icon
8. Simulations Chevron down icon Chevron up icon
9. Optimization Chevron down icon Chevron up icon
10. Advanced Data Management Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.6
(7 Ratings)
5 star 14.3%
4 star 42.9%
3 star 28.6%
2 star 14.3%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Arnold Salvacion Mar 01, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
High recommended!My review of the book can be found in http://r-nold.blogspot.com/2015/03/book-review-mastering-scientific.html
Amazon Verified review Amazon
Visier68 Feb 28, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
“Mastering Scientific Computing with R” is a comprehensive book that combines an entry-level approach to data analysis with content targeted to experienced users, who are aiming to streamline their workflow.The author starts with an overview of R, explaining data types and other fundamental concepts, which should be sufficient for novice readers to understand how R differs in its coding style from traditional programming languages. On the other hand, the book is intentionally not written as a cookbook for data analysis. Hence, readers will benefit from previous experience with tools like RStudio and IPython, supporting experiments with functions and code snippets from the book for interactive learning.The first part is covering basic stuff like distributions, hypothesis testing, linear plus nonlinear models and PCA. For advanced users, things get more interesting with Structural Equation Modeling (SEM) in chapter 7, where the author provides a brief but good illustration of practical applications with OpenMx. The book includes a well-written chapter on simulation, explaining the powerful features of Monte Carlo method. It is followed by a chapter on optimization, which is equally useful in solving analytical problems.A strength of this book is that it provides in-depth information regarding some more advanced analytical procedures without being limited to specific domains like bioinformatics or econometrics, making it a recommended addition to the analyst’s bookshelf.What I am missing is a part covering practical deployment of the methodology described, especially in terms of reproducible research and scientific publishing. Reproducibility is essential, and R excels here by encouraging users to focus on scripting and automation rather than point-and-click. This is mentioned several times, but deserves more attention given its importance in science.Tools like Markdown and Pandoc support the creation of fully dynamic documents with minimal effort, which has vastly improved streamlining of workflows in scientific publishing. It would be useful to include some examples and references to further reading.While “Mastering Scientific Computing with R” is quite readable for novice users, I would recommend the book to people who are already familiar with basic tools and building blocks of data analysis, aiming to improve their knowledge about algorithms and standard procedures that typically make up a scientific workflow. But the book is also useful for non-scientific applications and the information provided may be easily transferred for exploitation in any specific domain.
Amazon Verified review Amazon
Kongi Feb 27, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The book is helpful to people who are just learning how to use R for modelling and simulation. It could be considered as an introduction to Scientific Computing using R not Mastering. I recommend topics such as high performance, parallel computation to be added in further editions of the book.Still glad i bought the book because i picked few points from it.
Amazon Verified review Amazon
TCM Feb 28, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The “mastering series” provides advanced tutorials and this was exactly what I was looking for. This book goes beyond most other books on R and gives insights into topics such as generalized linear models (GLM), principal component analysis (PCA) and Monte Carlo simulations. The introduction of this book is too advanced for R beginners but provides a good repetition of R’s capabilities and strength. For the rest of this book the reader needs a good grasp of R, statistics and mathematics. As such it distinguishes itself from most other book on R I have seen so far and meets my level of expectation. In any case, this book cannot be recommended as an entry level introduction neither to R nor statistics but is very useful for scientist interested in exploring possibilities for sound data analysis.
Amazon Verified review Amazon
Al Feb 18, 2015
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
This book looks more like an overview of a variety of topics than a Mastering book. I wouldn't recommeded for an in depth coverage of the topics it exposes. Although it could be used as a quick guide to implement a variety of scientific methods in R. I purchase it as part of Packt Publishing $5 Christmas bonanza. For that price, you can't go wrong.One thing missing that I would've liked to see covered is reproducible research. I would think any new scientific programming book in R will cover this topic or at least gives examples of reproducible research.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.