Earn Higher Grades With Instant Assignment Help.Ask Question!

Python Programming
(5/5)

What is the effect of a one unit increase in LSAT score on the log of median salary?

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

SSID

1.1   Exercise 1: Single Regression

Please don’t forget to comment your code. Failure to do so will result in a loss of points.

Also, remember that all code that is required here (unless otherwise stated) can be found in the lecture Jupyter Notebooks or the coding notebooks from class.

Here are three models for the median starting salary of law school graduates in 1985.

 

log(salaryi) = b0 + b1 LSATi + ei

 (1) log(salaryi) = b0 + b1 LSATi + b2GPAi + ei 

(2) log(salaryi) = b0 + b1 LSATi + b2GPAi + b3log(costi) + b4ranki + ei 

 (3)Each observation i represents a school. The variables in the dataset are:

Variable   Description

  1. rank law school ranking

  2. salary median starting salary

  3. cost law school cost

  4. LSAT median LSAT score

  5. GPA median college GPA

  6. libvol volumes in lib., 1000s

  7. faculty of faculty

  8. age age of law sch., years

  9. clsize size of entering class

  10. north =1 if law sch in north

  11. south =1 if law sch in south

  12. east =1 if law sch in east

  13. west =1 if law sch in west

  14. studfac student-faculty ratio

  15. top10 =1 if ranked in top 10 

  1. In the code cell below, write the appropriate imports you will need for this question (we will need pandas, numpy and formula.api).  You  can do an abbreviated import if you wish (but the standard for pandas is pd, statsmodels.formula.api is smf, and numpy is np). Afterwards, load in the data from here:

https://raw.githubusercontent.com/lordflaron/ARE106data/master/lawsch85.csv

This can be done using the read_csv() function. Name this dataset raw_df. After loading in the data, show the first 10 observations in the output.

  1. Use the describe() method on raw_df to show a table of summary statistics for each variable in the dataset. How many observations do salary have? Write this in a print statement. (Hint: This is in the “count” row the summary table).

NameError Traceback (most recent call last)

<ipython-input-56-894b02c4d62f> in <module>

1 ## b. Put your answer in this cell.

----> 2 describe(raw_df)

3 print("raw_df")

NameError: name 'describe'    is not defined

  1. Since we’ll need a log-transformed version of salaryi for all our models, use assign() to create a new variable which is the log of salaryi. Name this new variable log_salary.

Hints:

Remember that assign is not an inplace operation!

Remember to use a lambda function in this case. To log a variable, you can use np.log()

Remember the syntax for assign(): my_df.assign(new_variable = expression)

After this we now need to also drop any observations that are missing. This isn’t actually how econometricians deal with missing data, but this is good enough for us for now.

You can do this by chaining the dropna() method after the assign() method.

Warning: Do not do dropna BEFORE assign

The end result should look something like this:

df = raw_df.assign(log_salary= expression).dropna()

[3]:

 

  1. Before estimating the model, explain how to interpret b1 in Model

Please write your answer for d here. If you need to use more than one line, you may do so.

 Before estimating the model, explain how to interpret b1 in Model

Please write your answer for e here. If you need to use more than one line, you may do so.

 Before estimating the model, do you expect b1 and b2 to be positive or negative in Model 2? Explain. (Hint: I’m not asking for any rigorous mathematical way to answer this question. Just use your economic intuition and reasoning skills to write an argument).

Please write your answer for f here. If you need to use more than one line, you may do so.

  1. Estimate Model 1. Show the regression

  2. What is the effect of a one unit increase in LSAT score on the log of median salary?

Please write your answer for h here. If you need to use more than one line, you may do so.

  1. What does the R2 measure in the regression? What is the R2 in this case? (Not the adjusted

R2).

Please write your answer for i here. If you need to use more than one line, you may do so.

  • Exercise 2: Multiple Regression

This is a continuation of what we were doing in Exercise 1.

For this exercise, observe the expression for b1 when there are two regressors in the equation:

bˆ        ∑N x1iyi ∑N x2

− ∑N x1ix2i ∑N x2iyivariances and covariances without changing the value of the coefficient (since N2 is 1).

N2

Also notice that the covariance is like an un-normalized correlation coefficient. So if you

calculate the correlation between two variables, you won’t know the covariance between the two, but you’ll know the direction and strength of their relationship. Estimate Model 2. 

Calculate the correlations between log(salary)i, LSAT, and GPA.

Use the slicing notation to first make a subset of the data with only log_salary, LSAT and GPA.

Then use the corr() method to get the correlation for those variables, i.e. it will look something like this:

df[['log_salary', 'GPA', 'LSAT']].corr()

Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
968 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
732 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
525 Answers Hire Me