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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.