{"id":2,"date":"2014-08-12T22:38:48","date_gmt":"2014-08-12T22:38:48","guid":{"rendered":"https:\/\/blogs.ubc.ca\/wtamagi\/?page_id=2"},"modified":"2014-09-15T17:06:15","modified_gmt":"2014-09-16T00:06:15","slug":"sample-page","status":"publish","type":"page","link":"https:\/\/blogs.ubc.ca\/wtamagi\/sample-page\/","title":{"rendered":"R &#8211; Statistics"},"content":{"rendered":"<p>September 15, 2014<\/p>\n<p><a href=\"https:\/\/blogs.ubc.ca\/wtamagi\/files\/2014\/08\/d.txt\">d<\/a> linear regression data set<\/p>\n<p>September 12, 2014<\/p>\n<p><a href=\"https:\/\/blogs.ubc.ca\/wtamagi\/files\/2014\/08\/examples2.docx\">examples2<\/a><\/p>\n<p>How to Run Anova Test and Tukey&#8217;s honest significant difference test (instead of Fisher&#8217;s) using R Stat<\/p>\n<p>&gt; x &lt;- read.table(&#8220;h:\\\\rdata\\\\c.txt&#8221;,sep=&#8221; &#8220;,header=T)<\/p>\n<p>Note: The &#8220;h:\\\\&#8230;&#8221; is the location of your file on your computer.\u00a0 For Windows computers, locate your file and right click on it, select Properties and you will find the location information.\u00a0 For each backslash use two backslashes.<\/p>\n<p>On a Mac computer, locate your file and press apple key &#8211; i to get the location.\u00a0 For macs it will be something like \/users\/user\/c.txt.\u00a0 Therefore for the location use \/\/ for the forward slash like this &#8220;\/\/users\/\/user\/\/c.txt&#8221;.<br \/>\n&gt; x<br \/>\nMethodA MethodB MethodC<br \/>\n1\u00a0\u00a0\u00a0 32.2\u00a0\u00a0\u00a0 35.0\u00a0\u00a0\u00a0 34.5<br \/>\n2\u00a0\u00a0\u00a0 37.4\u00a0\u00a0\u00a0 31.2\u00a0\u00a0\u00a0 38.9<br \/>\n3\u00a0\u00a0\u00a0 35.9\u00a0\u00a0\u00a0 29.3\u00a0\u00a0\u00a0 32.5<br \/>\n4\u00a0\u00a0\u00a0 28.1\u00a0\u00a0\u00a0 28.4\u00a0\u00a0\u00a0 33.3<br \/>\n5\u00a0\u00a0\u00a0 41.0\u00a0\u00a0\u00a0 34.1\u00a0\u00a0\u00a0 45.8<br \/>\n6\u00a0\u00a0\u00a0 44.5\u00a0\u00a0\u00a0 38.1\u00a0\u00a0\u00a0 48.9<br \/>\n7\u00a0\u00a0\u00a0 35.6\u00a0\u00a0\u00a0 32.6\u00a0\u00a0\u00a0 41.1<br \/>\n8\u00a0\u00a0\u00a0 31.2\u00a0\u00a0\u00a0 31.5\u00a0\u00a0\u00a0 37.6<br \/>\n9\u00a0\u00a0\u00a0 34.8\u00a0\u00a0\u00a0 27.7\u00a0\u00a0\u00a0 45.7<\/p>\n<p>&gt; Material = c(x[[1]])<br \/>\n&gt; Material<br \/>\n[1] 32.2 37.4 35.9 28.1 41.0 44.5 35.6 31.2 34.8<br \/>\n&gt; Material = c(x[[1]],x[[2]],x[[3]])<br \/>\n&gt; Material<br \/>\n[1] 32.2 37.4 35.9 28.1 41.0 44.5 35.6 31.2 34.8 35.0 31.2 29.3 28.4 34.1 38.1<br \/>\n[16] 32.6 31.5 27.7 34.5 38.9 32.5 33.3 45.8 48.9 41.1 37.6 45.7<br \/>\n&gt; Method = c(rep(&#8220;MethodA&#8221;,9),rep(&#8220;MethodB&#8221;,9),rep(&#8220;MethodC&#8221;,9))<br \/>\n&gt; mdata = data.frame(Method,Material)<br \/>\n&gt; mdata<br \/>\nMethod Material<br \/>\n1\u00a0 MethodA\u00a0\u00a0\u00a0\u00a0 32.2<br \/>\n2\u00a0 MethodA\u00a0\u00a0\u00a0\u00a0 37.4<br \/>\n3\u00a0 MethodA\u00a0\u00a0\u00a0\u00a0 35.9<br \/>\n4\u00a0 MethodA\u00a0\u00a0\u00a0\u00a0 28.1<br \/>\n5\u00a0 MethodA\u00a0\u00a0\u00a0\u00a0 41.0<br \/>\n6\u00a0 MethodA\u00a0\u00a0\u00a0\u00a0 44.5<br \/>\n7\u00a0 MethodA\u00a0\u00a0\u00a0\u00a0 35.6<br \/>\n8\u00a0 MethodA\u00a0\u00a0\u00a0\u00a0 31.2<br \/>\n9\u00a0 MethodA\u00a0\u00a0\u00a0\u00a0 34.8<br \/>\n10 MethodB\u00a0\u00a0\u00a0\u00a0 35.0<br \/>\n11 MethodB\u00a0\u00a0\u00a0\u00a0 31.2<br \/>\n12 MethodB\u00a0\u00a0\u00a0\u00a0 29.3<br \/>\n13 MethodB\u00a0\u00a0\u00a0\u00a0 28.4<br \/>\n14 MethodB\u00a0\u00a0\u00a0\u00a0 34.1<br \/>\n15 MethodB\u00a0\u00a0\u00a0\u00a0 38.1<br \/>\n16 MethodB\u00a0\u00a0\u00a0\u00a0 32.6<br \/>\n17 MethodB\u00a0\u00a0\u00a0\u00a0 31.5<br \/>\n18 MethodB\u00a0\u00a0\u00a0\u00a0 27.7<br \/>\n19 MethodC\u00a0\u00a0\u00a0\u00a0 34.5<br \/>\n20 MethodC\u00a0\u00a0\u00a0\u00a0 38.9<br \/>\n21 MethodC\u00a0\u00a0\u00a0\u00a0 32.5<br \/>\n22 MethodC\u00a0\u00a0\u00a0\u00a0 33.3<br \/>\n23 MethodC\u00a0\u00a0\u00a0\u00a0 45.8<br \/>\n24 MethodC\u00a0\u00a0\u00a0\u00a0 48.9<br \/>\n25 MethodC\u00a0\u00a0\u00a0\u00a0 41.1<br \/>\n26 MethodC\u00a0\u00a0\u00a0\u00a0 37.6<br \/>\n27 MethodC\u00a0\u00a0\u00a0\u00a0 45.7<\/p>\n<p>This rearranges the data set so you should have 2 columns and 27 rows of data as seen. Each row is assigned a Method.\u00a0 For now we will call the data &#8220;Material&#8221; and this is the independent variable.\u00a0 The dependent variable is Method.<br \/>\n&gt; anovareport = aov(Material~Method,data=mdata)<\/p>\n<p>Please note!\u00a0 The ~ between Materal and Method is the tilda character!<br \/>\n&gt; summary(anovareport)<br \/>\nThis will print out the results from the Anova test.<\/p>\n<p>&gt; TukeyHSD(aov(lm(Material~Method),data=mdata),conf.level=0.95)<\/p>\n<p>Please note!\u00a0 The ~ between Materal and Method is the tilda character!<\/p>\n<p>This will print out the results from Tukey.\u00a0 This will show the different in means between the Methods, the 95% confidence interval and the P probability the mean difference is within the confidence interval.<br \/>\n&gt; summary(x)<\/p>\n<p>A summary of the x table.<br \/>\nSeptember 11, 2014<\/p>\n<p><a href=\"https:\/\/blogs.ubc.ca\/wtamagi\/files\/2014\/09\/examples.docx\">examples<\/a><\/p>\n<p><a href=\"https:\/\/blogs.ubc.ca\/wtamagi\/files\/2014\/09\/a.txt\">a data set<\/a><\/p>\n<p><a href=\"https:\/\/blogs.ubc.ca\/wtamagi\/files\/2014\/09\/c.txt\">c data set<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>September 15, 2014 d linear regression data set September 12, 2014 examples2 How to Run Anova Test and Tukey&#8217;s honest significant difference test (instead of Fisher&#8217;s) using R Stat &gt; x &lt;- read.table(&#8220;h:\\\\rdata\\\\c.txt&#8221;,sep=&#8221; &#8220;,header=T) Note: The &#8220;h:\\\\&#8230;&#8221; is the location of your file on your computer.\u00a0 For Windows computers, locate your file and right click [&hellip;]<\/p>\n","protected":false},"author":25150,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-2","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.ubc.ca\/wtamagi\/wp-json\/wp\/v2\/pages\/2","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ubc.ca\/wtamagi\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.ubc.ca\/wtamagi\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/wtamagi\/wp-json\/wp\/v2\/users\/25150"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/wtamagi\/wp-json\/wp\/v2\/comments?post=2"}],"version-history":[{"count":5,"href":"https:\/\/blogs.ubc.ca\/wtamagi\/wp-json\/wp\/v2\/pages\/2\/revisions"}],"predecessor-version":[{"id":13,"href":"https:\/\/blogs.ubc.ca\/wtamagi\/wp-json\/wp\/v2\/pages\/2\/revisions\/13"}],"wp:attachment":[{"href":"https:\/\/blogs.ubc.ca\/wtamagi\/wp-json\/wp\/v2\/media?parent=2"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}