首页 >
> 详细

San Francisco State University Michael Bar

ECON 312 Fall 2019

Problem set 4

Due Thursday, October 24, in class

Names of collaborators (type below):

Name 1_________________________________

Name 2_________________________________

Name 3_________________________________

Assignment Rules

1.Homework assignments must be typed. For instruction on how to type equations and math objects please see notes “Typing Math in MS Word”.

2.Homework assignments must be prepared within this template. Save this file on your computer and type your answers following each question. Do not delete the questions.

3.Your assignments must be stapled.

4.No attachments are allowed. This means that all your work must be done within this word document and attaching graphs, questions or other material is prohibited.

5.Homework assignments must be submitted at the end of the lecture, in class, on the listed dates.

6.Late homework assignments will not be accepted under any circumstances, but the lowest homework score will be dropped.

7.The first homework assignment cannot be dropped.

8.You are encouraged to work on this homework assignment in groups of up to 3 people, and submit one assignment with up to 3 names typed on this page. Sharing the electronic version of your assignment with other teams is absolutely prohibited.

9.All the graphs should be fully labeled, i.e. with a title, labeled axis and labeled curves.

10.In all the questions that involve calculations, you are required to show all your work. That is, you need to write the steps that you made in order to get to the solution.

11.This page must be part of the submitted homework.

Nonlinearities in variables

1.(10 points). Consider the following model:

a.Show that this model is linear in parameters .

The right hand side is a linear function of since it is a weighted sum of these parameters. The weight on is 1, and the weight on is .

b.Demonstrate how you can use OLS to estimate the unknown parameters of the model.

Firstly, we need to introduce transformed variables as follows:

Then, we use OLS to estimate the linear model:

2.(10 points). Consider the following model:

a.Show that this model is linear in parameters .

The right hand side is a linear function of since it is a weighted sum of these parameters. The weights are .

b.Demonstrate how you can use OLS to estimate the unknown parameters of the model.

Firstly, we need to introduce transformed variables as follows:

Then, we use OLS to estimate the linear model:

Nonlinearities in parameters

3.(10 points). Consider the following model:

a.Show how you can transform this model into a linear model in parameters .

Taking logs of both sides, gives that:

This model is linear in since the right hand side is a weighted sum of these parameters. It is not linear in but we can use the notation and make it linear in all the ’s.

b.Demonstrate how you can use OLS to estimate the unknown parameters of the model.

Firstly, we need to introduce transformed variables as follows:

Then we use OLS to estimate the linear model:

4.(10 points). Consider the following model:

a.Show how you can transform this model into a linear model in parameters .

Taking logs of both sides, gives that:

The right hand side is a linear function of the parameters and .

b.Demonstrate how you can use OLS to estimate the unknown parameters of the model.

Firstly, we need to introduce transformed variables as follows:

Then, we use OLS to estimate the linear model:

Elasticity

5.(5 points). Consider the following model (log-log):

Prove that the elasticity of with respect to is equal to .

The last term is the familiar formula for point elasticity of with respect to .

6.(5 points). Consider the following model (lin-log):

Prove that the elasticity of with respect to is equal to .

Thus, we need to divide by to get the point elasticity formula:

7.(5 points). Consider the following model (log-lin):

Prove that the elasticity of with respect to is equal to .

Thus, we need to multiply by to get the point elasticity formula:

8.(5 points). Consider the following model (linear):

Prove that the elasticity of with respect to is equal to .

Thus, we need to multiply by and divide by to get the point elasticity formula:

9.(5 points). Consider the following model (reciprocal):

Prove that the elasticity of with respect to is equal to .

Thus, we need to multiply by to get the elasticity formula:

Applications

Create an R script, which performs all the analysis in questions 10 and 11. You can name the script HW4.R. You can either print out the script and attach it as a separate page at the end of this assignment, or copy and paste its content at the end of your assignment. Make sure to add comments explaining which question you are solving, and every command in your script.

10.(30 points). The purpose of this project is to study the factors affecting home values in Boston, MA. The file is boston.csv (posted next to HW4 on the course webpage) contains data on 506 neighborhoods in Boston, with the following key variables in each neighborhood:

price - median price of a single-family home, in $

crime - crime rate (number of crimes committed per capita)

pollut – air pollution (in nitrous oxide parts per 100 million)

rooms - average number of rooms per home

dist - weighted distance to 5 major employment centers (in miles)

nteach - number of teachers per 100 students in local schools (measure of schools quality)

a.Present a summary statistics of the above variables in a stargazer table. First, install the stargazer package in R (you need to do this once)

install.packages("stargazer")

library(stargazer)

b.Based on the above summary statistics, the average price of single-family home in Boston is ___________, the median price of a single-family home in the cheapest neighborhood is ___________, the neighborhood with the highest crime rate had ___________ crimes per capita, the neighborhood with the smallest number of rooms per home had ___________ rooms per home on average, and the neighborhood with the lowest teachers/students ratio, had ___________ teachers per 100 students.

c.Estimate the following model using OLS, and present the R command and summary of regression output.

d.Interpret the estimated regression coefficient on rooms. Remember that each unit of observation is a neighborhood in Boston (not individual home).

