Question
Valmax Realty Case Valmax Is one of the largest real estate companies in the Rocky Mountain region. John Porter is the manager of Valmax's Denver
Valmax Realty Case Valmax Is one of the largest real estate companies in the Rocky Mountain region. John Porter is the manager of Valmax's Denver office, which is one of the company's most profitable. Valmax has received complaints from clients (interested in buying a house) in Denver who believe that they were advised to accept selling prices for houses they purchased that were too high relative to the selling prices for houses brokered by other realtors. John Porter has decided to perform an analysis of recent real estate transactions in Denver in order to estimate whether these claims have substance. Let's analyze in a little more detail. The contention is that---on average---Valmax agents are advising buyers to offer too much, relative to the market, which makes the sales price closer to the asking price, on average, compared to other brokers, resulting in a relatively smaller difference between asking and selling price. Why would the buyer's agent advise a relative higher offer? Well, the 6% commission is usually split between the two agents. The financial motivation for the buyer's agent, therefore, is to outcompete other buyers by offering more and, in doing so, ensure not only the purchase (which is otherwise uncertain) but also a higher commission. John has collected the asking prices and selling prices for 79 homes sold in Denver in the last three months, and has divided the sales into the 35 sales brokered by Valmax agents and the other 44 sales that were brokered by other realtors. Note that in all of the transactions brokered by Valmax, it represented the buyer. Are the clients' complaints justified?
"House","Asking Price","Selling Price","broker"
"1","290000","275000","valmax"
"2","315000","314000","valmax"
"3","299000","310000","valmax"
"4","615000","610000","valmax"
"5","345000","345000","valmax"
"6","230000","221000","valmax"
"7","420000","418000","valmax"
"8","399000","382000","valmax"
"9","549000","555000","valmax"
"10","299000","292000","valmax"
"11","430000","431000","valmax"
"12","330000","303000","valmax"
"13","395000","381000","valmax"
"14","675000","661000","valmax"
"15","460000","443000","valmax"
"16","437000","449000","valmax"
"17","680000","668000","valmax"
"18","380000","385000","valmax"
"19","325000","310000","valmax"
"20","435000","435000","valmax"
"21","304000","300000","valmax"
"22","552000","560000","valmax"
"23","403000","389000","valmax"
"24","419000","425000","valmax"
"25","227000","217000","valmax"
"26","340000","342000","valmax"
"27","619000","615000","valmax"
"28","312000","308000","valmax"
"29","320000","319000","valmax"
"30","299000","270000","valmax"
"31","289000","280000","valmax"
"32","316000","319000","valmax"
"33","328000","320000","valmax"
"34","610000","615000","valmax"
"35","350000","353000","valmax"
"1","295000","280000","others"
"2","425000","411000","others"
"3","299000","285000","others"
"4","299000","299000","others"
"5","475000","471000","others"
"6","350000","348000","others"
"7","429000","418000","others"
"8","399000","401000","others"
"9","489000","476000","others"
"10","299000","270000","others"
"11","539000","531000","others"
"12","225000","214000","others"
"13","749000","735000","others"
"14","689000","664000","others"
"15","469000","476000","others"
"16","299000","270000","others"
"17","539000","531000","others"
"18","199000","205000","others"
"19","349000","335000","others"
"20","689000","687000","others"
"21","485000","479000","others"
"22","299000","285000","others"
"23","305000","275000","others"
"24","479000","469000","others"
"25","699000","677000","others"
"26","339000","325000","others"
"27","195000","209000","others"
"28","539000","535000","others"
"29","279000","268000","others"
"30","459000","469000","others"
"31","679000","659000","others"
"32","729000","725000","others"
"33","215000","214000","others"
"34","539000","525000","others"
"35","289000","270000","others"
"36","479000","469000","others"
"37","389000","390000","others"
"38","419000","410000","others"
"39","339000","339000","others"
"40","469000","462000","others"
"41","299000","280000","others"
"42","289000","280000","others"
"43","419000","403000","others"
"44","289000","275000","others"
---
title: " "
author: " "
date: " "
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
```
Note:
- Change the information in the yaml header above:title, author, date.
- Make sure output is html_document.
- Once you are finished coding, run each chunk individually to make sure there are no errors. (If necessary fix your code.) Once your code is error-free, click "knit" on the menu above. Your document should compile to HTML, provided that you have output set to "html_document."
- In the code chunk above ("setup") echo is set to TRUE. This means that the code in your chunks will be displayed, along with the results, in your compiled document.
- Please delete these and other directions before compiling and submitting your assignment.
## Load data
The dataset for this case is valmax.csv. It is a pain to work with column names like these. I would recommend changing the column titles to snake case using the `clean_names()` function in the janitor package. Additionally, what is the difference variable by subtracting the selling price from the asking price.
```{r}
# Load data
library(janitor)
# Download
v <- read_csv("valmax.csv") %>%
clean_names()
# Inspect data
head(v)
glimpse(v)
```
## Goal
As indicated in the case description, your goal is to figure out whether the data supports the claim that VALMAX clients have been buying homes for too much, compared to the clients of other brokers.
In most cases the selling price is below the asking price. If VALMAX clients advised to pay more to buy a house, then there is also likely to be a smaller difference between asking and selling, compared to other brokers. So, here is another way to put the question posed in the case description:is the *difference* between asking and selling (asking minus selling) lower for VALMAX than for the other brokers?
```{r}
v <- v %>% mutate(difference = asking_price-selling_price)
```
## Questions
Lightly comment code and use pipes for readability.
Make sure to use set.seed(123) before running any random process to ensure that your results are reproducible.
Comment briefly on each of the questions, as directed.Only the the final question requires a lengthier response.
### Q1
Plot the density function and a histogram of the difference between asking vs selling price by broker. Does there appear to be a difference?
```{r}
ggplot(v, aes(x=selling_price, col = broker))+
geom_density()
ggplot(v, aes(x= asking_price))+
geom_histogram()+
facet_wrap(~ broker)
```
### Q2
Calculate and interpret 95% CIs for mean difference by broker.
```{r}
v %>%
group_by(broker) %>%
summarize(n = n(),
mean_asking = mean(asking_price),
mean_selling = mean(selling_price),
mean_difference = mean(selling_price - asking_price),
sd = sd(selling_price - asking_price),
SE = sd/sqrt(n),
Tcr= qt(0.975,n-1),
lower = mean_difference - Tcr * SE,
upper = mean_difference + Tcr * SE)
```
### Q3
Compute a t-statistic for mean difference by broker.
```{r}
tstat <- function(mean1, mean2, n1, n2, var1, var2){
(mean1-mean2)/sqrt(var1/n1 + var2/n2)
}
tstat(??, ??, ??, ??, ??, ??)
```
### Q4
What is the p-value associated with the t-statistic you have computed? Use a 2-tailed test by doubling the p-value obtained with the `pt()` function. (Use the built in t.test function to check your work. Your results should be very close.)
```{r}
pt(??, df = ??) * 2
t.test(filter(v, ?? == ??)$??,
filter(v, ?? == ??)$??)
```
### Q5
Are the clients' complaints justified? paragraph in which you weigh the evidence and argue a position.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started