Write My Paper Button

WhatsApp Widget

1. 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()

Share this post on:

Assignment Task

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?

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, create a 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 your 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.

1. 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)

2. 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)

3. 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(??, ??, ??, ??, ??, ??)

4. 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, ?? == ??)$??)

“`

5. Are the clients’ complaints justified? Write a paragraph in which you weigh the evidence and argue a position.

 

Share this post on:

Affordable and Dependable Platform for Your Academic Assignments

X