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. T. Joy

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()+
  geom_step(data=supply_and_demand, 
            mapping=aes(x=q, y=variable, colour=role, frame=round_of_ten), 
            direction="vh", lwd=1.25, alpha=.5)+
  geom_step(data=supply_and_demand, 
            mapping=aes(x=q, y=net_of_tax, colour=role, frame=round_of_ten), 
            direction="vh", lwd=1.25, alpha=.5)+
  geom_step(data=supply_and_demand, 
            mapping=aes(x=q, y=variable, colour=role, frame=round_of_ten), 
            direction="vh", alpha=.25)+
  geom_point(data=filter(outcomes, round_of_ten==7), 
             mapping=aes(x=q,y=price), colour="black", size=2, alpha=.2)+ 
  facet_grid(treatment~Rounds)+
  labs(title = paste0("Round ",7 ," 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.)

the quantity is lower than the prediction because people got kicked out of the experiment and did not bid or ask, yet the point is the same price as the intersection because participants still acted rationally making their decisions of bid and ask prices predictable

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<-group_by(mydf,treatment, Rounds, round_of_ten)
realized_welfare<-summarize(realized_welfare, 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?) A boxplot is a graphical representation of data represented by quartiles. the box plot is typically between the first and third quartile called the interquartile range, the line is the median. Robust in statistics refers to the soundness of a statistic across a diversity of conditions including the ability to accomodate for variaions in data(skews, outliers etc).

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

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)
  all_welfare<-mutate(all_welfare, relative_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? Relative_efficiency accommodates for the lack of ability to mimic a perfect environment whereas relative_mean does not. This makes relative_efficiency more representative of the real social environment and therefor more capable of measuring the effect of tax accurately

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.”

external cost was constant throughout the experiment which is mostly not the case with environmental costs, supply and demand were not representative because people got kicked out by inactivy overtime, it was a small sample size that may not necessarily properly represent rational decision making. because we could not correctly mimic the social environment, it may lead to a statistically inaccurate representation of the environment and therefor we cannot make proper assumptions about the population.