Watts-College / cpp-523-fall-2021

https://watts-college.github.io/cpp-523-fall-2021/
1 stars 3 forks source link

Lab 6 #14

Open asukajames opened 2 years ago

asukajames commented 2 years ago

Question 1 Can anyone clarify what we are asked to do here?

Question 2 I am getting the negative answer. Is that possible?

BrettMFoster commented 2 years ago

Can you post the verbiage for the questions?

AshtonHop9 commented 2 years ago

@asukajames

I think question one wants us to make a regression table. The table that should come up is the table in the lab 6 instructions that has all the hashtags in it under question one.

In R when you try to run the first chunk of code under question 1, it gives an error and the instructions above the question say to create a new variable x-squared.

In the lab 6 instructions on Github under question one there is a chunk of code that assigns the data in the dataset to the x and y variables.
For example, y.happy <- dat$happiness. If you open "dat" in the global environment window in R you can see the two columns are income and happiness, and the chunk of code you add to R will assign this data to the variables you create (y.happy etc.) so you can add them into the Happiness = b0 + b1 income + b2income^2 + e equation. Just use the code chunk to assign the data to your new variables, then plug those variables into the "m <- lm...." equation and you should get the results in a regression table.

I think this is what the question is asking to do, if I am wrong, someone please tell me hah :)

Hopefully this explains enough, or hopefully I didn't over explain if you already know!

AshtonHop9 commented 2 years ago

@asukajames @Schlinkert For question 2 I am also getting a negative answer, I would like to confirm if this is correct, in the lab 6 instructions it shows an answer of 410 for the example, but that is just using coefficients of 1. When I add the coefficients from the regression table all the answers come out negative. This is a little confusing because the effects of income raises which are stated from the reading in the lab seem to differ from our results.

Schlinkert commented 2 years ago

The scaling is throwing a lot of people off. Try using 1.5 for x in the first model and 2.5 for x in the second model. Then plug in those values along with the values provided, and subtract the final answers from each model to arrive at the final increase in happiness. It should be a positive number.

dholford commented 2 years ago

I'm running into an issue in this vein as well:

I think I have everything set up correctly based on the conversation above. However, in the video review it was mentioned in question 3 or 4 we should end up with a negative number. Reflecting the quadratic regression. I am not getting a negative number though. The increase in happiness is decreasing, but I haven't gotten a negative number. I'm including my code chunk for question 4 below:

`b0 <- 35.35 b1 <- 7.36 b2 <- -.25

x <- 10 happy.100k <- b0 + b1x + b2x*x

x <- 11 happy.110k <- b0 + b1x + b2x*x

happy.110k - happy.100k`

And I get 2.11.

Additionally, I'm a little thrown by the direction on the week 6 review guide to report as a point gain in happiness on a 100-point scale?

Would really appreciate any help.

Thanks, Dylan

BrettMFoster commented 2 years ago

I don't understand the 100 point scale clarification either. Would it just be saying you climb 2 points in happiness?

The video is confusing on the other point also because using the slope seen in the graph below, how could a negative number occur unless we're analyzing around 160K a year... but even at that level, I would be skeptical of a negative number.

image

asukajames commented 2 years ago

@dholford

Hi Dylan,

I think you are doing the lab correctly. I believe the professor said that it can be negative eventually but did not say we will get the negative answers for this lab. I got all positive numbers :-)

Schlinkert commented 2 years ago

Sorry for the confusion on these questions. What I meant in the lecture is that you will find a point in the equation where an increase in income actually leads to a decrease happiness.

For the 100 point scale question, yes, you would interpret the results as a 2 point increase in happiness based on a certain level of income increase.

dholford commented 2 years ago

No worries! Thanks for clarifying.

Best, Dylan