Talk:Multiple regression: Difference between revisions

m
imported>Stevegt
(Clarify the difference between multiple and single regression -- most examples on the page were cargo-culted and incorrect.)
 
(11 intermediate revisions by 2 users not shown)
Line 1:
= Examples are not multiple regression =
 
Many if not most of the examples on this page were apparently translated blindly from a single incorrect example that had height as X and weight as Y -- a single-axis regression. Regression of a single X axis is not multiple regression -- see References below. Those height/weight examples do not belong on this page. Much of the confusion in this discussion, and many of the suggestions for merging with [[Polynomial Fitting]], stem from that error.
 
Multiple regression, as mentioned in the description, is where the X input is a N-dimensional array; a matrix of two or more dimensions, not a list.
 
Think of multiple regression as "surface fitting" rather than curve fitting. Some examples:
* You want to use multiple regression to create a three-dimensional surface so you can estimate option contract price given spot price and implied volatility. For pretty pictures of this, see [https://www.google.com/search?q=+volatility+surface&tbm=isch volatility surface] graphs. In this case, X is a two-dimensional matrix of <code>{spot_price[i], implied_volatility[i]}</code>, and Y is a matching list of <code>option_contract_price[i]</code>.
* As a possible modification to the existing height/weight examples: You want to use height and body-mass index (BMI) to create a three-dimensional surface so you can estimate weight: X is a two-dimensional matrix <code>{height[i], bmi[i]}</code>, Y is <code>weight[i]</code>.
 
== Summary for clarification: ==
* '''Examples on this page must support a matrix of at least two dimensions as the X input''', as mentioned in the page description. (Any reasonable, non-hackish implementation will support any number of dimensions, due to the way the math works.)
* Do not merge this page with [[Polynomial Fitting]] -- the [[Polynomial Fitting]] page is about single regression. This page is about multiple regression.
* Do remove or replace the single-regression examples, specifically those that predict a weight from a height. They do not belong on a page about multiple regression.
 
== References: ==
* [https://en.wikiversity.org/wiki/Multiple_linear_regression Multiple Regression] page on Wikiversity
* [https://en.wikipedia.org/wiki/Linear_regression#Simple_and_multiple_linear_regression Multiple Regression] description in Wikipedia
--[[User:Stevegt|Stevegt]] ([[User talk:Stevegt|talk]]) 03:04, 9 September 2023 (UTC)
 
= Older discussion showing confusion due to proliferation of single-regression examples =
 
== Clarification needed ==
This task needs more clarification, like a link to a suitable wikipedia page. —[[User:Dkf|Donal Fellows]] 17:04, 29 June 2009 (UTC)
Line 81 ⟶ 59:
 
:: Some formula elements in the preamble to the Perl 6 contribution remain invisible to most browsers. Two instance of the Greek letter gamma (γ) and the whole of the formula I = h 0 ∧ h 1 ∧ h 2 which follows the word 'Noting'. The server-side graphic used by Chrome, IE/Edge, Safari etc is not displaying. (Only a minority of browsers (using MathML + local fonts, as in the case of Firefox) are displaying these formula elements) [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 19:42, 28 September 2016 (UTC)
 
= Examples are not multiple regression =
 
=''See Olderabove for older discussion showing confusion due to proliferation of single-regression examples =''
 
Many if not most of the examples on this page were apparently translated blindly from a single incorrect example that-- hadthe height/weight asexamples Xin andparticular weightare as Y -- aall single-axis regression. Regression of a single X axis is not multiple regression -- see References below. Those height/weight examples do not belong on this page. Much of the confusion in this discussion, and many of the suggestions for merging with [[Polynomial Fitting]], stem from that error.
 
Multiple regression, as mentioned in the description, is where the X input is a N-dimensional array; a matrix of two or more dimensionscolumns, not a list.
 
'''History of error'''
 
* The very first example, [https://rosettacode.org/wiki/Multiple_regression?oldid=121951 Ruby], was incorrect -- it only used a single-axis X input, when the task description clearly said "x is given to you as a two-dimensional array".
* The next example added, [https://rosettacode.org/wiki/Multiple_regression?oldid=121955 Tcl], introduced the single-axis height/weight example. Things sort of went all to heck from there, with other languages translating the incorrect example from Tcl.
 
''' Examples of multiple regression '''
 
Think of multiple regression as "surface fitting" rather than curve fitting. Some examples:
* You want to use multiple regression to create a three-dimensional surface so you can estimate optionimplied contract pricevolatility given spottime priceto maturity and implieddelta volatilityof an options contract. For pretty pictures of this, see [https://www.google.com/search?q=+volatility+surface&tbm=isch volatility surface] graphs. In this case, X is a two-dimensional matrix of <code>{spot_pricetime[i], implied_volatilitydelta[i]}</code>, and Y is a matching list of <code>option_contract_priceimplied_volatility[i]</code>.
* As a possible modification to the existing height/weight examples: You want to use height and body-mass index (BMI) to create a three-dimensional surface so you can estimate weight: X is a two-dimensional matrix <code>{height[i], bmi[i]}</code>, Y is <code>weight[i]</code>.
 
==''' Summary for clarification: =='''
 
* '''Examples on this page must support a two-dimensional matrix as the X input''', as mentioned in the task description.
* I've flagged C, Go, and Python as incorrect; that should help seed some multiple regression examples.
* The existing height/weight examples could be moved to either the [[Polynomial regression]] page if they are performing a polynomial curve fit, or to a [[Linear regression]] page if they are just fitting a straight line.
 
==''' References: =='''
* [https://en.wikiversity.org/wiki/Multiple_linear_regression Multiple Regression] page on Wikiversity
* [https://en.wikipedia.org/wiki/Linear_regression#Simple_and_multiple_linear_regression Multiple Regression] description in Wikipedia
--[[User:Stevegt|Stevegt]] ([[User talk:Stevegt|talk]]) 03:04, 9 September 2023 (UTC)
 
: First, do not top-post, that's just plain rude. I've removed the incorrect markers and reverted the task description. It is very rude to storm in here and unilaterally change a long-standing task description without discussing it ''first''. Remember this is a site for comparing programming languages, and not some kind of "Maths Overflow". If you are going to use terms such as "implied volatility" or "options contract" you need to explain them. If a task needs more precise inputs and expected outputs it should be discussed on the talk page. If this task deserves to be renamed and a new one created that's what should happen, after discussing it and if no-one objects. --[[User:Petelomax|Petelomax]] ([[User talk:Petelomax|talk]]) 12:14, 10 September 2023 (UTC)
::PS If you're going to claim some entries are incorrect, at the very least you should list some which ''are'' correct, and if there are none create one, or failing that show some expected/desired output, and if that is beyond you start a discussion on some other maths forum. --[[User:Petelomax|Petelomax]] ([[User talk:Petelomax|talk]])
::PPS Welcome to rosettacode, and don't fret about any of this, no-one is actually angry with you or anything like that. :-)
7,796

edits