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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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

Shipping Address

Billing Address

Shipping Methods
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
Estimated delivery fee Deliver to Malaysia

Standard delivery 10 - 13 business days

$8.95

Premium delivery 5 - 8 business days

$45.95
(Includes tracking information)

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 : 9781783555253
Category :
Languages :
Concepts :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Malaysia

Standard delivery 10 - 13 business days

$8.95

Premium delivery 5 - 8 business days

$45.95
(Includes tracking information)

Product Details

Publication date : Jan 31, 2015
Length: 432 pages
Edition : 1st
Language : English
ISBN-13 : 9781783555253
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

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela