R Statistics Cookbook

Book description

Solve real-world statistical problems using the most popular R packages and techniques

Key Features

  • Learn how to apply statistical methods to your everyday research with handy recipes
  • Foster your analytical skills and interpret research across industries and business verticals
  • Perform t-tests, chi-squared tests, and regression analysis using modern statistical techniques

Book Description

R is a popular programming language for developing statistical software. This book will be a useful guide to solving common and not-so-common challenges in statistics. With this book, you'll be equipped to confidently perform essential statistical procedures across your organization with the help of cutting-edge statistical tools.

You'll start by implementing data modeling, data analysis, and machine learning to solve real-world problems. You'll then understand how to work with nonparametric methods, mixed effects models, and hidden Markov models. This book contains recipes that will guide you in performing univariate and multivariate hypothesis tests, several regression techniques, and using robust techniques to minimize the impact of outliers in data.You'll also learn how to use the caret package for performing machine learning in R. Furthermore, this book will help you understand how to interpret charts and plots to get insights for better decision making.

By the end of this book, you will be able to apply your skills to statistical computations using R 3.5. You will also become well-versed with a wide array of statistical techniques in R that are extensively used in the data science industry.

What you will learn

  • Become well versed with recipes that will help you interpret plots with R
  • Formulate advanced statistical models in R to understand its concepts
  • Perform Bayesian regression to predict models and input missing data
  • Use time series analysis for modelling and forecasting temporal data
  • Implement a range of regression techniques for efficient data modelling
  • Get to grips with robust statistics and hidden Markov models
  • Explore ANOVA (Analysis of Variance) and perform hypothesis testing

Who this book is for

If you are a quantitative researcher, statistician, data analyst, or data scientist looking to tackle various challenges in statistics, this book is what you need! Proficiency in R programming and basic knowledge of linear algebra is necessary to follow along the recipes covered in this book.

Publisher resources

