ProfessorAmanda / econsimulations

This repository provides the code underlying simulations for teaching statistics and econometrics. The project site, which includes teaching materials as well as the link to the simulations, is located here: https://amandagreggeconomics.com/statistics-simulations-project/
Other
1 stars 0 forks source link

show regression equation #283

Closed waynew99 closed 2 years ago

waynew99 commented 2 years ago
Screen Shot 2022-06-06 at 13 39 01

Resolves issue #280

[Feature] I've added the presentation of regression equation to the right of the chart. It adapts to the newest regression line when new examples are generated. The equation for Corrected Regression is shown / hidden in sync with the regression line on the chart.

[Questions]

  1. Is the expression format "f(x)=2.79x+56.89" the correct one for the regression equation in this context?
  2. Currently, on every re-generation of examples, the Corrected Regression line is hidden by default. Is it a feature wanted? Do we want to keep it that way?

Please let me know if there's any problem running the branch "OVBequations" locally, or any changes you would like me to make :)

ProfessorAmanda commented 2 years ago

Great first pull request, Wayne! :)

  1. I want to get Tanya's opinion on how the equations look now, particularly about whether we should use y and x, or the names of the variables.
  2. Yes, we want the Corrected Regression line to be hidden by default, so that each time we generate new data, the user has to click the "reveal" button and experience an a-ha moment.
tbyker commented 2 years ago

