Skip to content
1 hidden cell
Introduction to Statistics in R
Introduction to Statistics in R
Run the hidden code cell below to import the data used in this course.
1 hidden cell
Take Notes
Add notes about the concepts you've learned and code cells with code you want to keep.
Add your notes here
# Descriptive statistics and inferential statistics
#Desctiptive- describe and summarize the data
#inferential statistics- make inferences about a larger population from a smaller population
# Measures of center
mean()
median()
mode()
#here is code to filter the mammal dataset to insectivores and find mean and median sleep time
msleep %>%
filter(vore=="insecti") %>%
summarize(mean_sleep = mean(sleep_total),
median_sleep = median(sleep_total))
# if we throw an extreme value in the data, the mean will change more than the median because the mean is more sensitive to extereme values than the median
# for symetrical data, the mean is a good measure of center because there are similar distributions on either side
# if the data is skewed left or right then the median is better to use
#skew describes where the tail of the data is. if the tail trails off to the right, the data is right skewed. If the tail goes to the left, the data is left skewed. Right and left skew are also called positive and negative skew respectively
# what is important to know is that the mean is pulled in the direction of the skew