Download Example Code

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. R Statistics Cookbook
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Sections
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
    5. Get in touch
      1. Reviews
  6. Getting Started with R and Statistics
    1. Introduction
    2. Technical requirements
    3. Maximum likelihood estimation
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Calculating densities, quantiles, and CDFs
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    5. Creating barplots using ggplot
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Generating random numbers from multiple distributions
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    7. Complex data processing with dplyr
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. 3D visualization with the plot3d package
      1. Getting ready
      2. How to do it...
      3. How it works...
    9. Formatting tabular data with the formattable package
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    10. Simple random sampling
      1. Getting ready
      2. How to do it...
      3. How it works...
    11. Creating diagrams via the DiagrammeR package
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    12. C++ in R via the Rcpp package
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    13. Interactive plots with the ggplot GUI package
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    14. Animations with the gganimate package
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    15. Using R6 classes
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    16. Modeling sequences with the TraMineR package
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    17. Clustering sequences with the TraMineR package
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    18. Displaying geographical data with the leaflet package
      1. Getting ready
      2. How to do it...
      3. How it works...
  7. Univariate and Multivariate Tests for Equality of Means
    1. Introduction
    2. The univariate t-test
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    3. The Fisher-Behrens problem
      1. How to do it...
      2. How it works...
      3. There's more...
    4. Paired t-test
      1. How to do it...
      2. How it works...
      3. There's more...
    5. Calculating ANOVA sum of squares and F tests
      1. How to do it...
    6. Two-way ANOVA
      1. How to do it...
      2. How it works...
      3. There's more...
    7. Type I, Type II, and Type III sum of squares
      1. Type I
      2. Type II
      3. Type III
      4. Getting ready
      5. How to do it...
      6. How it works...
    8. Random effects
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    9. Repeated measures
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    10. Multivariate t-test
      1. Getting ready...
      2. How to do it...
      3. How it works...
      4. There's more...
    11. MANOVA
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
  8. Linear Regression
    1. Introduction
    2. Computing ordinary least squares estimates 
      1. How to do it...
      2. How it works...
    3. Reporting results with the sjPlot package 
      1. Getting ready 
      2. How to do it...
      3. How it works...
      4. There's more...
    4. Finding correlation between the features 
      1. Getting ready... 
      2. How to do it... 
    5. Testing hypothesis 
      1. Getting ready 
      2. How to do it... 
      3. How it works... 
    6. Testing homoscedasticity 
      1. Getting ready 
      2. How to do it... 
      3. How it works...
    7. Implementing sandwich estimators 
      1. Getting ready 
      2. How to do it... 
      3. How it works...
    8. Variable selection 
      1. Getting ready 
      2. How to do it... 
      3. How it works... 
    9. Ridge regression 
      1. Getting ready 
      2. How to do it... 
      3. How it works... 
    10. Working with LASSO 
      1. Getting ready 
      2. How to do it...
      3. How it works...
      4. There's more...
    11. Leverage, residuals, and influence 
      1. Getting ready 
      2. How to do it...
      3. How it works... 
  9. Bayesian Regression
    1. Introduction
    2. Getting the posterior density in STAN 
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Formulating a linear regression model
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    4. Assigning the priors
      1. Defining the support
      2. How to decide the parameters for a prior
      3. Getting ready
      4. How to do it...
      5. How it works...
    5. Doing MCMC the manual way
      1. Getting ready
      2. How to do it...
      3. How it works...
    6. Evaluating convergence with CODA
      1. One or multiple chains?
      2. Getting ready
      3. How to do it...
      4. How it works...
      5. There's more...
    7. Bayesian variable selection
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. Using a model for prediction
      1. Getting ready
      2. How to do it...
      3. How it works...
    9. GLMs in JAGS
      1. Getting ready
      2. How to do it...
      3. How it works...
  10. Nonparametric Methods
    1. Introduction
    2. The Mann-Whitney test
      1. How to do it...
      2. How it works...
      3. There's more...
    3. Estimating nonparametric ANOVA
      1. Getting ready
      2. How to do it...
      3. How it works...
    4. The Spearman's rank correlation test
      1. How to do it...
      2. How it works...
      3. There's more...
    5. LOESS regression
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    6. Finding the best transformations via the acepack package
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There is more...
    7. Nonparametric multivariate tests using the npmv package
      1. Getting ready
      2. How to do it...
      3. How it works...
    8. Semiparametric regression with the SemiPar package
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
  11. Robust Methods
    1. Introduction
    2. Robust linear regression
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Estimating robust covariance matrices
      1. Getting ready
      2. How to do it...
      3. How it works...
    4. Robust logistic regression
      1. Getting ready
      2. How to do it...
      3. How it works...
    5. Robust ANOVA using the robust package
      1. Getting ready
      2. How to do it...
      3. How it works...
    6. Robust principal components
      1. Getting ready
      2. How to do it...
      3. How it works...
    7. Robust Gaussian mixture models with the qclust package
      1. Getting ready
      2. How to do it...
      3. How it works...
    8. Robust clustering
      1. Getting ready
      2. How to do it...
      3. How it works...
  12. Time Series Analysis
    1. Introduction
    2. The general ARIMA model 
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Seasonality and SARIMAX models 
      1. Getting ready
      2. How to do it...
      3. There's more...
    4. Choosing the best model with the forecast package 
      1. Getting ready
      2. How to do it...  
      3. How it works... 
    5. Vector autoregressions (VARs)  
      1. Getting ready
      2. How to do it...  
      3. How it works... 
    6. Facebook's automatic Prophet forecasting  
      1. Getting ready
      2. How to do it...  
      3. How it works...
      4. There's more...
    7. Modeling count temporal data 
      1. Getting ready
      2. How to do it... 
      3. There's more...
    8. Imputing missing values in time series  
      1. Getting ready
      2. How to do it...
      3. How it works... 
      4. There's more... 
    9. Anomaly detection 
      1. Getting ready
      2. How to do it... 
      3. How it works... 
      4. There's more... 
    10. Spectral decomposition of time series 
      1. Getting ready
      2. How to do it... 
      3. How it works... 
  13. Mixed Effects Models
    1. Introduction
    2. The standard model and ANOVA 
      1. Getting ready
      2. How to do it...
      3. How it works... 
    3. Some useful plots for mixed effects models 
      1. Getting ready
      2. How to do it... 
      3. There's more... 
    4. Nonlinear mixed effects models 
      1. Getting ready
      2. How to do it... 
      3. How it works... 
      4. There's more... 
    5. Crossed and nested designs 
      1. Crossed design 
      2. Nested design 
      3. Getting ready 
      4. How to do it... 
      5. How it works.. 
    6. Robust mixed effects models with robustlmm 
      1. Getting ready
      2. How to do it... 
      3. How it works... 
    7. Choosing the best linear mixed model
      1. Getting ready 
      2. How to do it... 
      3. How it works... 
    8. Mixed generalized linear models 
      1. Getting ready
      2. How to do it... 
      3. How it works... 
      4. There's more...
  14. Predictive Models Using the Caret Package
    1. Introduction
    2. Data splitting and general model fitting
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Preprocessing
      1. Getting ready
      2. How to do it...
      3. How it works...
    4. Variable importance and feature selection
      1. Getting ready
      2. How to do it...
      3. How it works...
    5. Model tuning
      1. Getting ready
      2. How to do it...
      3. How it works...
    6. Classification in caret and ROC curves
      1. Getting ready
      2. How to do it...
      3. How it works...
    7. Gradient boosting and class imbalance
      1. Getting ready
      2. How to do it...
      3. How it works...
    8. Lasso, ridge, and elasticnet in caret
      1. Getting ready
      2. How to do it...
      3. How it works...
    9. Logic regression
      1. Getting ready
      2. How to do it...
      3. How it works...
  15. Bayesian Networks and Hidden Markov Models
    1. Introduction
    2. A discrete Bayesian network via bnlearn
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Conditional independence tests
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    4. Continuous and hybrid Bayesian networks via bnlearn
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    5. Interactive visualization of BNs with the bnviewer package
      1. Getting ready
      2. How to do it...
      3. How it works...
    6. An introductory hidden Markov model
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    7. Regime switching in financial data via HMM
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
  16. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: R Statistics Cookbook
  • Author(s): Francisco Juretig
  • Release date: March 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781789802566