Hi Wayne, This is looking great. In terms of how the equation should appear, can you take a look at the multiple regression module (click show best fit line/plane). We do want the variable names to appear in the equation (instead of "x" and f(x). For the "corrected" line, we should also include the coefficient on Sleep. I am not sure how that is getting reported in the regression output in javascript, but it should be there somewhere. Happy to hop on zoom and explain any of this if needed.

Best,

Tanya


Tanya Byker

Associate Professor, Economics

Middlebury College @.**@.>



From: Amanda Gregg @.> Sent: Monday, June 6, 2022 2:24 PM To: ProfessorAmanda/econsimulations @.> Cc: Byker, Tanya S. @.>; Review requested @.> Subject: Re: [ProfessorAmanda/econsimulations] show regression equation (PR #283)

Great first pull request, Wayne! :)

  1. I want to get Tanya's opinion on how the equations look now, particularly about whether we should we use y and x, or the names of the variables.
  2. Yes, we want the Corrected Regression line to be hidden by default, so that each time we generate new data, the user has to click the "reveal" button and experience an a-ha moment.

— Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FProfessorAmanda%2Feconsimulations%2Fpull%2F283%23issuecomment-1147750013&data=05%7C01%7Ctbyker%40middlebury.edu%7Cc7dc072c3214444d9be808da47e9d7f1%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637901366917968138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=S3O7vtegKNX9w6%2B8man%2Fbq9q8urC86VhDbmvd4qJ%2Bfc%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAP65VZ63TBBP4JEH772NLVDVNY67DANCNFSM5YADMH4Q&data=05%7C01%7Ctbyker%40middlebury.edu%7Cc7dc072c3214444d9be808da47e9d7f1%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637901366917968138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=i14LwuC87kpG%2BOkiQ8E6hPLJv%2BsCRfyaXPjqNEoiOmk%3D&reserved=0. You are receiving this because your review was requested.Message ID: @.***>

waynew99 commented 2 years ago

Hi Professors,

Thanks for the explanations! Just to confirm, we want TestScore = beta0 + beta1 * StudyHours + delta * SleepHours + epsilon

My understanding is that the user sets beta1 and delta, and we supply beta0 and epsilon.

Thanks, Wayne

tbyker commented 2 years ago

Hi Wayne, For the naive regression:

TestScore= estimated_beta_0 (this is the estimated intercept) + estimated_beta_1 * StudyHours + u_i (just the greek symbol, not a number)

For the corrected regression

TestScore= estimated_beta_0 (this is the estimated intercept from the second regression and yes, it should be close to the input value) + estimated_beta_1 StudyHours + estimated_deltaSleepHours + u_i (just the greek symbol, not a number)

Sorry, it didn't work very well to type it out. Let me know if that makes sense.

Tanya


Tanya Byker

Associate Professor, Economics

Middlebury College @.**@.>



From: Wayne Wang @.> Sent: Monday, June 6, 2022 3:20 PM To: ProfessorAmanda/econsimulations @.> Cc: Byker, Tanya S. @.>; Review requested @.> Subject: Re: [ProfessorAmanda/econsimulations] show regression equation (PR #283)

Hi Professors,

Thanks for the explanations! Just to confirm, we want TestScore = beta0 + beta1 StudyHours + delta SleepHours + epsilon

My understanding is that the user sets beta1 and delta, and we supply beta0 and epsilon.

Thanks, Wayne

— Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FProfessorAmanda%2Feconsimulations%2Fpull%2F283%23issuecomment-1147810107&data=05%7C01%7Ctbyker%40middlebury.edu%7C541aabdcb5cb4e1716b608da47f19474%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637901400155879855%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pNqn%2BCMAV2X0eZyRL9%2ByxBSEZEz%2BqkaMG%2BMfEClaRls%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAP65VZ4745MYVCYKTN3ETG3VNZFOZANCNFSM5YADMH4Q&data=05%7C01%7Ctbyker%40middlebury.edu%7C541aabdcb5cb4e1716b608da47f19474%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637901400155879855%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ySv0vbYlo4tuSiq9hL4fLm40rZfwXdarMIv6pWQQuKE%3D&reserved=0. You are receiving this because your review was requested.Message ID: @.***>

waynew99 commented 2 years ago

Thanks! It does make sense.

I've also moved it to the bottom of the graph due to the length of the equation (it's probably not ideal to split one equation into two lines).

Please let me know if I didn't understand correctly!

Best, Wayne

Screen Shot 2022-06-06 at 16 08 28

tbyker commented 2 years ago

Hi Wayne, The two equations should be different. For the example listed:

The naive regression: it looks like the estimated intercept is around 65, and should have an estimated beta_1 much closer to zero. Also, in the naive regression, the delta should not appear as technically, sleep is in the error term in that initial regression.

The corrected regression line looks correct.

Does this make sense?

Best,

Prof. Byker


Tanya Byker

Associate Professor, Economics

Middlebury College @.**@.>



From: Wayne Wang @.> Sent: Monday, June 6, 2022 4:12 PM To: ProfessorAmanda/econsimulations @.> Cc: Byker, Tanya S. @.>; Review requested @.> Subject: Re: [ProfessorAmanda/econsimulations] show regression equation (PR #283)

Thanks! It does make sense.

I've also moved it to the bottom of the graph due to the length of the equation (it's probably not ideal to split one equation into two lines).

Please let me know if I didn't understand correctly!

Best, Wayne

[Screen Shot 2022-06-06 at 16 08 28]https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F49931122%2F172240182-6bb173a0-7366-45d0-b6d0-44235e68d8dd.png&data=05%7C01%7Ctbyker%40middlebury.edu%7Ce0c36bec5d564087871208da47f8d15f%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637901431251750148%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=vrlYyZkFRnRKirNvRAgfRNp%2Bb4lEfmQ57OSZaCbLdvs%3D&reserved=0

— Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FProfessorAmanda%2Feconsimulations%2Fpull%2F283%23issuecomment-1147871038&data=05%7C01%7Ctbyker%40middlebury.edu%7Ce0c36bec5d564087871208da47f8d15f%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637901431251750148%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mITxzdHJPWYgyvPdFGFS0%2FxhmDiRJuuBVE%2FjPwXg7nA%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAP65VZ2FOKGUPKC7N7XABQTVNZLRDANCNFSM5YADMH4Q&data=05%7C01%7Ctbyker%40middlebury.edu%7Ce0c36bec5d564087871208da47f8d15f%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637901431251750148%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=w7p3i3B2SqFfkNjPTdW%2BUAoNI8KkbV9c7J1lA6M4Bww%3D&reserved=0. You are receiving this because your review was requested.Message ID: @.***>

waynew99 commented 2 years ago

Hi Professor Byker,

Sorry for the misinterpretation! I should have made sure I understood it correctly before attempting those modifications. Does this look right?

Best, Wayne

Screen Shot 2022-06-06 at 16 22 54

tbyker commented 2 years ago

Great! And the corrected line should only appear once the user has clicked the "show corrected line" button.

Thanks!

Tanya


Tanya Byker

Associate Professor, Economics

Middlebury College @.**@.>



From: Wayne Wang @.> Sent: Monday, June 6, 2022 4:26 PM To: ProfessorAmanda/econsimulations @.> Cc: Byker, Tanya S. @.>; Review requested @.> Subject: Re: [ProfessorAmanda/econsimulations] show regression equation (PR #283)

Hi Professor Byker,

Sorry for the misinterpretation! I should have made sure I understood it correctly before attempting those modifications. Does this look right?

Best, Wayne

[Screen Shot 2022-06-06 at 16 22 54]https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F49931122%2F172242469-f635c2e6-9abf-4fae-aff1-49bb2343c6b9.png&data=05%7C01%7Ctbyker%40middlebury.edu%7C6a655bfab7f242a7e79508da47fac8e3%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637901439695985111%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qFM2E99tzgbhkqaIgXYphJctIVWE8675lhS2c6OdSxM%3D&reserved=0

— Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FProfessorAmanda%2Feconsimulations%2Fpull%2F283%23issuecomment-1147886421&data=05%7C01%7Ctbyker%40middlebury.edu%7C6a655bfab7f242a7e79508da47fac8e3%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637901439695985111%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=tav139g8yVuZoj8Hg9hvLYchF4W7WoyVLbtQOsS49yg%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAP65VZ22ITYLOD7MFFC5LXLVNZNF5ANCNFSM5YADMH4Q&data=05%7C01%7Ctbyker%40middlebury.edu%7C6a655bfab7f242a7e79508da47fac8e3%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637901439695985111%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1%2Bp%2BXKlfQCt2EXn%2B%2F9AvIpKLjLLmtbJwVb1vdXYI%2F6w%3D&reserved=0. You are receiving this because your review was requested.Message ID: @.***>