<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>statMethods blog</title>
	<atom:link href="http://statmethods.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://statmethods.wordpress.com</link>
	<description>A Quick-R Companion</description>
	<lastBuildDate>Sun, 19 Feb 2012 04:22:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='statmethods.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>statMethods blog</title>
		<link>http://statmethods.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://statmethods.wordpress.com/osd.xml" title="statMethods blog" />
	<atom:link rel='hub' href='http://statmethods.wordpress.com/?pushpress=hub'/>
		<item>
		<title>R Training Course in the Bay Area</title>
		<link>http://statmethods.wordpress.com/2012/02/01/r-training-course-in-the-bay-area/</link>
		<comments>http://statmethods.wordpress.com/2012/02/01/r-training-course-in-the-bay-area/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 15:11:36 +0000</pubDate>
		<dc:creator>Rob Kabacoff</dc:creator>
				<category><![CDATA[R Programming]]></category>

		<guid isPermaLink="false">http://statmethods.wordpress.com/?p=330</guid>
		<description><![CDATA[An introduction to R for sofware developers and data analysts Saturday March 10th, 2012 8:30-5:00pm EBay 2161 North 1st Street San Jose, California I will be presenting a one day professional development workshop on R programming for software developers and &#8230; <a href="http://statmethods.wordpress.com/2012/02/01/r-training-course-in-the-bay-area/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=statmethods.wordpress.com&amp;blog=17404507&amp;post=330&amp;subd=statmethods&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://statmethods.files.wordpress.com/2012/02/sf.jpg"><img class="alignleft size-full wp-image-331" title="San Francisco" src="http://statmethods.files.wordpress.com/2012/02/sf.jpg?w=640" alt="San Francisco"   /></a><strong>An introduction to R for sofware developers and data analysts</strong><br />
Saturday March 10th, 2012<br />
8:30-5:00pm<br />
EBay<br />
2161 North 1st Street<br />
San Jose, California</p>
<p>I will be presenting a one day professional development workshop on R programming for software developers and data scientists, sponsored by the ACM San Francisco Bay Area Professional Chapter and Revolution Analytics.</p>
<p>Details are available at <a href="http://www.sfbayacm.org/event/introduction-r-software-developers-and-data-analysts">http://www.sfbayacm.org/event/introduction-r-software-developers-and-data-analysts</a>. I am very excited about this opportunity and will provide more information as the date approaches.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/statmethods.wordpress.com/330/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/statmethods.wordpress.com/330/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/statmethods.wordpress.com/330/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/statmethods.wordpress.com/330/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/statmethods.wordpress.com/330/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/statmethods.wordpress.com/330/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/statmethods.wordpress.com/330/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/statmethods.wordpress.com/330/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/statmethods.wordpress.com/330/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/statmethods.wordpress.com/330/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/statmethods.wordpress.com/330/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/statmethods.wordpress.com/330/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/statmethods.wordpress.com/330/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/statmethods.wordpress.com/330/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=statmethods.wordpress.com&amp;blog=17404507&amp;post=330&amp;subd=statmethods&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://statmethods.wordpress.com/2012/02/01/r-training-course-in-the-bay-area/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://statmethods.files.wordpress.com/2012/02/sf.jpg?w=150" />
		<media:content url="http://statmethods.files.wordpress.com/2012/02/sf.jpg?w=150" medium="image">
			<media:title type="html">San Francisco</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/e1f6033ca70ad293ebdec6891f1b69f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akismet-e1f6033ca70ad293ebdec6891f1b69f1</media:title>
		</media:content>

		<media:content url="http://statmethods.files.wordpress.com/2012/02/sf.jpg" medium="image">
			<media:title type="html">San Francisco</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting Fancy with 3-D Scatterplots</title>
		<link>http://statmethods.wordpress.com/2012/01/30/getting-fancy-with-3-d-scatterplots/</link>
		<comments>http://statmethods.wordpress.com/2012/01/30/getting-fancy-with-3-d-scatterplots/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 19:28:29 +0000</pubDate>
		<dc:creator>Rob Kabacoff</dc:creator>
				<category><![CDATA[R Programming]]></category>

		<guid isPermaLink="false">http://statmethods.wordpress.com/?p=217</guid>
		<description><![CDATA[R has some great functions for generating scatterplots in 3 dimensions. Two of the best are the scatter3d() function in John Fox&#8217;s car package, and the scatterplot3d() function in Uwe Ligges&#8217; scatterplot3d package. In this post, we will focus on &#8230; <a href="http://statmethods.wordpress.com/2012/01/30/getting-fancy-with-3-d-scatterplots/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=statmethods.wordpress.com&amp;blog=17404507&amp;post=217&amp;subd=statmethods&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>R </strong>has some great functions for generating scatterplots in 3 dimensions. Two of the best are the scatter3d() function in John Fox&#8217;s car package, and the scatterplot3d() function in Uwe Ligges&#8217; scatterplot3d package. In this post, we will focus on the later.</p>
<p>Let&#8217;s say that we want to plot automobile mileage vs. engine displacement vs. car weight using the data in the mtcars dataframe.</p>
<p><pre class="brush: r;">
library(scatterplot3d)
with(mtcars, {
   scatterplot3d(disp,   # x axis
                 wt,     # y axis
                 mpg,    # z axis
                 main=&quot;3-D Scatterplot Example 1&quot;)
})
</pre></p>
<p>The resulting plot is given below.<br />
<a href="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex12.jpeg"><img class="size-medium wp-image-248 alignnone" title="3-D Scatterplot Example 1" src="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex12.jpeg?w=300&#038;h=300" alt="3-D Scatterplot Example 1" width="300" height="300" /></a></p>
<p>Now lets, modify the graph by replacing the points with filled blue circles, add drop lines to the x-y plane, and create more meaningful labels.</p>
<p><pre class="brush: r;">
library(scatterplot3d)
with(mtcars, {
   scatterplot3d(disp, wt, mpg,        # x y and z axis
                 color=&quot;blue&quot;, pch=19, # filled blue circles
                 type=&quot;h&quot;,             # lines to the horizontal plane
                 main=&quot;3-D Scatterplot Example 2&quot;,
                 xlab=&quot;Displacement (cu. in.)&quot;,
                 ylab=&quot;Weight (lb/1000)&quot;,
                 zlab=&quot;Miles/(US) Gallon&quot;)
})
</pre></p>
<p><a href="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex2.jpeg"><img class="alignnone size-medium wp-image-267" title="3-D Scatterplot Example 2" src="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex2.jpeg?w=300&#038;h=300" alt="3-D Scatterplot Example 2" width="300" height="300" /></a></p>
<p>Next, let&#8217;s label the points. We can do this by saving the results of the scatterplot3d() function to an object, using the xyz.convert() function to convert coordinates from 3D (x, y, z) to 2D-projections (x, y), and apply the text() function to add labels to the graph.</p>
<p><pre class="brush: r;">
library(scatterplot3d)
with(mtcars, {
   s3d &lt;- scatterplot3d(disp, wt, mpg,        # x y and z axis
                 color=&quot;blue&quot;, pch=19,        # filled blue circles
                 type=&quot;h&quot;,                    # vertical lines to the x-y plane
                 main=&quot;3-D Scatterplot Example 3&quot;,
                 xlab=&quot;Displacement (cu. in.)&quot;,
                 ylab=&quot;Weight (lb/1000)&quot;,
                 zlab=&quot;Miles/(US) Gallon&quot;)
    s3d.coords &lt;- s3d$xyz.convert(disp, wt, mpg) # convert 3D coords to 2D projection
    text(s3d.coords$x, s3d.coords$y,             # x and y coordinates
         labels=row.names(mtcars),               # text to plot
         cex=.5, pos=4)           # shrink text 50% and place to right of points)
})
</pre></p>
<p><a href="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex3.jpeg"><img class="alignnone size-medium wp-image-279" title="3-D Scatterplot Example 3" src="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex3.jpeg?w=300&#038;h=300" alt="3-D Scatterplot Example 3" width="300" height="300" /></a></p>
<p>Almost there. As a final step, we will add information on the number of cylinders each car has. To do this, we will add a column to the mtcars dataframe indicating the color for each point. For good measure, we will shorten the y axis, change the drop lines to dashed lines, and add a legend.</p>
<p><pre class="brush: r;">
library(scatterplot3d)
# create column indicating point color
mtcars$pcolor[mtcars$cyl==4] &lt;- &quot;red&quot;
mtcars$pcolor[mtcars$cyl==6] &lt;- &quot;blue&quot;
mtcars$pcolor[mtcars$cyl==8] &lt;- &quot;darkgreen&quot;
with(mtcars, {
    s3d &lt;- scatterplot3d(disp, wt, mpg,        # x y and z axis
                  color=pcolor, pch=19,        # circle color indicates no. of cylinders
                  type=&quot;h&quot;, lty.hplot=2,       # lines to the horizontal plane
                  scale.y=.75,                 # scale y axis (reduce by 25%)
                  main=&quot;3-D Scatterplot Example 4&quot;,
                  xlab=&quot;Displacement (cu. in.)&quot;,
                  ylab=&quot;Weight (lb/1000)&quot;,
                  zlab=&quot;Miles/(US) Gallon&quot;)
     s3d.coords &lt;- s3d$xyz.convert(disp, wt, mpg)
     text(s3d.coords$x, s3d.coords$y,     # x and y coordinates
          labels=row.names(mtcars),       # text to plot
          pos=4, cex=.5)                  # shrink text 50% and place to right of points)
# add the legend
legend(&quot;topleft&quot;, inset=.05,      # location and inset
    bty=&quot;n&quot;, cex=.5,              # suppress legend box, shrink text 50%
    title=&quot;Number of Cylinders&quot;,
    c(&quot;4&quot;, &quot;6&quot;, &quot;8&quot;), fill=c(&quot;red&quot;, &quot;blue&quot;, &quot;darkgreen&quot;))
})
</pre><br />
<a href="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex42.jpeg"><img src="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex42.jpeg?w=300&#038;h=300" alt="3-D Scatterplot Example 4" title="3-D Scatterplot Example 4" width="300" height="300" class="alignnone size-medium wp-image-305" /></a></p>
<p>One of <strong>R</strong>&#8216;s most attractive features is that it allows us to manipulate output and deeply customize graphs. This article has just touched the surface. Since colors and text labels can be input as vectors, you could programmatically use them to represent almost anything. For example, point colors and/or labels could be used to highlight observations that are outliers, have high leverage, or are unusual in some other way. Simply create a vector that has colors or labels for notable observations and missing (NA) values otherwise.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/statmethods.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/statmethods.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/statmethods.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/statmethods.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/statmethods.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/statmethods.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/statmethods.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/statmethods.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/statmethods.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/statmethods.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/statmethods.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/statmethods.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/statmethods.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/statmethods.wordpress.com/217/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=statmethods.wordpress.com&amp;blog=17404507&amp;post=217&amp;subd=statmethods&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://statmethods.wordpress.com/2012/01/30/getting-fancy-with-3-d-scatterplots/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:thumbnail url="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex42.jpeg?w=150" />
		<media:content url="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex42.jpeg?w=150" medium="image">
			<media:title type="html">3-D Scatterplot Example 4</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/e1f6033ca70ad293ebdec6891f1b69f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akismet-e1f6033ca70ad293ebdec6891f1b69f1</media:title>
		</media:content>

		<media:content url="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex12.jpeg?w=300" medium="image">
			<media:title type="html">3-D Scatterplot Example 1</media:title>
		</media:content>

		<media:content url="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex2.jpeg?w=300" medium="image">
			<media:title type="html">3-D Scatterplot Example 2</media:title>
		</media:content>

		<media:content url="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex3.jpeg?w=300" medium="image">
			<media:title type="html">3-D Scatterplot Example 3</media:title>
		</media:content>

		<media:content url="http://statmethods.files.wordpress.com/2012/01/3dscatter-ex42.jpeg?w=300" medium="image">
			<media:title type="html">3-D Scatterplot Example 4</media:title>
		</media:content>
	</item>
		<item>
		<title>Staying up with R</title>
		<link>http://statmethods.wordpress.com/2012/01/14/staying-up-with-r/</link>
		<comments>http://statmethods.wordpress.com/2012/01/14/staying-up-with-r/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 04:06:56 +0000</pubDate>
		<dc:creator>Rob Kabacoff</dc:creator>
				<category><![CDATA[R Programming]]></category>

		<guid isPermaLink="false">http://statmethods.wordpress.com/?p=175</guid>
		<description><![CDATA[No, I don&#8217;t mean late night coding. R is constantly changing &#8211; both as a language and a platform. Updates containing new functionality are frequent. New and revised packages appear several times a week.  Staying current with these myriad changes can &#8230; <a href="http://statmethods.wordpress.com/2012/01/14/staying-up-with-r/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=statmethods.wordpress.com&amp;blog=17404507&amp;post=175&amp;subd=statmethods&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://statmethods.files.wordpress.com/2012/01/directions.jpg"><img class="alignleft  wp-image-176" title="Signpost of Time" src="http://statmethods.files.wordpress.com/2012/01/directions.jpg?w=192&#038;h=240" alt="" width="192" height="240" /></a>No, I don&#8217;t mean late night coding. R is constantly changing &#8211; both as a language and a platform. Updates containing new functionality are frequent. New and revised packages appear several times a week.  Staying current with these myriad changes can be a challenge.</p>
<p>In this post, I thought that I would share some of the online resources that I have found to be most useful for keeping current with what is happening in world of R.</p>
<p>Of course the <strong>R project homepage</strong> (<a href="http://www.r-project.org" target="_blank">www.r-project.org</a>) and the <strong>Comprehensive R Archive Network</strong> (CRAN; <a href="http://cran.r-project.org" target="_blank">cran.r-project.org</a>) are  your first stops for all things R.</p>
<p><strong>CRANberries</strong> (<a href="http://dirk.eddelbuettel.com/cranberries/" target="_blank">dirk.eddelbuettel.com/cranberries/</a>) is a site that aggregates information about new and updated packages, and contains links to CRAN for each.</p>
<p><strong>Planet R</strong> (<a href="http://planetr.stderr.org" target="_blank">planetr.stderr.org</a>) is a great site aggregor, and includes information from a wide range of sources (including CRANberries). This is my first stop for staying up on new packages.</p>
<p><strong>R Bloggers</strong> (<a href="http://www.r-bloggers.com" target="_blank">www.r-bloggers.com</a>)  is a central hub (blog aggregator) for collecting content from bloggers writing about R. It contains several new articles each day and I am addicted to it. It is a great place to learn new analytic and programming techniques.</p>
<p><strong>The R Journal</strong> (<a href="http://journal.r-project.org" target="_blank">journal.r-project.org</a>) is a freely accessible refereed journal containing articles on the R project and contributed packages. This is a great way to gain deeper insight into what specific packages can do.</p>
<p><strong>The Journal of Statistical Software</strong> (<a href="http://www.jstatsoft.org" target="_blank">www.jstatsoft.org</a>) is also a freely accessbile refereed journal and contains articles, book reviews, and code snippets on statistical computing topics. There are frequent articles about R.</p>
<p>Finally, <strong>R-Help</strong>, the main R mailing list (<a href="https://stat.ethz.ch/mailman/listinfo/r-help" target="_blank">stat.ethz.ch/mailman/listinfo/r-help</a>), is the best place to ask questions about R. Be sure to read the FAQ before posting or you may get flamed by veteran programmers. The archives are searchable and contain a wealth of information.</p>
<p>These are my favorites &#8211; the ones I go back to again and again. What are yours?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/statmethods.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/statmethods.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/statmethods.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/statmethods.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/statmethods.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/statmethods.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/statmethods.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/statmethods.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/statmethods.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/statmethods.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/statmethods.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/statmethods.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/statmethods.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/statmethods.wordpress.com/175/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=statmethods.wordpress.com&amp;blog=17404507&amp;post=175&amp;subd=statmethods&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://statmethods.wordpress.com/2012/01/14/staying-up-with-r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e1f6033ca70ad293ebdec6891f1b69f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akismet-e1f6033ca70ad293ebdec6891f1b69f1</media:title>
		</media:content>

		<media:content url="http://statmethods.files.wordpress.com/2012/01/directions.jpg" medium="image">
			<media:title type="html">Signpost of Time</media:title>
		</media:content>
	</item>
		<item>
		<title>Easy cell statistics for factorial designs</title>
		<link>http://statmethods.wordpress.com/2011/12/02/easy-cell-statistics-for-factorial-designs/</link>
		<comments>http://statmethods.wordpress.com/2011/12/02/easy-cell-statistics-for-factorial-designs/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 20:10:19 +0000</pubDate>
		<dc:creator>Rob Kabacoff</dc:creator>
				<category><![CDATA[R Programming]]></category>

		<guid isPermaLink="false">http://statmethods.wordpress.com/?p=99</guid>
		<description><![CDATA[A common task when analyzing multi-group designs is obtaining descriptive statistics for various cells and cell combinations. There are many functions that can help you accomplish this, including aggregate() and by() in the base installation, summaryBy() in the doBy package, and &#8230; <a href="http://statmethods.wordpress.com/2011/12/02/easy-cell-statistics-for-factorial-designs/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=statmethods.wordpress.com&amp;blog=17404507&amp;post=99&amp;subd=statmethods&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A common task when analyzing multi-group designs is obtaining descriptive statistics for various cells and cell combinations.</p>
<p>There are many functions that can help you accomplish this, including <strong>aggregate()</strong> and<strong> by()</strong> in the base installation, <strong>summaryBy()</strong> in the <em>doBy</em> package, and <strong>describe.by()</strong> in the <em>psych</em> package. However, I find it easiest to use the <strong>melt()</strong> and <strong>cast()</strong> functions in the <em>reshape</em> package.</p>
<p>As an example, consider the <em>mtcars</em> dataframe (included in the base installation) containing road test information on automobiles assessed in 1974. Suppose that you want to obtain the means, standard deviations, and sample sizes for the variables miles per gallon (mpg), horsepower (hp), and weight (wt). You want these statistics for all cars in the dataset, separately by transmission type (am) and number of gears (gear), and for the cells formed by crossing these two variables.</p>
<p>You can accomplish this with the following code:</p>
<p><pre class="brush: r;">
options(digits = 3)
library(reshape)

# define and name the statistics of interest
stats &lt;- function(x)(c(N = length(x), Mean = mean(x), SD = sd(x)))

# label the levels of the classification variables (optional)
mtcars$am   &lt;- factor(mtcars$am, levels = c(0, 1), labels = c(&quot;Automatic&quot;, &quot;Manual&quot;))
mtcars$gear &lt;- factor(mtcars$gear, levels = c(3, 4, 5),
                      labels = c(&quot;3-Cyl&quot;, &quot;4-Cyl&quot;, &quot;5-Cyl&quot;))

# melt the dataset
dfm   &lt;- melt(mtcars,
              # outcome variables
              measure.vars = c(&quot;mpg&quot;, &quot;hp&quot;, &quot;wt&quot;),
              # classification variables
              id.vars = c(&quot;am&quot;, &quot;gear&quot;))

# statistics for the entire sample
cast(dfm, variable ~ ., stats)

# statistics for cells defined by transmission type
cast(dfm, am + variable ~ ., stats)

# statistics for cells defined by number of gears
cast(dfm, gear + variable ~ ., stats)

# statistics for cells defined by each am x gear combination
cast(dfm, am + gear + variable ~ ., stats)
</pre></p>
<p>The output is given below:</p>
<pre>  variable  N   Mean     SD
1      mpg 32  20.09  6.027
2       hp 32 146.69 68.563
3       wt 32   3.22  0.978

         am variable  N   Mean     SD
1 Automatic      mpg 19  17.15  3.834
2 Automatic       hp 19 160.26 53.908
3 Automatic       wt 19   3.77  0.777
4    Manual      mpg 13  24.39  6.167
5    Manual       hp 13 126.85 84.062
6    Manual       wt 13   2.41  0.617

  gear  variable  N   Mean      SD

1 3-Cyl      mpg 15  16.11   3.372
2 3-Cyl       hp 15 176.13  47.689
3 3-Cyl       wt 15   3.89   0.833
4 4-Cyl      mpg 12  24.53   5.277
5 4-Cyl       hp 12  89.50  25.893
6 4-Cyl       wt 12   2.62   0.633
7 5-Cyl      mpg  5  21.38   6.659
8 5-Cyl       hp  5 195.60 102.834
9 5-Cyl       wt  5   2.63   0.819

          am  gear variable  N   Mean      SD
1  Automatic 3-Cyl      mpg 15  16.11   3.372
2  Automatic 3-Cyl       hp 15 176.13  47.689
3  Automatic 3-Cyl       wt 15   3.89   0.833
4  Automatic 4-Cyl      mpg  4  21.05   3.070
5  Automatic 4-Cyl       hp  4 100.75  29.010
6  Automatic 4-Cyl       wt  4   3.30   0.157
7     Manual 4-Cyl      mpg  8  26.27   5.414
8     Manual 4-Cyl       hp  8  83.88  24.175
9     Manual 4-Cyl       wt  8   2.27   0.461
10    Manual 5-Cyl      mpg  5  21.38   6.659
11    Manual 5-Cyl       hp  5 195.60 102.834
12    Manual 5-Cyl       wt  5   2.63   0.819</pre>
<p>The approach is easily generalized to any number of grouping variables (factors), dependent/outcome variables, and statistics, and gives you a powerful tool for slicing and dicing data.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/statmethods.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/statmethods.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/statmethods.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/statmethods.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/statmethods.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/statmethods.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/statmethods.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/statmethods.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/statmethods.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/statmethods.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/statmethods.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/statmethods.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/statmethods.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/statmethods.wordpress.com/99/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=statmethods.wordpress.com&amp;blog=17404507&amp;post=99&amp;subd=statmethods&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://statmethods.wordpress.com/2011/12/02/easy-cell-statistics-for-factorial-designs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e1f6033ca70ad293ebdec6891f1b69f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akismet-e1f6033ca70ad293ebdec6891f1b69f1</media:title>
		</media:content>
	</item>
		<item>
		<title>Quick-R Gets a Blog</title>
		<link>http://statmethods.wordpress.com/2011/11/21/quick-r-gets-a-blog/</link>
		<comments>http://statmethods.wordpress.com/2011/11/21/quick-r-gets-a-blog/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 14:01:15 +0000</pubDate>
		<dc:creator>Rob Kabacoff</dc:creator>
				<category><![CDATA[R Programming]]></category>

		<guid isPermaLink="false">http://statmethods.wordpress.com/?p=83</guid>
		<description><![CDATA[After maintaining the  Quick-R website (R tutorials and jumpstart) for the past 5 years, I&#8217;ve decided to add a blog so that I can go into more detail on topics related to practical data analysis. The statMethods blog will contain articles &#8230; <a href="http://statmethods.wordpress.com/2011/11/21/quick-r-gets-a-blog/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=statmethods.wordpress.com&amp;blog=17404507&amp;post=83&amp;subd=statmethods&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.statmethods.net"><img class="alignleft size-full wp-image-84" title="Quick-R" src="http://statmethods.files.wordpress.com/2011/11/quick-r.png?w=640" alt=""   /></a>After maintaining the  <a title="Quick-R" href="http://www.statmethods.net">Quick-R</a> website (R tutorials and jumpstart) for the past 5 years, I&#8217;ve decided to add a blog so that I can go into more detail on topics related to practical data analysis.</p>
<p>The <a title="Statmethods Blog" href="http://statmethods.wordpress.com">statMethods </a>blog will contain articles about data analysis, statistics, and graphics, with an emphasis on the R language.</p>
<p>Of course, I&#8217;ll continue to maintain Quick-R, and hope that you find this addition resource useful. Let me know if there are topics that you would like to hear about.</p>
<p>- Rob Kabacoff</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/statmethods.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/statmethods.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/statmethods.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/statmethods.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/statmethods.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/statmethods.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/statmethods.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/statmethods.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/statmethods.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/statmethods.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/statmethods.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/statmethods.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/statmethods.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/statmethods.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=statmethods.wordpress.com&amp;blog=17404507&amp;post=83&amp;subd=statmethods&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://statmethods.wordpress.com/2011/11/21/quick-r-gets-a-blog/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e1f6033ca70ad293ebdec6891f1b69f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akismet-e1f6033ca70ad293ebdec6891f1b69f1</media:title>
		</media:content>

		<media:content url="http://statmethods.files.wordpress.com/2011/11/quick-r.png" medium="image">
			<media:title type="html">Quick-R</media:title>
		</media:content>
	</item>
	</channel>
</rss>
