Section #:01

Students must abide by UVic academic regulations and observe standards of scholarly integrity (i.e. no plagiarism or cheating). Therefore, this assignment must be taken individually and not with a friend, classmate, or group. You are also prohibited from sharing any information about the assignment with others. I affirm that I will not give or receive any aid on this assignment and that all work will be my own. name here

When externalities are present but government intervention is not, competitive markets typically fail to maximize social welfare. This is true even though production is efficient (good produced by lowest cost producers) and the goods end up in the hands of the consumers willing and able to make the largest sacrifice to attain. The problem is that the wrong quantity of the good is produced: Efficiency also requires that the opportunity cost of producing the last unit of the good is equal to marginal value. With negative externalities, marginal social cost exceeds marginal value because buyers and sellers fail to account for this negative impact. In theory a per unit tax equal to the marginal external damage can restore social optimality.

In experiment 2 we investigated two treatments: A laissez-faire treatment where the per unit tax is zero, and a government intervention where a per unit tax of $10 (paid by sellers) is imposed. Note that this tax is not optimal, because it is set without knowledge of the damages per unit. However the tax should still increase welfare when compared to what would occur in the absence of a tax.

The point of experiment 2 is to show a simple way governments can increase social welfare when a negative externality is present.

1 (0 marks)

For round 7, plot the Demand, production cost, and Supply with thick lines, bids and asks with thin lines, and mark the observed price and quantity with a dot.

Figure 1: Buyers in Red, Sellers in Blue.  Cost of Production, Supply and Demand (thick), Bids and asks (thin). Price and quantity dot.

Figure 1: Buyers in Red, Sellers in Blue. Cost of Production, Supply and Demand (thick), Bids and asks (thin). Price and quantity dot.

2 (10 marks)

Copy and paste (in your assignment2.R file) the code that created first_plot and rename the copied code second_plot. Add mapping=aes(frame=round_of_ten) to the call to ggplot(). Remove all the filtering of the data used in all of the geoms. e.g. in the first geom_step(), instead of data=filter(supply_and_demand, round_of_ten==7), you would have data=supply_and_demand. Put a copy of your code that creates second_plot in the chunk below.

(second_plot <- ggplot(mapping=aes(frame=round_of_ten))+
    geom_step(data=supply_and_demand, 
              mapping=aes(x=q, y=variable, colour=role), 
              direction="vh", lwd=1.25, alpha=.5)+
    geom_step(data=supply_and_demand,
              mapping=aes(x=q, y=net_of_tax, colour=role), 
              direction="vh", lwd=1.25, alpha=.5)+
    geom_step(data=bid_and_ask, 
              mapping=aes(x=q, y=variable, colour=role), 
              direction="vh", alpha=.25)+
    geom_point(data=outcomes,
               mapping=aes(x=q,y=price), colour="black", size=2, alpha=.2)+ 
    facet_grid(treatment~Rounds)+
    labs(title = paste0("Round "," of 10."),
         x=" \n Quantity",
         y="Price")+
    theme(axis.title.y = element_text(angle = 0)))

Make sure your code runs without error (control enter in your .R file). Then copy and paste the following code into your assignment2.R file, and run it (control enter).

(second_plot <- ggplotly(second_plot)%>%
  animation_opts(1000,transition = 100)%>%
  hide_legend()%>% 
  config(displayModeBar = F))

3 (10 marks)

Insert your animation second_plot below:

Figure 2: Buyers in Red, Sellers in Blue. Cost of Production, Supply and Demand (thick), Bids and asks (thin). Price and quantity dot.

4 (10 marks)

Describe the difference between the prediction (as determined by the intersection of the supply and demand functions) and the results of the experiments (as summarized by the dot at the price and quantity.)

For both treatments. Tax and no tax, the predicted value and the actual value are not very different, and basically coincide

5 (5 marks)

Create dataframe realized_welfare by taking dataframe mydf THEN group_by() treatment, Rounds, round_of_ten THEN summarize(realized_mean = mean(profit), realized_sd=sd(profit)).

realized_welfare <- mydf%>%
  group_by(treatment, Rounds, round_of_ten)%>%
  summarise(realized_mean=mean(profit),
              realized_sd=sd(profit))

6 (5 marks)

What is a boxplot? What does it mean to be robust (in the statistical sense?)

Boxplot is a representation of data. The data distribution is realized directly. The size of the box represents data dispersion, 25th percentile to 75 percentile. The line in the middle of the Box represents the Median, or 50th percentile, for the data. So very large or very small data does not affect percentile, it is robust

7 (5 marks)

Using data=realized_welfare, ggplot(), geom_jitter() and geom_boxplot() create a boxplot where aes(x=treatment,y=realized_mean). Set alpha=.25 for both geoms, and outlier.shape = NA,fill="red" for geom_boxplot().

8 (5 marks)

Using data=realized_welfare, ggplot(), geom_jitter() and geom_boxplot() create a boxplot where aes(x=treatment,y=realized_sd). Set alpha=.25 for both geoms, and outlier.shape = NA,fill="red" for geom_boxplot(). Reading https://r4ds.had.co.nz/transform.html will be helpful for this question.

9 (10 marks)

Create a new dataframe called maximal_welfare by using function get_maximal_welfare() with argument mydf. The function get_maximal_welfare() calculates the maximal welfare that is attainable for each simulation, given the supply, demand in that simulation.

maximal_welfare<-get_maximal_welfare(mydf)

10 (10 marks)

Create a new dataframe all_welfare by performing a full_join() of realized_welfare and maximal_welfare. Using the function mutate() create a new variable \(relative\_efficiency=\frac{realized\_mean}{maximal\_mean}\times 100\).

all_welfare<-full_join(realized_welfare,maximal_welfare)%>%
  mutate(realative_efficiency=realized_mean/maximal_mean*100)

11 (10 marks)

Using dataframe all_welfare create boxplots similar to question 6, but put relative_efficiency on the y axis rather than realized_mean.

12 (10 marks)

Why is relative_efficiency a better measure of the effect of the tax than realized_mean?

Demand and Supply differ depending on the number of participants in each trial. The market results of the experiment were also different. ‘Surplus’ also varies. Realized_weflare cannot be used directly to compare tax increases with no tax increases. It is meaningless, but relative efficiency is to calculate the relative distance between the actual result and socially Optimal outcome. Direct comparisons make sense

13 (10 marks)

How would an ideal experiment differ from this experiment? i.e. What limitations hamper our ability to say “emission taxes cause social welfare to increase.”

If the experiment is to be more rigorous, each student participating in the experiment should be allowed to join the market of tax and no tax at the same time, holding the same identity, and the only difference is treatment. However, this is unrealistic, so the students participating in the experiment should be randomly selected to ensure the same number of the two treatments. Demand and supply are the same. But the reality is that we don’t know how many students will participate and how many rounds will be taken