e.Interpret the reported p-value for crime.

f.Report the 95% confidence interval for the coefficients in the model, and (based on the CI) give your conclusion about the test:

As always, you are required to report the R command and output.

11.(30 points). This question illustrates how to summarize the important regression output of several models in a single, publication-quality table. First, install the stargazer package in R:

install.packages("stargazer")

You only need to do this once. Use the same data set as in the previous question.

a.Suppose the model you estimated in the previous question is named model1. Estimate the following model, and call it model2.

Present a summary table with both model1 and model 2 using stargazer package. The R commands:

stargazer(model1, model2, type="text", report = "vc*",

intercept.bottom = FALSE,

title="Home Prices in Boston, MA",

dep.var.labels=c("price", "log(price)"),

out="models_boston.htm", digits=4)

The last option out="models_EARNINGS.htm" saves the table in html document format, which you must copy and paste into this assignment.

b.Interpret the estimated slope on log(pollut) in model2.

c.Explain the meaning of the stars next to the estimated coefficient on log(pollut) in model2 in the stargazer table.

For the next question you are required to use Stata. You must attach the do-file (similar to R-script) – a program that performs the analysis performed in this question.

12.(10 points). Using Stata, repeat the estimation of the 2 models in the last question, and create a publication-quality table using the Stata estout package. To set the current working directory to your desired folder, visit the “File” menu and “Change working directory”. Alternatively, use the command

cd "path to your working directory"

To install the estout package on your computer (you need to do this only once on every computer), type in Stata’s command window:

ssc install estout, replace

Open a do-file (the Stata analog of R-script) by clicking on the icon. Save the do-file as HW4.do. Comments in Stata do-file start with // or with *. Start your do-file with the usual description and listing the names of your collaborators. To clear the workspace, use:

clear all

set more off

To read the data into Stata, the command is:

import delimited "http://online.sfsu.edu/mbar/ECON312_files/boston.csv", clear

To create the logarithmic variables:

generate lprice = log(price)

generate lpollut = log(pollut)

generate ldist = log(dist)

To estimate the two models, and store the results:

regress price rooms crime pollut dist nteach

estimates store model1

regress lprice rooms crime lpollut ldist nteach

estimates store model2

To present the two models in a publication-quality table, we use the estout package (make sure you installed it, otherwise the following commands will not work). The commands are:

esttab model1 model2 ///

using models_boston.rtf, ///

title("Home Prices in Boston, MA, using Stata") ///

mtitles("price" "log(price)") se ///

stat(N r2 r2_a F p) replace

To run the program use “Ctrl+d” or click on the button. The /// at the end of a line break the long command into several lines. The main command, esttab, generates the table with the 2 models. The using models_boston.rtf saves the table in rich text format file, which opens with Microsoft word. The option se puts standard errors for each estimate in brackets, instead of the t-statistic, which is the default. The option stat(N r2 r2_a F p) adds to the table the number of observations used in every model (N), the , the adjusted , the F-statistic, and the p-value for the F-test of overall fit. All you need to do is open the file models_EARNINGS.rtf and copy the table into your assignment.

联系我们

- QQ：99515681
- 邮箱：99515681@qq.com
- 工作时间：8:00-23:00
- 微信：codinghelp

- 代写dataset留学生作业、代做c/C++，Java编程设计作业、Pyth 2019-11-21
- Cache Comparisons作业代写、R程序语言作业调试、R实验作业代 2019-11-21
- Programming作业代做、代写c++课程设计作业、C++程序语言作业调 2019-11-21
- Data Programming作业代写、代做dataframe X作业、P 2019-11-21
- Cricos 00213J作业代做、代写it Systems作业、代写pyt 2019-11-21
- 代做r Hw2留学生作业、代写decision Making作业、代写r编程 2019-11-21
- Tcss 380作业代写、代做c++编程设计作业、代写c/C++实验作业、P 2019-11-21
- 代写program留学生作业、Java程序语言作业调试、Java实验作业代做 2019-11-21
- Csci-1200作业代做、Data Structures作业代写、代做py 2019-11-21
- 代写tunedit Data作业、代做python编程设计作业、代写pyth 2019-11-21
- Csci 370作业代写、代做java课程设计作业、Java程序语言作业调试 2019-11-21
- 代写comp 1010作业、Program留学生作业代做、代写python， 2019-11-21
- Wisccompsci200作业代做、Java编程设计作业代写、Java语言 2019-11-21
- 4Cosc001w作业代做、Python程序语言作业调试、Python课程作 2019-11-20
- 代写csc 230作业、代做ascii留学生作业、Python，Java程序 2019-11-20
- Cmpt 361作业代写、代做system留学生作业、Java，C++编程语 2019-11-20
- 代做cs5783留学生作业、代写machine Learning作业、代写c 2019-11-20
- B365留学生作业代做、代写iris Data作业、代做r程序语言作业、代写 2019-11-20
- Inft 3033作业代做、代写c/C++编程语言作业、代做c++课程设计作 2019-11-20
- Cs610-101作业代写、Programming课程作业代做、C/C++, 2019-11-20