<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.socr.umich.edu/index.php?action=history&amp;feed=atom&amp;title=Simple_Linear_Regression</id>
	<title>Simple Linear Regression - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.socr.umich.edu/index.php?action=history&amp;feed=atom&amp;title=Simple_Linear_Regression"/>
	<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=Simple_Linear_Regression&amp;action=history"/>
	<updated>2026-06-04T21:54:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.6</generator>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=Simple_Linear_Regression&amp;diff=2537&amp;oldid=prev</id>
		<title>IvoDinov at 05:46, 19 January 2007</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=Simple_Linear_Regression&amp;diff=2537&amp;oldid=prev"/>
		<updated>2007-01-19T05:46:47Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 05:46, 19 January 2007&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l103&quot; &gt;Line 103:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 103:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{translate|pageName=http://wiki.stat.ucla.edu/socr/index.php?title=Simple_Linear_Regression}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>IvoDinov</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=Simple_Linear_Regression&amp;diff=1829&amp;oldid=prev</id>
		<title>Annie at 21:04, 31 July 2006</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=Simple_Linear_Regression&amp;diff=1829&amp;oldid=prev"/>
		<updated>2006-07-31T21:04:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 21:04, 31 July 2006&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/*&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/*&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l101&quot; &gt;Line 101:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 102:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Annie</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=Simple_Linear_Regression&amp;diff=1828&amp;oldid=prev</id>
		<title>Annie at 21:03, 31 July 2006</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=Simple_Linear_Regression&amp;diff=1828&amp;oldid=prev"/>
		<updated>2006-07-31T21:03:33Z</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;/*&lt;br /&gt;
&lt;br /&gt;
July 2006. Annie Che &amp;lt;chea@stat.ucla.edu&amp;gt;. UCLA Statistics.&lt;br /&gt;
&lt;br /&gt;
Source of example data:&lt;br /&gt;
An Introduction to Computational Statitics by Robert I. Jennrich.&lt;br /&gt;
Page 5, example of regression on students' midterm and final scores.&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
package edu.ucla.stat.SOCR.analyses.example;&lt;br /&gt;
&lt;br /&gt;
import java.util.HashMap;&lt;br /&gt;
import edu.ucla.stat.SOCR.analyses.data.Data;&lt;br /&gt;
import edu.ucla.stat.SOCR.analyses.data.DataType;&lt;br /&gt;
import edu.ucla.stat.SOCR.analyses.result.SimpleLinearRegressionResult;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class SimpleLinearRegressionExample {&lt;br /&gt;
	public static void main(String args[]) {&lt;br /&gt;
		double[] midtermGrade =            &lt;br /&gt;
                {68,49,60,68,97,82,59,50,73,39,71,95,61,72,87,40,66,58,58,77};&lt;br /&gt;
		double[] finalGrade = &lt;br /&gt;
               {75,63,57,88,88,79,82,73,90,62,70,96,76,75,85,40,74,70,75,72};&lt;br /&gt;
&lt;br /&gt;
		// you'll need to instantiate a data instance first.&lt;br /&gt;
		Data data = new Data();&lt;br /&gt;
&lt;br /&gt;
		/*********************************************************************&lt;br /&gt;
		then put the data into the Data Object.&lt;br /&gt;
		append the predictor data using method &amp;quot;addPredictor&amp;quot;.&lt;br /&gt;
		append the response data using method &amp;quot;addResponse&amp;quot;.&lt;br /&gt;
		**********************************************************************/&lt;br /&gt;
&lt;br /&gt;
		data.addPredictor(midtermGrade, DataType.QUANTITATIVE);&lt;br /&gt;
		data.addResponse(finalGrade, DataType.QUANTITATIVE);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		try {&lt;br /&gt;
			SimpleLinearRegressionResult result = data.modelSimpleLinearRegression();&lt;br /&gt;
			if (result != null) {&lt;br /&gt;
&lt;br /&gt;
				// Getting the model's parameter estiamtes and statistics.&lt;br /&gt;
&lt;br /&gt;
				double alpha = result.getAlpha();&lt;br /&gt;
				double beta = result.getBeta();&lt;br /&gt;
&lt;br /&gt;
				double meanX = result.getMeanX();&lt;br /&gt;
				double meanY = result.getMeanY();&lt;br /&gt;
&lt;br /&gt;
				double seAlpha = result.getAlphaSE();&lt;br /&gt;
				double seBeta = result.getBetaSE();&lt;br /&gt;
				double tStatAlpha = result.getAlphaTStat();&lt;br /&gt;
				double tStatBeta = result.getBetaTStat();&lt;br /&gt;
&lt;br /&gt;
				/* to avoid cases such &amp;quot;p-value &amp;lt; 0.0001&amp;quot; sometimes generated&lt;br /&gt;
                                by R, String is used for p-values. */&lt;br /&gt;
&lt;br /&gt;
				String pvAlpha = result.getAlphaPValue();&lt;br /&gt;
				String pvBeta = result.getBetaPValue();&lt;br /&gt;
&lt;br /&gt;
				double[] predicted = result.getPredicted();&lt;br /&gt;
				double[] residuals = result.getResiduals();&lt;br /&gt;
&lt;br /&gt;
				// residuals after being sorted ascendantly.&lt;br /&gt;
				double[] sortedResiduals = result.getSortedResiduals();&lt;br /&gt;
&lt;br /&gt;
				// sortedResiduals after being standardized.&lt;br /&gt;
				double[] sortedStandardizedResiduals =  &lt;br /&gt;
                                         result.getSortedStandardizedResiduals();&lt;br /&gt;
&lt;br /&gt;
				// the original index of sortedResiduals, stored as integer array.&lt;br /&gt;
				int[] sortedResidualsIndex = result.getSortedResidualsIndex();&lt;br /&gt;
&lt;br /&gt;
				// the normal quantiles of sortedResiduals.&lt;br /&gt;
				double[] sortedNormalQuantiles = result.getSortedNormalQuantiles();&lt;br /&gt;
&lt;br /&gt;
	                			// sortedNormalQuantiles after being standardized.&lt;br /&gt;
				double[] sortedStandardizedNormalQuantiles = &lt;br /&gt;
                                         result.getSortedStandardizedNormalQuantiles();&lt;br /&gt;
&lt;br /&gt;
				System.out.println(&amp;quot;intercept = &amp;quot; + alpha);&lt;br /&gt;
				System.out.println(&amp;quot;slope = &amp;quot; + beta);&lt;br /&gt;
				System.out.println(&amp;quot;meanX = &amp;quot; + meanX);&lt;br /&gt;
				System.out.println(&amp;quot;meanY = &amp;quot; + meanY);&lt;br /&gt;
&lt;br /&gt;
				System.out.println(&amp;quot;seAlpha = &amp;quot; + seAlpha);&lt;br /&gt;
				System.out.println(&amp;quot;seBeta = &amp;quot; + seBeta);&lt;br /&gt;
				System.out.println(&amp;quot;tStatAlpha = &amp;quot; + tStatAlpha);&lt;br /&gt;
				System.out.println(&amp;quot;tStatBeta = &amp;quot; + tStatBeta);&lt;br /&gt;
&lt;br /&gt;
				System.out.println(&amp;quot;pvAlpha = &amp;quot; + pvAlpha);&lt;br /&gt;
				System.out.println(&amp;quot;pvBeta = &amp;quot; + pvBeta);&lt;br /&gt;
				for (int i = 0; i &amp;lt; residuals.length; i++) {&lt;br /&gt;
					System.out.println(&amp;quot;residuals[&amp;quot;+i+&amp;quot;] = &amp;quot; + residuals[i]);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
			}&lt;br /&gt;
		} catch (Exception e) {&lt;br /&gt;
			System.out.println(e);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Annie</name></author>
		
	</entry>
</feed>