Book Image

R Data Science Essentials

Book Image

R Data Science Essentials

Overview of this book

With organizations increasingly embedding data science across their enterprise and with management becoming more data-driven it is an urgent requirement for analysts and managers to understand the key concept of data science. The data science concepts discussed in this book will help you make key decisions and solve the complex problems you will inevitably face in this new world. R Data Science Essentials will introduce you to various important concepts in the field of data science using R. We start by reading data from multiple sources, then move on to processing the data, extracting hidden patterns, building predictive and forecasting models, building a recommendation engine, and communicating to the user through stunning visualizations and dashboards. By the end of this book, you will have an understanding of some very important techniques in data science, be able to implement them using R, understand and interpret the outcomes, and know how they helps businesses make a decision.
Table of Contents (15 chapters)
R Data Science Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Inferential statistics


We have seen a sufficient number of descriptive statistics techniques. Now, let's check some of the inferential statistics techniques. Inferential statistics is used to infer properties about the dataset.

First, let's start with the simple mean and check what should be the range if the mean has to fall under the confidence interval of 95%. In order to get the confidence interval for the mean, we need to load the lsr package; if the package is not already installed, you need to install it using the install.packages function and then the ciMean function to get the desired result:

library(lsr)
ciMean(tdata$Fare)

The following is the output of the preceding command:

The ciMean function gives us an overall view on the confidence interval of the Fare variable. However, to see how different it is between male and female, we can use the aggregate function:

aggregate( tdata$Fare ~ tdata$Sex, tdata, ciMean )

The output of the preceding is as follows:

From the preceding output,...