mydata <- read.table("./Apartment.csv",
header=TRUE,
sep=";",
dec=",")
head(mydata)
## ID Price
## 1 1 3144
## 2 2 3512
## 3 3 3555
## 4 4 3322
## 5 5 2980
## 6 6 3732
Description:
mean(mydata$Price)
## [1] 3109.677
sd(mydata$Price)
## [1] 476.681
library(ggplot2)
ggplot(NULL, aes(c(-4, 4))) +
geom_line(stat = "function", fun = dt, args = list (df = 30)) +
ylab("Density") +
xlab("Sample estimates") +
labs(title="Distribution of sample estimates")
qt(p = 0.025, df = 30, lower.tail = FALSE)
## [1] 2.042272
qt(p = 0.025, df = 30, lower.tail = TRUE)
## [1] -2.042272
t.test(mydata$Price,
mu = 2770,
alternative = "two.sided")
##
## One Sample t-test
##
## data: mydata$Price
## t = 3.9675, df = 30, p-value = 0.0004175
## alternative hypothesis: true mean is not equal to 2770
## 95 percent confidence interval:
## 2934.829 3284.525
## sample estimates:
## mean of x
## 3109.677
Based on the sample data we reject the H0 at p < 0.001. we find that the average price increased.
Cohen’d statistics
#install.packages("effectsize")
library(effectsize)
effectsize::cohens_d(mydata$Price, mu=2770)
## Cohen's d | 95% CI
## ------------------------
## 0.71 | [0.31, 1.10]
##
## - Deviation from a difference of 2770.
effectsize::interpret_cohens_d(0.71, rules = "sawilowsky2009")
## [1] "medium"
## (Rules: sawilowsky2009)