Welcome! Today, we're going to explore the stats package available in R, a powerful tool created for advanced statistical computations. One of the major advantages of using a tool like the stats package is its ability to handle complex problems that require multiple calculations — a key feature in areas such as engineering, data science, or any field that heavily relies on data analysis. In this lesson, you'll familiarize yourself with numerous features in the stats package, which will serve as additional tools in your data analytics toolbox.
In statistics, distribution functions play a vital role as they help us identify the probability of potential outcomes for a random event. For example, in a dice game, the distribution function can inform us about the chances of rolling a six. Because we need some data to explore the stats package, let's generate a meaningful data sample using the rnorm() function:
In this example, we generate a vector of 365 values, which are normally distributed with a mean of 30 and a standard deviation of 10.
The stats package in R offers numerous statistical functions. However, for skewness and kurtosis, we'll need to use the e1071 package. Skewness measures the asymmetry of a probability distribution around its mean, while kurtosis gauges how prone a distribution is to outliers. For example, these metrics could help us understand unusual variations in a city's annual temperature data.
Please take a look at the picture below. This graph showcases the asymmetry in statistical distributions. A negative skewness (blue curve) indicates that the left tail is longer or fatter than the right side, showing more lower-valued data. Conversely, a positive skewness (red curve) indicates a distribution where the right tail is longer or fatter, representing more higher-valued data. Skewness helps us identify the shape and direction of the spread in our data.


