DS4PS / cpp-523-fall-2019

Course shell for CPP 523 Foundations of Program Evaluation I for Fall 2019.
http://ds4ps.org/cpp-523-fall-2019/
6 stars 3 forks source link

lab 6- question 2 #23

Open malmufre opened 4 years ago

malmufre commented 4 years ago

Hi Dr Jessy, This is what I did for qs 2

b0 <- 35.348269
b1 <-  7.361023 
b2 <- -0.251607 

x <- 1
happy.15k <- b0 + b1*x + b2*x*x

x <- 2
happy.25k <- b0 + b1*x + b2*x*x

happy.25k - happy.15k  # marginal effect of $10k increase at $15k starting salary

I just changed the B0 ,B1 and b2 according to the codes given and input them and I got 6.606202 for all the questions since the change in salaries is 10 k for all cases is that correct?

lecy commented 4 years ago

What does x represent in this model?

You need to use the appropriate values for these too (the 1 and 2 were just placeholders):

x <- 1
happy.15k <- b0 + b1*x + b2*x*x

x <- 2
happy.25k <- b0 + b1*x + b2*x*x
malmufre commented 4 years ago

okay so I changed it to


b0 <- 35.348269
b1 <-  7.361023 
b2 <- -0.251607 

x <- 7.361023 
happy.15k <- b0 + b1*x + b2*x*x

x <- -0.251607
happy.25k <- b0 + b1*x + b2*x*x

happy.25k - happy.15k

and I got [1] -42.41943
but I got b1 and b2 the same as the Xs 
lecy commented 4 years ago

Please use the CURRENT help board as well (this one is for the course fall 2019):

https://github.com/DS4PS/cpp-523-spr-2020/issues

lecy commented 4 years ago

You are modeling happiness as a function of income.

In this example code, x represents income. So you need to select appropriate values for income to calculate the marginal effects.

malmufre commented 4 years ago

okay got it


b0 <- 35.348269
b1 <-  7.361023 
b2 <- -0.251607 

x <- 15 
happy.15k <- b0 + b1*x + b2*x*x

x <- 25
happy.25k <- b0 + b1*x + b2*x*x

happy.25k - happy.15k 

I used the b0 which is the constant in the code, the b1 which is x.income and b2 which is the x2 and for the  x<-15 which represents the increase in income
lecy commented 4 years ago

That looks better!

lecy commented 4 years ago

Did you figure out how to load the data?

URL <- "https://raw.githubusercontent.com/DS4PS/cpp-523-fall-2019/master/labs/data/IncomeHappiness.csv"
dat <- read.csv( URL )
malmufre commented 4 years ago

Yes i was able to view it as an excel file . It has data related to happiness and income

lecy commented 4 years ago

Were you able to run the model for Q1 then?