Home Page > > Details

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.

Contact Us(Ghostwriter Service)

- QQ：99515681
- WeChat：codinghelp
- Email：99515681@qq.com
- Work Time：8:00-23:00

- Rtos Kernel Assignmenthelp With ,Ghost... 2019-11-14
- Algorithm Course Assignmentghostwriter... 2019-11-14
- Help With Fpu Assignment,Ghostwriter P... 2019-11-14
- Ghostwriter Msc/Icy Course Assignment,... 2019-11-14
- Cse105 Assignmenthelp With ,Java Progr... 2019-11-14
- Ghostwriter Fm 9528 Assignment,Help Wi... 2019-11-14
- Cmt115 Assignmenthelp With ,Programmin... 2019-11-14
- Eng5298 Assignmenthelp With ,Ghostwrit... 2019-11-14
- Stat 432 Assignmentghostwriter ,R Prog... 2019-11-14
- Jit104 Assignmenthelp With ,Ghostwrite... 2019-11-13
- Help With Stat 3675Q Assignment,Ghostw... 2019-11-13
- Csc 360 Assignmentghostwriter ,Help Wi... 2019-11-13
- Ghostwriter Cpt120 Assignment,Ghostwri... 2019-11-13
- Comp9444 Assignmenthelp With ,Python P... 2019-11-13
- Help With Cs1026 Assignment,Analysis C... 2019-11-13
- Lp002 Assignmenthelp With ,Ghostwriter... 2019-11-13
- Ghostwriter Comp 250 Assignment,Help W... 2019-11-13
- Cmt107 Assignmenthelp With ,Ghostwrite... 2019-11-12
- Econometrics Assignmenthelp With ,Ghos... 2019-11-12
- Help With Dataset Course Assignment,Gh... 2019-11-12

Contact Us - Email：99515681@qq.com WeChat：codinghelp

© 2014 www.asgnhelp.com

Programming Assignment Help！