Final Project 2

Published

November 6, 2025

Executive Summary

lalalalalalalalalalahouseslalalalalalapriceslalallalalala

# Data and parameters:
data <- c(305000, 280000, 265000, 315000, 290000, 275000, 325000, 300000, 285000, 310000, 282000, 270000, 330000, 295000, 290000, 320000, 288000, 280000, 308000, 281000, 267000, 312000, 292000, 278000, 322000, 303000, 287000, 311000)
x_bar <- mean(data)      # Sample mean
s <- sd(data)           # Sample standard deviation (s)
n <- length(data)       # Sample size
mu_0 <-300000             # Hypothesized population mean
alpha <-0.05         # Significance level

# Compute the t-statistic:
t <- (x_bar - mu_0) / (s / sqrt(n))

# Degrees of freedom:
df <- n - 1

# Two-tailed test:
p_two <- 2 * (1 - pt(abs(t), df = df))
critical_value_two_upper <- qt(1 - alpha/2, df = df)
critical_value_two_lower <- qt(alpha/2, df = df)

# Left-tailed test:
p_left <- pt(t, df = df)
critical_value_left <- qt(alpha, df = df)

# Right-tailed test:
p_right <- 1 - pt(t, df = df)
critical_value_right <- qt(1 - alpha, df = df)

# Compute Confidence Interval (Two-tailed):
CI_lower <- x_bar - critical_value_two_upper*(s/sqrt(n))
CI_upper <- x_bar + critical_value_two_upper*(s/sqrt(n))

# Output the t-statistic, degrees of freedom, p-values, and Confidence Interval:
t
[1] -1.380094
df
[1] 27
p_two
[1] 0.1788791
critical_value_two_lower
[1] -2.051831
critical_value_two_upper
[1] 2.051831
p_left
[1] 0.08943955
critical_value_left
[1] -1.703288
p_right
[1] 0.9105605
critical_value_right
[1] 1.703288
CI_lower
[1] 288099.2
CI_upper
[1] 302329.4
x_bar
[1] 295214.3
  1. There is not sufficient evidence that the mean sale price of the houses =$300,000. This implies that the sale price of the houses, on average, falls within the 95% confidence interval of $288099.20 to $302329.40 with a sample average price of $295,214.30.

2.