Getting confidence intervals

Using confidence intervals allows us to estimate the interval range of unknown parameters in the data. In this recipe, we will teach you methods that can help obtain confidence intervals in R.

Getting ready

Ensure that you installed R on your operating system.

How to do it…

Perform the following steps to obtain confidence intervals:

  1. Let's first generate a normal distribution using the rnorm function:
    >set.seed(123)
    >population<- rnorm(1000, mean = 10, sd = 3)
    >plot(dens, col="red", main="A density plot of normal distribution")
    
    How to do it…

    Figure 1: A density plot of normal distribution

  2. Next, we will sample 100 samples out of the population: ...

Get R for Data Science Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.