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,...