Difference between revisions of "Página de pruebas"

From Sinfronteras
Jump to: navigation, search
Line 5: Line 5:
 
In general, there are 3 main stages in Linear regression:
 
In general, there are 3 main stages in Linear regression:
  
: '''1'''. Use '''Least-squqres''' to fit a line to the data
+
: '''1'''. Using '''Least-squares''' to fit a line to the data
  
: '''2'''. Calculate <math>R^2</math>
+
: '''2'''. Calculating <math>R^2</math>
  
: '''3'''. Calculate a <math>p-value</math> for <math>R^2</math>
+
: '''3'''. Calculating a <math>p-value</math> for <math>R^2</math>
  
  
 
<br />
 
<br />
: '''1. Use '''Least-squares''' to fit a line to the data'''
+
: '''Using '''Least-squares''' to fit a line to the data'''
 +
<blockquote>
 +
 
 
:* First, draw a line through the data.
 
:* First, draw a line through the data.
:* Second, calculate the '''Residual sum of squares''': Measure the distance from the line to the each data point (residual), square each distance, and then add them up.
+
 
 +
:* Second, calculate the '''Residual sum of squares''': Measure the distance from the line to each data point (residual), square each distance, and then add them up.
 
::: The distance from a line to a data point is called a '''residual'''
 
::: The distance from a line to a data point is called a '''residual'''
 +
 
:* Then, we rotate the line a little bit and calculate the RSS
 
:* Then, we rotate the line a little bit and calculate the RSS
 
:* ...
 
:* ...
 
:* ...
 
:* ...
:* Then, we find the rotation that has the least RSS.
+
 
 +
:* Then, the line that represents the linear regression is the one corresponding to the rotation that has the least RSS. The regression equation:
 +
 
 +
: <math> y = a + bx </math>
 +
 
 +
: The equation is composed by 2 parameters:
 +
 
 +
::* Slope: <math> b = r \frac{S_y}{S_x}</math>
 +
::  The slope is the amount of change in units of <math>y</math> for each unitchange in <math>x</math>.
 +
 
 +
::* The <math>y-axis</math> intercept.
 +
</blockquote>
 +
 
  
  

Revision as of 20:42, 27 December 2020

Simple Linear Regression

https://www.youtube.com/watch?v=nk2CQITm_eo&t=267s


In general, there are 3 main stages in Linear regression:

1. Using Least-squares to fit a line to the data
2. Calculating Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle R^2}
3. Calculating a for Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle R^2}



Using Least-squares to fit a line to the data
  • First, draw a line through the data.
  • Second, calculate the Residual sum of squares: Measure the distance from the line to each data point (residual), square each distance, and then add them up.
The distance from a line to a data point is called a residual
  • Then, we rotate the line a little bit and calculate the RSS
  • ...
  • ...
  • Then, the line that represents the linear regression is the one corresponding to the rotation that has the least RSS. The regression equation:
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle y = a + bx }
The equation is composed by 2 parameters:
  • Slope: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle b = r \frac{S_y}{S_x}}
The slope is the amount of change in units of Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle y} for each unitchange in Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle x} .
  • The Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle y-axis} intercept.





SimpleLinearRegression2.png


The regression equation: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle y = a + bx }

  • Dependent variable: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle y } :
  • Independent variable: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle x } :
  • Slope: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle b = r \frac{S_y}{S_x}}
The slope is the amount of change in units of Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle y} for each unitchange in Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle x} .
  • Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle y } intercept: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle a = \bar{y} - b\bar{x} } :