empirical rule Base on your analysis in Q3 and Q4, would it be appropriate to use the empirical rule to find the probability of seeing a house that’s more expensive than half a million dollar home? Why? Why not?empirical rule Let’s just assume that home prices are normally distributed for the sake of exercise. What’s the probability of seeing a house that’s more expensive than half a million dollar home ($508,915 to be exact)?In this exercise, you will apply lessons you learned from Quiz3-a to a new data set, Sacramento. I recommend that you try it on your own before watching the video.
This data set is imported from the caret package. For more information about the data set, Google the caret package, find a link to its manual on CRAN, and scroll down on the manual to the page that explains Sacramento. Or click this link to download its manual.
# Load the package
library(tidyverse)
library(caret)
# Import data
data(Sacramento, package = "caret")
# Print the first 6 rows
head(Sacramento)
## city zip beds baths sqft type price latitude longitude
## 1 SACRAMENTO z95838 2 1 836 Residential 59222 38.63191 -121.4349
## 2 SACRAMENTO z95823 3 1 1167 Residential 68212 38.47890 -121.4310
## 3 SACRAMENTO z95815 2 1 796 Residential 68880 38.61830 -121.4438
## 4 SACRAMENTO z95815 2 1 852 Residential 69307 38.61684 -121.4391
## 5 SACRAMENTO z95824 2 1 797 Residential 81900 38.51947 -121.4358
## 6 SACRAMENTO z95841 3 1 1122 Condo 89921 38.66260 -121.3278
In order to answer this question, I would look to the data on the histogram at the 500,000 mark on the X axis and realized that there are less than 15 listings for $500,000, as opposed to the prices to the left which the maximum lies at the 250,000 mark at upwards of 100 listings.
ggplot(Sacramento, aes(x = price)) +
geom_histogram() +
labs(title = "Price of Houses",
x = "Price")
The data is not normally distributed. There is no “bell curve” and the data on the histogram is skewed to the right.
mean(Sacramento$price)
## [1] 246661.6
sd(Sacramento$price)
## [1] 131126.9
empirical rule Base on your analysis in Q3 and Q4, would it be appropriate to use the empirical rule to find the probability of seeing a house that’s more expensive than half a million dollar home? Why? Why not?Based on my analysis in Q3 and Q4, it would not be appropriate to find the probability of a house that is more expensive than a half a million dollars because the empirical rule only applies to data that is normally distributed.
empirical rule Let’s just assume that home prices are normally distributed for the sake of exercise. What’s the probability of seeing a house that’s more expensive than half a million dollar home ($508,915 to be exact)?The probability of seeing a house that is more than $508,915 is 2.5%.
The unit of standard deviation in Q5 is 2. The unit of variance is would be 4.
The risk that you are taking here is that the sample mean often does not reflect the population mean. When the means of population and the sample do not align, there is a large downward bias in the standard deviation and variance.
Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.