<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=R_-_Regression</id>
	<title>R - Regression - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=R_-_Regression"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=R_-_Regression&amp;action=history"/>
	<updated>2026-05-13T23:42:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=R_-_Regression&amp;diff=29320&amp;oldid=prev</id>
		<title>Bernard Szlachta at 03:13, 6 March 2016</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=R_-_Regression&amp;diff=29320&amp;oldid=prev"/>
		<updated>2016-03-06T03:13:28Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Intro to R|084]]&lt;br /&gt;
{{Cat|Forecasting}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Linear regression&amp;#039;&amp;#039;&amp;#039; is an approach to modelling the relationship between a dependent variable &amp;#039;&amp;#039;y&amp;#039;&amp;#039; and one or more explanatory variables &amp;#039;&amp;#039;X&amp;#039;&amp;#039;.&lt;br /&gt;
* One explanatory variable -&amp;gt; &amp;#039;&amp;#039;simple regression&amp;#039;&amp;#039;&lt;br /&gt;
* Many explanatory variables -&amp;gt; &amp;#039;&amp;#039;multiple regression&amp;#039;&amp;#039;&lt;br /&gt;
* Multiple correlated dependent &amp;#039;&amp;#039;y&amp;#039;&amp;#039; variables are predicted -&amp;gt; &amp;#039;&amp;#039;multivariate linear regression&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Linear regression is usually used for:&lt;br /&gt;
* Prediction/forecasting&lt;br /&gt;
* Quantify the strength of the relationship between &amp;#039;&amp;#039;y&amp;#039;&amp;#039; and the &amp;#039;&amp;#039;X&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;&amp;#039;&amp;#039;j&amp;#039;&amp;#039;&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implementation:&lt;br /&gt;
* Least squares&lt;br /&gt;
* Least absolute deviations&lt;br /&gt;
* Ridge regression&lt;br /&gt;
&lt;br /&gt;
== Regression Model==&lt;br /&gt;
 &amp;lt;math&amp;gt;&lt;br /&gt;
 y_i = \beta_1 x_{i1} + \cdots + \beta_p x_{ip} + \varepsilon_i&lt;br /&gt;
 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hours Studying and GPA ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;How well does the average number of hours studying predict GPA?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Predictor variable - Hours&lt;br /&gt;
* Response (criterion) variable - GPA&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 # Read the data &lt;br /&gt;
 gpa &amp;lt;- read.table(&amp;quot;http://training-course-material.com/images/8/86/Study-time-gpa.txt&amp;quot;,h=T)&lt;br /&gt;
 &lt;br /&gt;
 # Pearson correlation&lt;br /&gt;
 cor(gpa)&lt;br /&gt;
&lt;br /&gt;
 # Draw a scatter plot&lt;br /&gt;
 plot(gpa)&lt;br /&gt;
&lt;br /&gt;
 # Create a model&lt;br /&gt;
 m &amp;lt;- lm(GPA ~ Hours, data=gpa)&lt;br /&gt;
&lt;br /&gt;
 # Show the model&lt;br /&gt;
 m&lt;br /&gt;
&lt;br /&gt;
 # Validate the model&lt;br /&gt;
 summary(m)&lt;br /&gt;
&lt;br /&gt;
 # Draw the model&lt;br /&gt;
 abline(m)&lt;br /&gt;
&lt;br /&gt;
 # What would be a score for studding for 34 hours&lt;br /&gt;
 p &amp;lt;- predict.lm(m,data.frame(Hours = c(34)))&lt;br /&gt;
 p&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[[File:ClipCapIt-160306-111233.PNG]]&lt;br /&gt;
&lt;br /&gt;
== Exercises ==&lt;br /&gt;
Using linear regression, find the predicted post-test score for someone with a score of 43 on the pre-test.&lt;br /&gt;
&lt;br /&gt;
http://training-course-material.com/images/8/84/Pre-post-test-scores.txt&lt;/div&gt;</summary>
		<author><name>Bernard Szlachta</name></author>
	</entry>
</feed>