<?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_-_ANOVA</id>
	<title>R - ANOVA - 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_-_ANOVA"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=R_-_ANOVA&amp;action=history"/>
	<updated>2026-05-14T01:26:19Z</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_-_ANOVA&amp;diff=29337&amp;oldid=prev</id>
		<title>Bernard Szlachta at 09:56, 6 March 2016</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=R_-_ANOVA&amp;diff=29337&amp;oldid=prev"/>
		<updated>2016-03-06T09:56:34Z</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]]&lt;br /&gt;
== Single Factor ANOVA ==&lt;br /&gt;
&lt;br /&gt;
Is there a difference in language proficiency (LP) as a function of number of hours of weekly practice?&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 lp &amp;lt;- read.table(&amp;quot;http://training-course-material.com/images/0/0a/Anova-signlefactor.txt&amp;quot;,h=T)&lt;br /&gt;
 lp&lt;br /&gt;
&lt;br /&gt;
 summary(lp)&lt;br /&gt;
&lt;br /&gt;
 # Calculate the standard deviation for each column&lt;br /&gt;
 sapply(lp,sd)&lt;br /&gt;
 &lt;br /&gt;
 # Changes the format to a factor column&lt;br /&gt;
 slp &amp;lt;- stack(lp)&lt;br /&gt;
&lt;br /&gt;
 names(slp) &amp;lt;- c(&amp;quot;Test.Result&amp;quot;,&amp;quot;HoursWeeklyPractise&amp;quot;)&lt;br /&gt;
 # Create a model&lt;br /&gt;
 m &amp;lt;- aov(slp$Test.Result ~ slp$HoursWeeklyPractise)&lt;br /&gt;
 m&lt;br /&gt;
&lt;br /&gt;
 # Validate the model&lt;br /&gt;
 summary(m)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Two Factors with Replication ==&lt;br /&gt;
Is there a difference in satisfaction level (SAT) over four training sessions (training-Quarter 1 or TQ1, etc.) for 20 unemployed men and women undergoing quarterly training?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 sat &amp;lt;- read.table(&amp;quot;http://training-course-material.com/images/e/ed/Anova-twofactors.txt&amp;quot;,&lt;br /&gt;
                 h=T, fill=T, row.names=NULL)&lt;br /&gt;
 names(sat) &amp;lt;- c(&amp;quot;Gender&amp;quot;,&amp;quot;TQ1&amp;quot;,&amp;quot;TQ2&amp;quot;,&amp;quot;TQ3&amp;quot;,&amp;quot;TQ4&amp;quot;)&lt;br /&gt;
 sat&lt;br /&gt;
 attach(sat)&lt;br /&gt;
 str(sat)&lt;br /&gt;
 s &amp;lt;- data.frame()&lt;br /&gt;
 s &amp;lt;- rbind(s,cbind(Gender,Sat=TQ1,Quarter=&amp;quot;1&amp;quot;))&lt;br /&gt;
 s &amp;lt;- rbind(s,cbind(Gender,Sat=TQ2,Quarter=&amp;quot;2&amp;quot;))&lt;br /&gt;
 s &amp;lt;- rbind(s,cbind(Gender,Sat=TQ3,Quarter=&amp;quot;3&amp;quot;))&lt;br /&gt;
 s &amp;lt;- rbind(s,cbind(Gender,Sat=TQ4,Quarter=&amp;quot;4&amp;quot;))&lt;br /&gt;
 detach(sat)&lt;br /&gt;
 rm(sat)&lt;br /&gt;
 s&lt;br /&gt;
 s$Gender &amp;lt;- as.factor(s$Gender)&lt;br /&gt;
 s$Quarter &amp;lt;- as.factor(s$Quarter)&lt;br /&gt;
 s$Sat &amp;lt;- as.integer(s$Sat) &lt;br /&gt;
&lt;br /&gt;
 attach(s)&lt;br /&gt;
 str(s)&lt;br /&gt;
 m &amp;lt;- aov(Sat ~ Gender * Quarter)&lt;br /&gt;
 summary(m)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Without Replication ==&lt;br /&gt;
 sat &amp;lt;- read.table(skip=1,h=T, fill=T, row.names=NULL,na.strings=&amp;quot; &amp;quot;,sep=&amp;quot;\t&amp;quot;,&lt;br /&gt;
                  file=    &amp;quot;http://training-course-material.com/images/0/0a/Anova-two-factors-without-replications.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 sat&lt;br /&gt;
 summary(sat)&lt;br /&gt;
 s &amp;lt;- data.frame()&lt;br /&gt;
 s &amp;lt;- rbind(s,cbind(Party=&amp;quot;Tory&amp;quot;,Sat=sat[1:10,c(&amp;quot;Urban&amp;quot;)],Area=&amp;quot;Urban&amp;quot;))&lt;br /&gt;
 s &amp;lt;- rbind(s,cbind(Party=&amp;quot;Tory&amp;quot;,Sat=sat[1:10,c(&amp;quot;Rural&amp;quot;)],Area=&amp;quot;Rural&amp;quot;))&lt;br /&gt;
 &lt;br /&gt;
 s &amp;lt;- rbind(s,cbind(Party=&amp;quot;Labour&amp;quot;,Sat=sat[11:20,c(&amp;quot;Urban&amp;quot;)],Area=&amp;quot;Urban&amp;quot;))&lt;br /&gt;
 s &amp;lt;- rbind(s,cbind(Party=&amp;quot;Labour&amp;quot;,Sat=sat[11:20,c(&amp;quot;Rural&amp;quot;)],Area=&amp;quot;Rural&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
 s&lt;br /&gt;
&lt;br /&gt;
 s$Party &amp;lt;- as.factor(s$Party)&lt;br /&gt;
 s$Area &amp;lt;- as.factor(s$Area)&lt;br /&gt;
 s$Sat &amp;lt;- as.integer(s$Sat) &lt;br /&gt;
&lt;br /&gt;
 attach(s)&lt;br /&gt;
 str(s)&lt;br /&gt;
 plot(s)&lt;br /&gt;
 m &amp;lt;- aov(Sat ~ Party + Area)&lt;br /&gt;
 summary(m)&lt;/div&gt;</summary>
		<author><name>Bernard Szlachta</name></author>
	</entry>
</feed>