Open malmufre opened 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
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
Please use the CURRENT help board as well (this one is for the course fall 2019):
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.
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
That looks better!
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 )
Yes i was able to view it as an excel file . It has data related to happiness and income
Were you able to run the model for Q1 then?
Hi Dr Jessy, This is what I did for qs 2
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?