<?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/"
	>

<channel>
	<title>PTS Blog &#187; Data Techniques</title>
	<atom:link href="http://peltiertech.com/WordPress/category/data-techniques/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress</link>
	<description>PTS Excel Charts and Tutorials Blog</description>
	<lastBuildDate>Fri, 20 Nov 2009 15:03:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Deming Regression</title>
		<link>http://peltiertech.com/WordPress/deming-regression/</link>
		<comments>http://peltiertech.com/WordPress/deming-regression/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 05:30:46 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[Regression]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2468</guid>
		<description><![CDATA[Linear Regression
People are familiar with a standard linear regression (LR) method that makes assumptions about the X and Y variables in the analysis. Excel&#8217;s built-in regression methods make these same assumptions.
The X variable, also called the independent variable, is assumed to be known precisely, and all error in the regression is assumed to be in [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Linear Regression</strong></p>
<p>People are familiar with a standard linear regression (LR) method that makes assumptions about the X and Y variables in the analysis. Excel&#8217;s built-in regression methods make these same assumptions.</p>
<p>The X variable, also called the independent variable, is assumed to be known precisely, and all error in the regression is assumed to be in the measurement of the Y variable, the dependent variable.</p>
<p>This assumption is reasonable enough. But there are cases where errors in the values of X cannot be discounted. For example, X and Y may be comparisons of the output of two different machines for given inputs. When the outputs are compared, both machines are subject to errors in measurement, so the usual assumptions are invalid.</p>
<p><span id="more-2468"></span><strong>Deming Regression Example</strong></p>
<p>Suppose Machines A and B had the following output. At each nominal output value, the results of two runs of each machine are tabulated. There is some variability in measurements of each machine&#8217;s output. The averages of each machine at each nominal output level are shown next to the individual measurements.</p>
<p align="center"><img src="/images/2009-10/DemingData2.png" alt="Data for Deming Regression" /></p>
<p>We may be tempted to plot each machine&#8217;s outputs as Y values against the nominal X values.</p>
<p align="center"><img src="/images/2009-10/DemingPlot1a.png" alt="Simple Regression" /></p>
<p>We may even compute the lines of best fit for the two machines. We can see that they are close, but not exactly the same. The problem with this analysis is that we are not directly regressing one machine against the other.</p>
<p align="center"><img src="/images/2009-10/DemingPlot1b.png" alt="Simple Regression" /></p>
<p>In the Deming Regression, outputs of the two machines are plotted against each other. Pairs of actual outputs are measured for each nominal output, and the differences between the two measurements from each machine will be used to estimate the variation of each machine&#8217;s outputs. The averages of each pair form the basis of the regression, corrected for the machine variation.</p>
<p align="center"><img src="/images/2009-10/DemingPlot2a.png" alt="Deming Regression" /></p>
<p>The table below shows three sets of calculations. The first row shows a standard linear regression of the measured data. The second row shows a standard linear regression performed on the averages of each pair of values. The third shows the Deming regression analysis. Details of the Deming regression calculations are not given here, but a motivated reader can check the links in the references at the end of this article.</p>
<p align="center"><img src="/images/2009-10/DemingStats.png" alt="Deming Regression Results" /></p>
<p>The data are not too different, and in fact the correlation in the LR of the average values and of the Deming regression are identical. In the plot below, lines have been added to show the three sets of results in the table above, as well as the 45 degree line, where Machine B = Machine A. The lines are practically on top of each other.</p>
<p align="center"><img src="/images/2009-10/DemingPlot2b.png" alt="Deming Regression" /></p>
<p>In the example above, there is little difference in the output of the various LR models. However, if Machines A and B exhibit greater variation in their output, there can be noticeable differences.</p>
<p align="center"><img src="/images/2009-10/DemingPlot3.png" alt="Deming Regression" /></p>
<p><strong>Deming Regression Utility</strong></p>
<p>I&#8217;ve created a small utility that facilitates Deming Regression analysis in Excel. Read about it and follow the download link in <a href="http://peltiertech.com/WordPress/deming-regression-utility/"title="Deming Regression Utility | PTS Blog" >Deming Regression Utility</a>.</p>
<p><strong>References</strong></p>
<p><a href="http://www.ahut.edu.cn/yxsz/ahkl/Teaching/Excel%20for%20Chemists/Ch17.pdf" rel="nofollow" >Chapter 17:  Creating  Custom  Functions</a>, Excel for Chemists: A Comprehensive Guide, 2nd Edition. by E. Joseph Billo, Copyright 2001 by John Wiley &amp; Sons, Inc.</p>
<p><a href="http://www.clinchem.org/cgi/reprint/25/3/432.pdf" rel="nofollow" >Incorrect Least-Squares Regression Coefficients in Method-Comparison Analysis</a> by P. Joanne Cornbleet and Nathan Gochman, Clin. Chem. 25/3, 432-438 (1979).</p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression&amp;bodytext=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression&amp;notes=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;t=Deming%20Regression" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Deming%20Regression%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression&amp;annotation=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;t=Deming%20Regression" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Deming%20Regression&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression&amp;source=PTS+Blog+PTS+Excel+Charts+and+Tutorials+Blog&amp;summary=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;submitHeadline=Deming%20Regression&amp;submitSummary=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/deming-regression/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Mind the Gap &#8211; Charting Empty Cells</title>
		<link>http://peltiertech.com/WordPress/mind-the-gap-charting-empty-cells/</link>
		<comments>http://peltiertech.com/WordPress/mind-the-gap-charting-empty-cells/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 06:00:29 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2284</guid>
		<description><![CDATA[Excel offers a few ways to deal with empty cells in a chart&#8217;s source data range. This is the cause of much confusion, especially over the definition of &#8220;empty cells&#8221;. Let&#8217;s take a look at this problem.
Plotting Without Empty Cells
Here are some typical Excel charts, to remind us what they look like with fully populated [...]]]></description>
			<content:encoded><![CDATA[<p>Excel offers a few ways to deal with empty cells in a chart&#8217;s source data range. This is the cause of much confusion, especially over the definition of &#8220;empty cells&#8221;. Let&#8217;s take a look at this problem.</p>
<p><strong>Plotting Without Empty Cells</strong></p>
<p>Here are some typical Excel charts, to remind us what they look like with fully populated data ranges. I&#8217;ve placed data labels on the charts to help show their behavior when empty cells (and other non-numeric fillers) are included in the source data.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/xy_line_noblanks.png" alt="XY and Line Charts, No Empty Cells" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/col_area_noblanks.png" alt="Column and Area Charts, No Empty Cells" /></p>
<p><strong>Plotting With Empty Cells</strong></p>
<p><span id="more-2284"></span>The default behavior for most charts is to treat an empty cell by leaving a gap on the chart. Here are XY and Line charts that show how this looks. Note the lack of data labels where the gaps occur.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/xy_line_gaps.png" alt="XY and Line Charts, With Empty Cells Treated as Gaps" /></p>
<p>You can instead have Excel treat blanks as zeros (which in general is deceiving, since empty cells mean the absence of a value, not a value of zero). Note the data labels indicating a value of zero.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/xy_line_zeros.png" alt="XY and Line Charts, With Empty Cells Treated as Zeros" /></p>
<p>You can also tell Excel to interpolate over the missing data point. No data point means no data label.</p>
<p>Purists may say that the interpolation option may cause readers to think there is data along the line that spans the gap. Maybe so, but if the line or XY chart plots actual data points with markers, this is less of a risk.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/xy_line_interp.png" alt="XY and Line Charts, With a Line Interpolated Across Empty Cells" /></p>
<p>Column charts offer only the gap and zero options for empty cells. Interpolating makes no sense in a column chart, which has discrete bars for each actual data value. The chart with a gap has no data label at the gap, the chart with zeros has a zero data label.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/col_gaps_zeros.png" alt="Column Charts, With Empty Cells Treated as Gaps and as Zeros" /></p>
<p>If we change the vertical axis so that the horizontal axis crosses below zero, we see that the first chart has no data point (bar) corresponding to the gap, but the second has a point (bar) with a value of zero.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/col_gaps_zeros_scale.png" alt="Column Charts, With Empty Cells Treated as Gaps and as Zeros" /></p>
<p>Area charts seem to offer both the zero and interpolation options, but in both cases, the chart plunges to zero without a corresponding data label. If we mess with the vertical axis, the chart still plunges exactly to zero in both cases.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/areas_zeros_interp.png" alt="Area Charts, With Empty Cells Treated as Zeros, or Supposedly Interpolated" /></p>
<p>A more suitable appearance for an area chart would be one that leaves a real gap, with vertical edges, as below. To get this I had to make a two-axis chart, with a hidden series on the primary axis to provide the A-B-C category axis labels, and an area chart on the secondary axis, with two points at the second category (Y=4 and zero) and two at the fourth category (Y=zero and 8). A date scale on the secondary category axis aligns these points above each other to produce the vertical-sided gap. This only took me three minutes to construct, but an average user might never quite get it.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/area_gaps.png" alt="Area Charts, With Empty Cells Treated as Gaps, if We Had Our Way" /></p>
<p>Pie charts don&#8217;t seem to offer any options for dealing with blanks, but the grayed-out default is the gap option. In the chart at the right, there is no point (wedge) and no corresponding data label where the empty cell would be plotted.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/pie_noblanks_blanks.png" alt="Pie Charts, Without and With Empty Cells" /></p>
<p>Apparently all charts except the Area chart provide a non-plotted point for an empty cell in the data range, though we can spoil that by selecting the option to treat a gap as a zero value.</p>
<p><strong>Simulating Empty Cells</strong></p>
<p>The main confusion comes along when someone uses formulas to fill the source data range.</p>
<p>The problem arises because  a formula that links to an empty cell</p>
<p>=A1</p>
<p>doesn&#8217;t display a blank, it displays the value zero.</p>
<p>Unfortunately Excel has no formulaic way to simulate a blank in a cell. There is no formulaic way, then, to get an actual gap in a chart. A function like BLANK() or NULL() would be nice, and we&#8217;ll keep asking. But we won&#8217;t hold our breath. And if we really need it, we can hack something in VBA.</p>
<p>Andy Pope shares a workaround in <a href="http://andypope.info/charts/brokenlines.htm" rel="nofollow" >Broken Lines for formula linked data</a>, but it requires one or more dummy series with a line color matching the chart background, which obscure the existing line where the gaps should go.</p>
<p>What people try to do to fake a blank is return &#8220;&#8221; in the formula.</p>
<p>=IF(A1=&#8221;",&#8221;",A1)</p>
<p>The result <em>looks</em> to you and me like a blank, but to Excel, &#8220;&#8221; is a text string, albeit a short one, and it is therefore assigned a value of zero. These charts use &#8220;&#8221; in a logical yet misguided attempt to simulate an empty cell. All charts plunge to zero, and all display a data label showing the value zero.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/xy_line_quotes.png" alt="XY and Line Charts, Empty Cells Simulated by Zero-Length Text" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/col_area_quotes.png" alt="Column and Area Charts, Empty Cells Simulated by Zero-Length Text" /></p>
<p>People have learned that the #N/A error in a worksheet cell is often not plotted in a chart. In a formula, the function NA() returns this error.</p>
<p>=IF(A1=&#8221;",NA(),A1)</p>
<p>What #N/A does is prevent the rendering of a marker in XY and line charts: notice the lack of markers and data labels. It&#8217;s not a gap, but it&#8217;s pretty much the next best thing.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/xy_line_na.png" alt="XY and Line Charts, Empty Cells Simulated by #N/A Error" /></p>
<p>This doesn&#8217;t work as well in other chart types. The column and area charts place a data label showing #N/A at zero. For these chart types it would be better to use &#8220;&#8221; or even zero, and apply a custom number format that suppresses the display of zeros (a format like &#8220;0;-0;;&#8221;).</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/col_area_na.png" alt="Column and Area Charts, Empty Cells Simulated by #N/A Error" /></p>
<p>A pie chart will behave like a column or area chart: there is no visible point (wedge) but there is a data label showing zero or #N/A where the wedge would be located.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-07/pie_quotes_na.png" alt="Pie Charts, Empty Cells Simulated by Zero-Length Text and by #N/A Error" /></p>
<p><strong>Summary</strong></p>
<p>The least deceptive way to display an empty cell in a chart, is to treat it as a blank. In line or XY charts, it is generally acceptable to interpolate across the blank with a line, if there are markers plotted for every actual data value. In the vast majority of cases, it is not appropriate to treat empty cells as zeros.</p>
<p>To simulate an empty cell in a line or XY chart, use NA() in your formula to produce the #N/A error in the cell. This produces an ugly #N/A error in the cell, but this error suppresses plotting of a point, and the line spans the position corresponding to the error&#8217;s slot in the data range. It&#8217;s not as good as a gap, but it&#8217;s perhaps the next best thing.</p>
<p>In an area or pie chart, the best approach is to use the null string &#8220;&#8221;, in conjunction with a number format that suppresses the display of zero values.</p>
<p>For an area chart you have to stand on your head to create a complicated chart that simulates a vertical edged gap and provides appropriate category axis labels.</p>
<p>Alternatively you could rely on VBA to clear cells which need to be cleared, but this routine would have to run every time the data range is changed, and it would have to reintroduce formulas into previously cleared cells as well as clear cells where blanks are needed. Or it could do all of the calculations in VBA, eliminating the worksheet formulas.</p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;bodytext=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;notes=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;t=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;annotation=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;t=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;source=PTS+Blog+PTS+Excel+Charts+and+Tutorials+Blog&amp;summary=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;submitHeadline=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;submitSummary=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/mind-the-gap-charting-empty-cells/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AutoFilter Tricks</title>
		<link>http://peltiertech.com/WordPress/autofilter-tricks/</link>
		<comments>http://peltiertech.com/WordPress/autofilter-tricks/#comments</comments>
		<pubDate>Fri, 22 May 2009 10:00:35 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[AutoFilter]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=1963</guid>
		<description><![CDATA[Apply an AutoFilter to an Excel Pivot Table
Excel Pivot Tables are a very powerful feature, and the AutoFilter is also very useful. The row fields of the Pivot Table can be manipulated like an AutoFilter, but the data fields cannot be sorted or filtered. And if you try to apply an AutoFilter to a pivot [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Apply an AutoFilter to an Excel Pivot Table</strong></p>
<p>Excel Pivot Tables are a very powerful feature, and the AutoFilter is also very useful. The row fields of the Pivot Table can be manipulated like an AutoFilter, but the data fields cannot be sorted or filtered. And if you try to apply an AutoFilter to a pivot table, you find the menu command disabled.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/PTAutoFilterMenu.png" alt="AutoFilter options with active cell in Pivot Table" /></p>
<p><span id="more-1963"></span>But I learned a trick this week at the <a href="http://peltiertech.com/WordPress/second-excel-dashboard-boot-camp-may-2009/"title="Excel Dashboard and Visualization Boot Camp" >Excel Dashboard and Visualization Bootcam</a>p. If you select a cell which borders on the pivot table, but is not part of the pivot table,&#8230;</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/PTNoAutoFilter.png" alt="Select a cell next to the Pivot Table" /></p>
<p>&#8230;the AutoFilter menu items are now enabled.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/NoPTAutoFilterMenu.png" alt="AutoFilter options with active cell outside of Pivot Table" /></p>
<p>Select AutoFilter, and the Pivot Table has been AutoFilter enabled.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/PTWithAutoFilter.png" alt="Select a cell next to the Pivot Table" /></p>
<p>These conferences are great.</p>
<p><strong>AutoFilter by Selection</strong></p>
<p>Access has a feature that lets you quickly apply a filter based on the selected item. Wouldn&#8217;t it be great to have this in Excel?</p>
<p>Well, this feature exists, and it&#8217;s built in. But it&#8217;s not present on the default menus or ribbons. You have to dig it out and install it yourself.</p>
<p><em><strong>Excel 2003 and earlier</strong></em></p>
<p>On Excel&#8217;s Tools menu, select Customize, click on the Commands tab, select the Data item in the Caegories list, click on the AutoFilter item, and drag it to a convenient place on a toolbar or menu.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/CustomizeAutoFilter.png" alt="AutoFilter command in the Customization dialog" /></p>
<p>I&#8217;ve put this just under the &#8220;regular&#8221; AutoFilter item on my Data menu/Filter submenu.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/NoPTAutoFilterMenu.png" alt="AutoFilter options with active cell outside of Pivot Table" /></p>
<p><em><strong>Excel 2007</strong></em></p>
<p>Click on the down arrow to the right of the Quick Access Toolbar, and select More Commands from the popup menu.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/CustomizeQAT.png" alt="The Customize QAT menu" /></p>
<p>In the oversized dialog that appears, select Commands not in the Ribbon from the right hand dropdown, select AutoFilter, click Add, and press OK.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/ExcelOptions.png" alt="Adding the AutoFilter command to the QAT" /></p>
<p>The AutoFilter icon appears on the QAT.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/AutoFilterontheQAT.png" alt="AutoFilter command on the QAT" /></p>
<p><em><strong>What the &#8220;New&#8221; AutoFilter does</strong></em></p>
<p>This Autofilter command shares a name with the &#8220;other&#8221; AutoFilter command, but it has a unique icon, and its functionality is enhanced. The command creates an AutoFilter using the range that includes the active cell, then it filters this range based on the active cell.</p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks&amp;bodytext=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks&amp;notes=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;t=AutoFilter%20Tricks" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=AutoFilter%20Tricks%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks&amp;annotation=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;t=AutoFilter%20Tricks" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=AutoFilter%20Tricks&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks&amp;source=PTS+Blog+PTS+Excel+Charts+and+Tutorials+Blog&amp;summary=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;submitHeadline=AutoFilter%20Tricks&amp;submitSummary=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/autofilter-tricks/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Calculating Wind Direction per DDoE</title>
		<link>http://peltiertech.com/WordPress/calculating-wind-direction-ddoe/</link>
		<comments>http://peltiertech.com/WordPress/calculating-wind-direction-ddoe/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 09:30:36 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=1853</guid>
		<description><![CDATA[In Calculating Wind Direction, Dick Kusleika helped solve the problem of calculating a wind direction using a best fit trendline, given wind directions that may vary on either side of 360°. Dick&#8217;s original data has wind directions in degrees at various altitudes in feet. The requirement is to estimate the wind direction at the intermediate [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.dailydoseofexcel.com/archives/2009/04/28/calculating-wind-direction/" rel="nofollow" title="Calculating Wind Direction" >Calculating Wind Direction</a>, Dick Kusleika helped solve the problem of calculating a wind direction using a best fit trendline, given wind directions that may vary on either side of 360°. Dick&#8217;s original data has wind directions in degrees at various altitudes in feet. The requirement is to estimate the wind direction at the intermediate altitude of 3000 ft. Interpolation between the wind directions at 2000 and 5000 feet may be adequate, but let&#8217;s play along and use Dick&#8217;s best fit solution.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionOrigData.png" alt="Wind Direction Original Data" /></p>
<p>One of the answers to the generic question &#8220;Why do we need charts?&#8221; is to gain insight into a problem before we try to solve it.</p>
<p>Dick showed a couple of charts, lame little pie charts actually, which hand-waved a clever little trick he used to account for directions on either side of 360°. I&#8217;ll show how using more carefully crafted charts could have helped lead to the same result more quickly, by showing exactly what the relationships are. I will also show how such charts can easily show when a simplified approach is too simple, and leads to a very wrong answer.</p>
<p><span id="more-1853"></span>When charted, the original data looks like the following.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionOriginal.png" alt="Original Wind Direction" /></p>
<p>By inspection, we can see that Directions 4 and 5 are pretty nearly straight lines as drawn, while the other three have points on either side of 360°. To turn these into linear fits, we need to add or subtract 360° so that the lines can cross 360° (or 0°).</p>
<p>Here is the data, corrected by adding 360° as appropriate. The calculated wind directions at 3000 ft are shown in blue.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionCorrData2.png" alt="Wind Direction Corrected Data" /></p>
<p>Which leads to this chart. All five cases now follow nearly straight lines.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionCorrected2.png" alt="Corrected Wind Direction" /></p>
<p><strong>Dick&#8217;s Approach</strong></p>
<p>The trick is knowing which data needs to be &#8220;enhanced&#8221;.Obviously you need to correct the ones which have values concentrated at the ends of the 0 to 360° range.</p>
<p>Dick&#8217;s approach was to examine the three directions in each case, and if the difference between the min and the max exceeded 180°, he added 180° and moduloed by 360°. This took data which was arranged around 360° and rearranged it around 180°. To these cases he then added 180° to the calculated result, and again moduloed by 360°.</p>
<p>Dick&#8217;s magic formula is</p>
<pre class="vbasmall">=IF(MAX(C4:C6)-MIN(C4:C6)&gt;180,
    MOD(FORECAST($B7,MOD(C4:C6+180,360),$B4:$B6)+180,360),
    FORECAST($B7,C4:C6,$B4:$B6))
 </pre>
<p>which is array-entered (by holding Ctrl+Shift while clicking Enter), so in the formula bar it is surrounded by curly brackets. B4:B6 are the altitudes 2000, 5000, and 10000 in the first column, B7 is the target altitude 3000, C4:C6 are the wind directions under the label Direction1, and this formula is entered in C7. As written, this formula can be copied and pasted into D7:G7 to provide all five calculations.</p>
<p>Instead of a difference of 180°, Dick could have used another cutoff value to decide which data needs correction. Alternatively, a check of the correlation or residuals of the three points could indicate whether the points are nearly aligned or far from linear. These latter approaches are more computationally intensive.</p>
<p>Dick&#8217;s calculated results for 3000 ft are shown by the squares in the chart above. They are all pretty close to the line segments connecting the 2000 ft and 5000 ft data.</p>
<p><strong>Alternative Approach, Simple but Wrong</strong></p>
<p>A comment by &#8220;T&#8221; suggested using some trig to convert all angles to fit into the ragne -180 to 180°, and computing the resulting fit. This seems like an easier approach, and if you only check the answers to the first three cases, they agree.</p>
<p>However, converting all angles to the arbitrary range -180 to 180° doesn&#8217;t check to see which angles should be changed. Dick&#8217;s fourth case has wind directiosn {190, 170, 200}, which become {-170, 170, -160}. Oops, now the three directions, which differed by at most 30°, now differ by 340°.</p>
<p>The incorrected directions are shown in the table and chart below.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionIncorrData.png" alt="Wind Direction Improperly Corrected Data" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionIncorrected.png" alt="Improperly Corrected Wind Direction" /></p>
<p>Four of the five cases work out fine, but the fourth is obviously way off. Of course, without a simple chart, it&#8217;s not so obvious. The calculated values are shown as squares at 3000 ft. The black squares match perfectly with Dick&#8217;s solution, but the red square for the fourth data set is way off. If this solution had incorporated a check to see which sets of dta should be converted and which should be left alone, it may have made correct calculations for all cases.</p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE&amp;bodytext=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE&amp;notes=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;t=Calculating%20Wind%20Direction%20per%20DDoE" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Calculating%20Wind%20Direction%20per%20DDoE%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE&amp;annotation=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;t=Calculating%20Wind%20Direction%20per%20DDoE" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Calculating%20Wind%20Direction%20per%20DDoE&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE&amp;source=PTS+Blog+PTS+Excel+Charts+and+Tutorials+Blog&amp;summary=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;submitHeadline=Calculating%20Wind%20Direction%20per%20DDoE&amp;submitSummary=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/calculating-wind-direction-ddoe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Prepare Your Data</title>
		<link>http://peltiertech.com/WordPress/prepare-your-data/</link>
		<comments>http://peltiertech.com/WordPress/prepare-your-data/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 10:00:34 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[chart source data]]></category>
		<category><![CDATA[contiguous data]]></category>
		<category><![CDATA[discontiguous data]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=1664</guid>
		<description><![CDATA[I was reading Chandoo&#8217;s post Us vs. Them &#8211; Compare Sales Performance using Charts &#38; Form Controls, and the first step in his protocol was &#8220;Prepare your data&#8221;. I&#8217;m always telling people to prepare their data first. I tell people to spend five minutes on their data, and save themselves five hours of frustration later [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading <strong>Chandoo</strong>&#8217;s post <a href="http://chandoo.org/wp/2009/03/12/comparison-charts-1/" rel="nofollow" title="Us vs. Them - Compare Sales Performance using Charts &amp; Form Controls" >Us vs. Them &#8211; Compare Sales Performance using Charts &amp; Form Controls</a>, and the first step in his protocol was &#8220;Prepare your data&#8221;. I&#8217;m always telling people to prepare their data first. I tell people to spend five minutes on their data, and save themselves five hours of frustration later on. Pay me now or pay me later.</p>
<p>There are a number of aspects involved in preparing your data, and I&#8217;ll cover some of them here. I will concentrate on best practices for chart source data, but the principles also apply for other purposes. Factors to keep in mind are the layout of the data, both in terms of blank rows and columns in the data and whether the data is oriented by row or by column. Aspects of chart data include knowing which ranges of data are used for X and Y values and for series names, and how to get Excel to use the right data for the right parts of the chart. Finally, should you format your chart data so it looks nice in that monthly report, or should you splurge and use multiple data ranges?<span id="more-1664"></span></p>
<h2 style="margin: 0pt 0pt 18px; font-size: 1em;">Contiguous Data Layout</h2>
<p>The best way to arrange data for Excel charts is in a contiguous rectangular range. Contiguous is a two-dollar word that means don&#8217;t skip any rows or columns. For many of its features, if you select a single cell in a range of data, Excel will expand the selection until it reaches empty rows and columns, and use that as its first guess for the range you want used.</p>
<p>This screenshot shows a discontiguous range, B2:E15 with column D and rows 9-10 blank.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData1.png" alt="Discontiguous data range" /></p>
<p>The Chart Wizard was started with cell B3 selected. Note that the highlighted range is only B2:C6. Excel 2007 handles ranges exactly the same way.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData2.png" alt="Excel auto-detects contiguous region around active cell" /></p>
<p>Sometimes you&#8217;re stuck with a discontiguous range. It&#8217;s usually better to convert it into a contiguous range, but if it&#8217;s for a one-off chart, that seems like too much trouble. You can select a discontiguous range and the chart wizard will accept it, or you can identify a discontiguous range in the data range selection box in the dialog, but there are rules that the range must adhere to.</p>
<p>The discontiguous range must be represented as a rectangular range that is subdivided by entire rows and entire columns, like the yellow range B2:E15 below split apart by the pink-shaded column D and rows 9-10. Each area of the range must be selected as a single section: for example, the area E2:E8 must be selected in one step, not as partial sections E2:E4 and E5:E8.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData3.png" alt="Discontiguous data range" /></p>
<p>The Chart Wizard accepts this well-formed discontiguous range.<br class="spacer_" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData4.png" alt="Excel dialogs accept a properly formed discontiguous range" /></p>
<p>If the range does not meet the shape requirement above, the Chart Wizard will accept it, but will jump to the Series tab, and perhaps define the series mysteriously. The Data Range tab will show a message indicating that the range is too complex to be displayed.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData5.png" alt="Excel can't display a complex discontiguous range" /></p>
<p>One test for a well-formed discontiguous range  is whether Excel allows you to select and copy the range. You can select and copy the yellow highlighted range above. When you paste it, it will fill a contiguous range, as in G2:I13 below.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData6.png" alt="You can copy and paste a well-formed discontiguous data range" /></p>
<p>If you try to copy a range which is not well-formed, you get a misleading message that says you can&#8217;t do that with multiple selections. Actually you can do it with some multiple selections, just not the one you&#8217;ve selected.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData7.png" alt="You cannot copy a poorly-formed discontiguous data range" /></p>
<h2 style="margin: 0pt 0pt 18px; font-size: 1em;">Orientation of the Data</h2>
<p>By definitions the data range can be laid out in two orientations: By Row and By Column. Some formulas accept 3D references that in effect have a By Sheet dimension, but for charts the data is strictly 2D.</p>
<p>In general it doesn&#8217;t really matter how your data is oriented. Out of habit, people probably use series data in columns more frequently. This habit probably results from several factors. First, in Excel 2003 and earlier, there are only 256 columns, which severely limits the number of points in your series. There are over 65,000 rows, which is more than twice the 32,000 points allowed in a series.</p>
<p>When data is extracted from a database, it generally comes in with records points) in rows and fields (series) in columns. This range may be a dataset resulting from a query of a database which returns values from fields Alpha, Beta, and Gamma for a certain set of other conditions.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ByRowByCol1.png" alt="Simple data in columns" /></p>
<p>When you apply an autofilter to the data,</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ByRowByCol2.png" alt="Autofilter applied to simple data" /></p>
<p>or in Excel 2003 convert the data range to a List (called a Table in Excel 2007),</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ByRowByCol3.png" alt="Data range converted to a list" /></p>
<p>you gain the ability to filter out rows of data which meet various criteria in each column, or sort the data by columns.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ByRowByCol4.png" alt="Data in columns can be sorted or filtered" /></p>
<h2 style="margin: 0pt 0pt 18px; font-size: 1em;">Chart Source Data</h2>
<p>In general, Excel tries to use data in the selected range for series names and category labels (X values). When using series in columns, this generally means the first row is reserved for series names and the first column for X values.</p>
<p>Excel uses the text labels in the first column for category labels in this line chart.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource01.png" alt="Chart Source Data" /></p>
<p>Excel uses the dates in the first column as X values in this line chart.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource02.png" alt="Chart Source Data" /></p>
<p>Excel doesn&#8217;t see anything special about the years in the first column below. They are numerical values, they are not text, nor are they formatted as dates. Therefore Excel considers them just another set of numbers and plots them as Y values. Of course, they lie far above the other values, which are clustered along the X axis. The X values are simply the counting numbers 1, 2, 3, etc.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource03.png" alt="Chart Source Data" /></p>
<p>That&#8217;s funny, in an XY chart with the same data, Excel uses the years as X values.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource04.png" alt="Chart Source Data" /></p>
<p>Excel&#8217;s behavior is not so hard to understand. In an XY chart, the first column is (almost) always used for X values. In a Line chart, if the first column is notably different from the other columns, it is also used for X values. This difference may be that the column contains text labels, or that it contains values formatted as dates. If the values are years, then they are not sufficiently different from the Y values for Excel to know that they should be treated differently.</p>
<p>Another way to show Excel that the first column and row should be treated differently is to leave the top left cell blank. Now the first column is different, because it has no header. The first row is also different for the same reason.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource05.png" alt="Chart Source Data" /></p>
<p>The line chart below was made with years in the first column, but the blank cell told Excel to use the years as X values.<br class="spacer_" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource06.png" alt="Chart Source Data" /></p>
<p>If you select the chart area or plot area, Excel highlights the source data range. The Y values are highlighted with a blue border, the X values with a purple border, and the series names with a green border. I&#8217;ve highlighted the text in the cells to match the highlighting rectangles.<br class="spacer_" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource07.png" alt="Chart Source Data" /></p>
<p>This blank top left range can be taken further. For example, in the range below, the top two row by two column range is blank. Excel uses the first two columns (under the blank cells) for a two-level set of category axis labels, and the first two rows (alongside the blank cells) for a set of two-cell series names. Excel highlights these ranges using the same color scheme.<br class="spacer_" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource08.png" alt="Chart Source Data" /></p>
<h2 style="margin: 0pt 0pt 18px; font-size: 1em;">Multipurpose Data vs. Multiple Copies of the Data</h2>
<p>We&#8217;ve seen how the source data for a chart might be best laid out like this:</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/Table1.png" alt="Chart Source Data" /></p>
<p>while a financial report may have a table with this formatting:</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/Table2.png" alt="Financial Table" /></p>
<p>The source data for a pivot table may look similar to the chart&#8217;s data, with its blank cells filled in:</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/Table3.png" alt="Pivot Table Source Data" /></p>
<p>or it may use actual dates in one column rather than years and months in two:</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/Table4.png" alt="Pivot Table Source Data" /></p>
<p>When you have several uses for your data, and each requires a slightly or greatly different layout, what do you do? It will take hours to try to create a decent chart from the financial report&#8217;s fancy layout, with its centered labels and blank rows and columns. You&#8217;ll never make a proper pivot table from the chart source data or from the financial table.</p>
<p>Back in the day, computer storage came at a premium, and you conserved every byte you could. Since data was stored on magnetic tapes and punch cards, it wasn&#8217;t only memory but also reading and writing of the data that was limiting. Nowadays we have terabyte drives for under $1 per GB, which can transfer data at rates of several GB per minute. It is illogical to try to improve storage efficiency by conserving a few bytes here and there. This paradigm has left the building.</p>
<p>The  solution is easy. Compile a master table of data, then make several copies of the data that link back to this table. The links keep the copies in synch with the original, while each copy of the data can be rearranged to suit a specific purpose.</p>
<p>Create a worksheet with the source data for a pivot table. Place the source data for a chart on another sheet, and if you have multiple charts that require unique layouts, go nuts! Create as many data sheets as you have charts. Link your data into one table that&#8217;s optimized for on-screen viewing, and another table that&#8217;s formatted just perfectly for that  report you print out for the boss every week. Once created and linked, these tables practically maintain themselves.</p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data&amp;bodytext=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data&amp;notes=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;t=Prepare%20Your%20Data" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Prepare%20Your%20Data%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data&amp;annotation=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;t=Prepare%20Your%20Data" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Prepare%20Your%20Data&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data&amp;source=PTS+Blog+PTS+Excel+Charts+and+Tutorials+Blog&amp;summary=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;submitHeadline=Prepare%20Your%20Data&amp;submitSummary=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/prepare-your-data/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>LOESS Smoothing in Excel</title>
		<link>http://peltiertech.com/WordPress/loess-smoothing-in-excel/</link>
		<comments>http://peltiertech.com/WordPress/loess-smoothing-in-excel/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 10:00:15 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[LOESS]]></category>
		<category><![CDATA[LOWESS]]></category>
		<category><![CDATA[Regression]]></category>
		<category><![CDATA[Smoothing]]></category>
		<category><![CDATA[user defined functions]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=1659</guid>
		<description><![CDATA[In 1979 William Cleveland published the LOESS (or LOWESS) technique for smoothing data, and in 1988 he and Susan J. Devlin published a refined version of the technique (references are given at the end of this article). For each X value where a Y value is to be calculated, the LOESS technique performs a regression [...]]]></description>
			<content:encoded><![CDATA[<p>In 1979 William Cleveland published the LOESS (or LOWESS) technique for smoothing data, and in 1988 he and Susan J. Devlin published a refined version of the technique (references are given at the end of this article). For each X value where a Y value is to be calculated, the LOESS technique performs a regression on points in a moving range around the X value, where the values in the moving range are weighted according to their distance from this X value.</p>
<p>The NIST Engineering Statistics Handbook has a good description of the LOESS technique, including a worked example. A commenter named <strong>Nick</strong> used the NIST chapter as a starting point for his implementation of a LOESS function for Excel, and he posted in in <a href="http://junkcharts.typepad.com/junk_charts/2008/05/turning-in-his.html#comment-135008877" rel="nofollow" title="Nick's Excel Implementation of LOESS" >a comment on JunkCharts</a>. Nick&#8217;s approach was to create a UDF in VBA. The UDF accepts as inputs the X and Y data ranges, the number of points to use in the moving regression, and the X value for which to calculate Y. Nick&#8217;s UDF used Dectionary objects to hold intermediate values, and it outputs the Y value for the input X value.</p>
<p><span id="more-1659"></span>I&#8217;ve expanded on Nick&#8217;s starting point, and produced the function presented later in this article. I&#8217;ve discarded the Dictionary objects in favor of VB arrays. It accepts the input X and Y data and the output X values either as ranges or as vertical arrays, and it outputs the calculated LOESS Y values as a vertical array. This means it can be called from within other procedures using arrays, or as a UDF from a worksheet, as an array formula. The original data must be sorted by X in either ascending or descending order (Nick&#8217;s Dictionaries do not require sorted input data, and I have an idea to remove the requirement from my function).</p>
<p>To use the function as a UDF, select the multicell output Y range, and enter this formula:</p>
<pre class="vbasmall">=loess(C2:C22,D2:D22,F2:F21,7)
 </pre>
<p>where C2:C22 and D2:D22 are the input X and Y ranges, F2:F21 is the output X range, and 7 is the number of points in the moving regression (see screenshot below).</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/LOESS_wksht1.png" alt="LOESS in Excel Worksheet 1" /></p>
<p>Enter this as an array formula by holding Ctrl and Shift while pressing Enter, and the selection fills with the calculated Y values. Note the curly braces around the formula in the formula bar, which indicates the formula is an array formula.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/LOESS_wksht2.png" alt="LOESS in Excel Worksheet 2" /></p>
<p>This chart shows the original NIST data points and the smoothed LOESS curve.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/NIST-LOESS.png" alt="LOESS in Excel - NIST Data and Smoothed Curve" /></p>
<p>In <a href="http://en.wikipedia.org/wiki/Local_regression" rel="nofollow" title="Local Regression on Wikipedia" >Local regression</a>, Wikipedia has a decent description of LOESS, with some pros and cons of this approach compared to other smoothing methods.</p>
<p><strong>Example Uses of LOESS</strong></p>
<p>This chart compares LOESS smoothing of website statistics with a simple 7-day moving average. The LOESS captures the major trends in the data, but is less severely affected by week to week fluctuations such as those occuring around Thanksgiving and over the year-end and New Year holidays.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/LOESS_sitestats.png" alt="LOESS vs Moving Average" /></p>
<p>Using LOESS to analyze the body mass indexes (BMI) of Playboy playmates gives more insights than linear regression over the whole data set or over portions of the data. See the discussion in <a href="http://flowingdata.com/2009/02/12/wired-relates-playboy-playmate-bmi-and-average-bmi-1954-2008/" rel="nofollow" title="Wired Relates Playboy Playmate BMI and Average BMI, 1954-2008 | FlowingData" >Wired Relates Playboy Playmate BMI and Average BMI, 1954-2008</a> on the FlowingData blog.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-02/playmate_loess.png" alt="Playmate BMI over time" /></p>
<p><strong>The LOESS Function</strong></p>
<pre class="vbasmall">Public Function LOESS(X As Variant, Y As Variant, xDomain As Variant, nPts As Long) As Double()
  Dim i As Long
  Dim iMin As Long
  Dim iMax As Long
  Dim iPoint As Long
  Dim iMx As Long
  Dim mx As Variant
  Dim maxDist As Double
  Dim SumWts As Double, SumWtX As Double, SumWtX2 As Double, SumWtY As Double, SumWtXY As Double
  Dim Denom As Double, WLRSlope As Double, WLRIntercept As Double
  Dim xNow As Double
  Dim distance() As Double
  Dim weight() As Double
  Dim yLoess() As Double

  If TypeName(X) = "Range" Then
    X = X.Value
  End If

  If TypeName(Y) = "Range" Then
    Y = Y.Value
  End If

  If TypeName(xDomain) = "Range" Then
    xDomain = xDomain.Value
  End If

  ReDim yLoess(LBound(xDomain, 1) To UBound(xDomain, 1), 1 To 1)

  For iPoint = LBound(xDomain, 1) To UBound(xDomain, 1)

    iMin = LBound(X, 1)
    iMax = UBound(X, 1)

    xNow = xDomain(iPoint, 1)

    ReDim distance(iMin To iMax)
    ReDim weight(iMin To iMax)

    For i = iMin To iMax
      ' populate x, y, distance
      distance(i) = Abs(X(i, 1) - xNow)
    Next

    Do
      ' find the nPts points closest to xNow
      If iMax + 1 - iMin &lt;= nPts Then Exit Do
      If distance(iMin) &gt; distance(iMax) Then
        ' remove first point
        iMin = iMin + 1
      ElseIf distance(iMin) &lt; distance(iMax) Then
        ' remove last point
        iMax = iMax - 1
      Else
        ' remove both points?
        iMin = iMin + 1
        iMax = iMax - 1
      End If
    Loop

    ' Find max distance
    maxDist = -1
    For i = iMin To iMax
      If distance(i) &gt; maxDist Then maxDist = distance(i)
    Next

    ' calculate weights using scaled distances
    For i = iMin To iMax
      weight(i) = (1 - (distance(i) / maxDist) ^ 3) ^ 3
    Next

    ' do the sums of squares
    SumWts = 0
    SumWtX = 0
    SumWtX2 = 0
    SumWtY = 0
    SumWtXY = 0
    For i = iMin To iMax
      SumWts = SumWts + weight(i)
      SumWtX = SumWtX + X(i, 1) * weight(i)
      SumWtX2 = SumWtX2 + (X(i, 1) ^ 2) * weight(i)
      SumWtY = SumWtY + Y(i, 1) * weight(i)
      SumWtXY = SumWtXY + X(i, 1) * Y(i, 1) * weight(i)
    Next
    Denom = SumWts * SumWtX2 - SumWtX ^ 2

    ' calculate the regression coefficients, and finally the loess value
    WLRSlope = (SumWts * SumWtXY - SumWtX * SumWtY) / Denom
    WLRIntercept = (SumWtX2 * SumWtY - SumWtX * SumWtXY) / Denom
    yLoess(iPoint, 1) = WLRSlope * xNow + WLRIntercept

  Next

  LOESS = yLoess

End Function
 </pre>
<p><strong>The LOESS Utility</strong></p>
<p>The flexibility of this LOESS function will make it easy to encapsulate into an add-in that uses a dialog to facilitate user selection of data and parameters. A working version uses the following dialog:</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/LOESS_dialog.png" alt="Dialog for LOESS Utility" /></p>
<p><em><strong>Update 24 June 2009</strong></em></p>
<p><em>A LOESS utility for Excel has finally been made ready for public consumption. It is described in <a href="http://peltiertech.com/WordPress/loess-utility-for-excel/"title="LOESS Utility for Excel" >LOESS Utility for Excel</a>, where there is a link to download the utility. It&#8217;s still in preliminary form, but runs pretty much trouble free. Users are encouraged to comment on it to drive further development.</em></p>
<p><em><strong>Update 8 October 2009</strong></em></p>
<p><em>The LOESS utility for Excel has been updated, and the interface made more flexible. It is described in <a href="http://peltiertech.com/WordPress/loess-utility-awesome-update/"title="LOESS Utility – Awesome Update | PTS Blog" >LOESS Utility – Awesome Update</a>, where there is a link to download the new utility.</em></p>
<p><strong>References</strong></p>
<p>Cleveland, W.S. (1979), &#8220;Robust Locally Weighted Regression and Smoothing Scatterplots,&#8221; <em>Journal of the American Statistical Association</em>,  Vol. 74, pp. 829-836.</p>
<p>Cleveland, W.S. and Devlin, S.J. (1988), &#8220;Locally Weighted Regression: An Approach to Regression Analysis by Local Fitting,&#8221; Journal of the American Statistical Association, Vol. 83, pp. 596-610.</p>
<p>NIST Engineering Statistics Handbook, <a href="http://www.itl.nist.gov/div898/handbook/pmd/section1/pmd144.htm" rel="nofollow" title="NIST Engineering Statistics Handbook | 4.1.4.4. LOESS" >4.1.4.4. LOESS (aka LOWESS)</a></p>
<p>NIST Engineering Statistics Handbook, <a href="http://www.itl.nist.gov/div898/handbook/pmd/section1/dep/dep144.htm" rel="nofollow" title="NIST Engineering Statistics Handbook | Example of LOESS Computations" >Example of LOESS Computations</a></p>
<p>Wikipedia, <a href="http://en.wikipedia.org/wiki/Local_regression" rel="nofollow" title="Local Regression on Wikipedia" >Local regression</a></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel&amp;bodytext=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel&amp;notes=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;t=LOESS%20Smoothing%20in%20Excel" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=LOESS%20Smoothing%20in%20Excel%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel&amp;annotation=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;t=LOESS%20Smoothing%20in%20Excel" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=LOESS%20Smoothing%20in%20Excel&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel&amp;source=PTS+Blog+PTS+Excel+Charts+and+Tutorials+Blog&amp;summary=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;submitHeadline=LOESS%20Smoothing%20in%20Excel&amp;submitSummary=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/loess-smoothing-in-excel/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>How to Edit Series Formulas</title>
		<link>http://peltiertech.com/WordPress/how-to-edit-series-formulas/</link>
		<comments>http://peltiertech.com/WordPress/how-to-edit-series-formulas/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 16:00:55 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[series formula]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=1254</guid>
		<description><![CDATA[Ever have a situation where you have spent time getting your chart or charts to look nice, then try to use different data ranges in these charts? You&#8217;ve discovered that there&#8217;s no easy way to approach this change. At least there&#8217;s no easy way built into Excel, but there is a utility that can make [...]]]></description>
			<content:encoded><![CDATA[<p>Ever have a situation where you have spent time getting your chart or charts to look nice, then try to use different data ranges in these charts? You&#8217;ve discovered that there&#8217;s no easy way to approach this change. At least there&#8217;s no easy way built into Excel, but there is a utility that can make the task easier.</p>
<p><strong>Scenario 1<br />
 </strong></p>
<p>You&#8217;ve made a gorgeous chart of the data in Sheet1. You copied the chart from Sheet1 to Sheet2 so you could plot Sheet2&#8217;s data in the same splendor. And you hit a snag: the chart on Sheet2 refers back to Sheet1&#8217;s data. There are two ways to correct this:</p>
<ul style="margin-left: 24px;">
<li>Create a copy of Sheet1 including the chart, so the chart on the copied sheet refers to the data on the copied sheet. Then copy Sheet2&#8217;s data and paste it over the copied sheet&#8217;s data.</li>
<li>Edit the series formulas of the copied chart in Sheet2, changing all instances of one sheet name to the other. This becomes tedious if there are multiple series in the copied chart, or if you&#8217;ve copied multiple charts.</li>
</ul>
<p><span id="more-1254"></span><strong>Scenario 2</strong></p>
<p>You&#8217;ve charted data in rows 1 to 100 of your worksheet. Then you&#8217;ve updated the data so it reaches down to row 150. Your wonderful chart only shows data down to row 100. There are three ways to correct this:</p>
<ul style="margin-left: 24px;">
<li>Before updating the data, convert the data range to a List (Excel 2003) or a Table (Excel 2007). Then update the data. The list/table will expand to include all of the data, and all formulas that refer to all rows in the list/table will update accordingly. This includes the chart&#8217;s SERIES formula.</li>
<li>Create dynamic named ranges for the X and Y data ranges in the chart, and apply them to the chart series. This is described in <a href="http://peltiertech.com/WordPress/2008/05/14/dynamic-charts/"class="simple_alink" title="Dynamic Charts" >Dynamic Charts</a> in this blog and in a number of <a href="http://peltiertech.com/Excel/Charts/Dynamics.html" rel="nofollow" >Dynamic and Interactive Chart</a> examples described in this web site. However, this is an involved procedure that you never have time for.</li>
<li>Edit the series formulas of the chart, changing all instances of one row number to another. This becomes tedious if there are multiple series&nbsp; or multiple charts to correct.</li>
</ul>
<p><strong>Scenario 3</strong></p>
<p>Your charts show the data for product Alpha beautifully, but you want to show the data for product Beta instead. The data is listed in another column. You can:</p>
<ul style="margin-left: 24px;">
<li>Select the series, then drag the highlighted rectangles on the worksheet to reflect the new data range. This becomes a laborious process for multiple charts and series. </li>
<li>Edit the series formulas of the chart, changing all instances of one column to another. This becomes tedious if there are multiple series&nbsp; or multiple charts to correct.</li>
</ul>
<p><strong>The Solution</strong></p>
<p>These suggested means for editing your charts all leave out one approach. In <a href="http://peltiertech.com/Excel/Charts/ChgSrsFmla.html" rel="nofollow" title="Change Series Formulas" >Change Series Formulas</a> I showed how to programmatically change the series formulas in your charts, and I provided a utility that does the task for you. I&#8217;ve just recently updated the utility to account for glitches in Excel, and to streamline using the utility.</p>
<h2 style="margin: 0pt 0pt 18px; font-size: 1em;">The Change Series Formula Utility</h2>
<p>The new utility is located in <a href="http://peltiertech.com/images/2008-12/PTS_ChangeSeriesFormula.zip" rel="nofollow" title="PTS Change Series Formula Utility" >PTS_ChangeSeriesFormula.zip</a>. You can install it following the protocol in <a href="http://peltiertech.com/WordPress/2008/06/07/installing-an-excel-add-in/"title="Installing an Excel Add-In" >Installing an Excel Add-In</a>.</p>
<p>Upon installation, the utility creates a toolbar (In Excel 2007, the toolbar buttons are buried on the Add-Ins tab of the ribbon).</p>
<p align="center"><img title="Change Series Formula Toolbar" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaToolbar.png" alt="Change Series Formula Toolbar" /></p>
<p>Not too fancy or complicated. Suppose I have the following scenario, a chart showing data for Alpha in column B, and I want to show Beta from column C instead.</p>
<p align="center"><img title="Change Series Formula Chart - Before" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaChart1a.png" alt="Change Series Formula Chart - Before" /></p>
<p>If it&#8217;s only one series in one chart, I can drag the colored highlight rectangles in the sheet, or edit the series formula in the formula bar. But if there&#8217;s more, why waste time? With the chart selected (I like to select the series, so the formula bar is visible and I don&#8217;t have to remember what to change), click on the <em>Change Series Formula</em> button on the toolbar. Enter the old and new text in the dialog. In the old text entry box, I like to explicitly use punctuation like the dollar signs, to make sure I&#8217;m changing a column designation and not some other text in the formula. In the new text box, it doesn&#8217;t matter, because Excel capitalizes and adds dollar signs automatically.</p>
<p align="center"><img title="Change Series Formula Dialog" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaDialog1.png" alt="Change Series Formula Dialog" /></p>
<p>Click the <em>Change Active Chart Only</em> button (the other button is inactive because there are no other charts on this worksheet).</p>
<p>Magically, the series formula, the colored highlights, and the chart itself now reference the new data.</p>
<p align="center"><img title="Change Series Formula Chart - After" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaChart1b.png" alt="Change Series Formula Chart - After" /></p>
<p>Here is how I would extend a chart&#8217;s data from row 6 to row 12. In this case there are multiple charts on the worksheet, and you have a choice of changing the active chart or changing all charts on the worksheet.</p>
<p align="center"><img title="Change Series Formula Dialog" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaDialog2.png" alt="Change Series Formula Dialog" /></p>
<p>This dialog shows how to change references from Sheet1 to Sheet2. In addition, the buttons reflect that multiple charts have been selected using Shift+Click. The options are to change all selected charts or all charts on the worksheet.</p>
<p align="center"><img title="Change Series Formula Dialog" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaDialog3.png" alt="Change Series Formula Dialog" /></p>
<p>It&#8217;s a pretty smart utility, and it has saved me tons of time. Download it, install it, and use it. Give me feedback, make suggestions, and report errors in a comment below.</p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas&amp;bodytext=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas&amp;notes=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;t=How%20to%20Edit%20Series%20Formulas" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=How%20to%20Edit%20Series%20Formulas%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas&amp;annotation=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;t=How%20to%20Edit%20Series%20Formulas" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=How%20to%20Edit%20Series%20Formulas&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas&amp;source=PTS+Blog+PTS+Excel+Charts+and+Tutorials+Blog&amp;summary=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;submitHeadline=How%20to%20Edit%20Series%20Formulas&amp;submitSummary=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/how-to-edit-series-formulas/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>SOLVER &#8211; Optimization Approach to a Simple Physics Problem</title>
		<link>http://peltiertech.com/WordPress/solver-optimization-approach-to-a-simple-physics-problem/</link>
		<comments>http://peltiertech.com/WordPress/solver-optimization-approach-to-a-simple-physics-problem/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 01:29:12 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[Regression]]></category>
		<category><![CDATA[Science & Engineering]]></category>
		<category><![CDATA[Trendlines]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=511</guid>
		<description><![CDATA[In Graphical Approach to a Simple Physics Problem and Regression Approach to a Simple Physics Problem I have discussed approaches to solving my daughter&#8217;s physics homework. Basically, the problem started with this data, showing the time to drain water through a hole in a bucket, based on the diameter of the hole and the initial [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://peltiertech.com/WordPress/2008/09/08/graphical-approach-to-a-simple-physics-problem/"title="Graphical Approach to a Simple Physics Problem" >Graphical Approach to a Simple Physics Problem</a> and <a href="http://peltiertech.com/WordPress/2008/09/10/regression-approach-to-a-simple-physics-problem/"title="Regression Approach to a Simple Physics Problem" >Regression Approach to a Simple Physics Problem</a> I have discussed approaches to solving my daughter&#8217;s physics homework. Basically, the problem started with this data, showing the time to drain water through a hole in a bucket, based on the diameter of the hole and the initial height of water in the bucket.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/physdata1.png" alt="physics problem data" /></p>
<p>In the earlier two posts, I found that the drainage time was related to hole diameter through a power law relationship with an exponent of -2, and to height with an exponent of 1/2.</p>
<p align="center"><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/phys4a.png" alt="physics problem chart" /><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/phys4b.png" alt="physics problem chart" /></p>
<p>Often when modeling a physical process you have theoretical relationships that describe the process, and you just need to find the appropriate factors in the formula. Then you can manually plug and chug to find these factors, or you can use an analytical tool to find them.</p>
<p>In <a href="http://peltiertech.com/WordPress/goal-seek-optimization-approach-to-a-simple-physics-problem/"title="Goal Seek - Optimization Approach to a Simple Physics Problem" >Goal Seek &#8211; Optimization Approach to a Simple Physics Problem</a> I showed how to use the built-in Goal Seek optimization tool to determine the coefficient to the power law function involving initial water height and hole diameter. Excel has another tool, an optional add-in called <strong>SOLVER</strong>, which is a more powerful optimization tool.</p>
<p>I have set up my data as shown below. The initial data is in C9:F12. In C3:F6 I have calculated values for a formula of the form</p>
<pre class="vba">t = K * h<sup>a</sup> * d<sup>b</sup>
 </pre>
<p>where t is time to drain the bucket, h is the water height, d is hole diameter, K is the unknown coefficient, a is the exponent -2, and b is the exponent 0.5. I put a provisional factor K in cell A1, based on the preliminary regression work. Cell C3 has this formula, which is copied into the whole range C3:F6:</p>
<pre class="vba">=$A$1*C$2^0.5/$B3^2
 </pre>
<p>Finally, C15:F18 tabulates the squared differences between the calculations and the actual data. The formula in C15 is simply</p>
<pre class="vba">=(C3-C9)^2
 </pre>
<p>Cell A16 contains the sum of all of these differences (sum of squares). This is more routinely used than the simple sum of differences used in the Goal Seek approach, but the final answers are close.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver01.png" alt="physics problem data" /></p>
<p>I used SOLVER to minimize the sum of the squared differences in A16 by changing the factor in cell A1. Unlike Goal Seek, SOLVER actually does find a minimum.</p>
<p>From the Tools menu, choose SOLVER (in Excel 2007, on the Data ribbon tab, click on Solver in the Analysis group). If the command for SOLVER is unavailable, you will have to install it. See <a href="http://peltiertech.com/WordPress/2008/06/07/installing-an-excel-add-in/"title="Installing an Excel Add-In" >Installing an Excel Add-In</a> for instructions; the SOLVER add-in is either present in the list on the Add-Ins dialog, or you can click the Browse button and look in the SOLVER folder.</p>
<p>The following dialog allows you to indicate which cell to change in order to set another cell to a particular value. We are not using the powerful capabilities of SOLVER to include constraints in the model.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver02.png" alt="physics problem data" /></p>
<p>Click OK, and SOLVER does its magic, and shows a dialog which either shows a solution or explains why no solution was found. SOLVER did find a solution to this problem.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver03.png" alt="physics problem data" /></p>
<p>Here is the complete SOLVER solution.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver04.png" alt="physics problem data" /></p>
<p>These charts show the SOLVER solution (markers and dotted lines) in comparison to the original data (solid lines).</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver05.png" alt="physics problem data" /> <img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver06.png" alt="physics problem data" /></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;bodytext=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;notes=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;t=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;annotation=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;t=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;source=PTS+Blog+PTS+Excel+Charts+and+Tutorials+Blog&amp;summary=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;submitHeadline=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;submitSummary=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/solver-optimization-approach-to-a-simple-physics-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Goal Seek &#8211; Optimization Approach to a Simple Physics Problem</title>
		<link>http://peltiertech.com/WordPress/goal-seek-optimization-approach-to-a-simple-physics-problem/</link>
		<comments>http://peltiertech.com/WordPress/goal-seek-optimization-approach-to-a-simple-physics-problem/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 04:05:50 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[Regression]]></category>
		<category><![CDATA[Science & Engineering]]></category>
		<category><![CDATA[Trendlines]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=507</guid>
		<description><![CDATA[In Graphical Approach to a Simple Physics Problem and Regression Approach to a Simple Physics Problem I have discussed approaches to solving my daughter&#8217;s physics homework. Basically, the problem started with the following data, showing the time to drain water through a hole in a bucket, based on the diameter of the hole and the [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://peltiertech.com/WordPress/2008/09/08/graphical-approach-to-a-simple-physics-problem/"title="Graphical Approach to a Simple Physics Problem" >Graphical Approach to a Simple Physics Problem</a> and <a href="http://peltiertech.com/WordPress/2008/09/10/regression-approach-to-a-simple-physics-problem/"title="Regression Approach to a Simple Physics Problem" >Regression Approach to a Simple Physics Problem</a> I have discussed approaches to solving my daughter&#8217;s physics homework. Basically, the problem started with the following data, showing the time to drain water through a hole in a bucket, based on the diameter of the hole and the initial height of water in the bucket.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/physdata1.png" alt="physics problem data" /></p>
<p>In the earlier two posts, I found that the drainage time was related to hole diameter through a power law relationship with an exponent of -2, and to height with an exponent of 1/2.</p>
<p align="center"><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/phys4a.png" alt="physics problem chart" /><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/phys4b.png" alt="physics problem chart" /></p>
<p><span id="more-507"></span>Often when modeling a physical process you have theoretical or empirical relationships that describe the process, and you just need to find the appropriate factors in the formula to fit your specific set of conditions. Then you can manually plug and chug to find these factors, or you can use an analytical tool to find them.</p>
<p>Excel has a built-in tool called <strong>Goal Seek</strong>, which I will use to find the coefficient to the power law function involving initial water height and hole diameter.</p>
<p>I have set up my data as shown. The initial data is in C9:F12. In C3:F6 I have calculated values for a formula of the form</p>
<pre class="vba">t = K * h<sup>a</sup> * d<sup>b</sup>
 </pre>
<p>where t is time to drain the bucket, h is the water height, d is hole diameter, K is the unknown coefficient, a is the exponent 0.5, and b is the exponent -2. I put a provisional factor K in cell A1, based on the preliminary regression work. Cell C3 has this formula, which is copied into the whole range C3:F6:</p>
<pre class="vba">=$A$1*C$2^0.5/$B3^2
 </pre>
<p>Finally, C15:F18 tabulates the differences between the calculations and the actual data. The formula in C15 is simply</p>
<pre class="vba">=C3-C9
 </pre>
<p>Cell A16 contains the sum of all of these differences.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/goalseek01.png" alt="physics problem data" /></p>
<p>I used Goal Seek to minimize the sum of the differences in A16 by changing the factor in cell A1. Goal Seek doesn&#8217;t actually find a minimum, but if you enter zero, it will get as close as it can.</p>
<p>From the Tools menu, choose Goal Seek (in Excel 2007, on the Data ribbon tab, click on What-If Analysis in the Data Tools group, and select Goal Seek). The following dialog allows you to indicate which cell to change in order to set another cell to a particular value.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/goalseek02.png" alt="physics problem data" /></p>
<p>Click OK, and Goal Seek does its magic, and shows a dialog which either shows a solution or explains why no solution was found. Goal Seek did find a solution to this problem.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/goalseek03.png" alt="physics problem data" /></p>
<p>Here is the complete Goal Seek solution.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/goalseek04.png" alt="physics problem data" /></p>
<p>These charts show the Goal Seek solution (markers and dotted lines) in comparison to the original data (solid lines).</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/goalseek05.png" alt="physics problem data" /> <img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/goalseek06.png" alt="physics problem data" /></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F&amp;title=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;bodytext=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20the%20following%20data%2C%20showing%20the%20time%20to%20d" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F&amp;title=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;notes=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20the%20following%20data%2C%20showing%20the%20time%20to%20d" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F&amp;t=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F&amp;title=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F&amp;title=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;annotation=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20the%20following%20data%2C%20showing%20the%20time%20to%20d" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F&amp;title=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F&amp;t=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F&amp;title=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;source=PTS+Blog+PTS+Excel+Charts+and+Tutorials+Blog&amp;summary=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20the%20following%20data%2C%20showing%20the%20time%20to%20d" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fgoal-seek-optimization-approach-to-a-simple-physics-problem%2F&amp;submitHeadline=Goal%20Seek%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;submitSummary=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20the%20following%20data%2C%20showing%20the%20time%20to%20d&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/goal-seek-optimization-approach-to-a-simple-physics-problem/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Regression Approach to a Simple Physics Problem</title>
		<link>http://peltiertech.com/WordPress/regression-approach-to-a-simple-physics-problem/</link>
		<comments>http://peltiertech.com/WordPress/regression-approach-to-a-simple-physics-problem/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 04:03:42 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[Regression]]></category>
		<category><![CDATA[Science & Engineering]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Trendlines]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=481</guid>
		<description><![CDATA[In Graphical Approach to a Simple Physics Problem I discussed my daughter&#8217;s physics homework. The problem was to determine the relationships between how long it takes water to drain from a hole in the bottom of a bucket, the diameter of this hole, and the initial height of water in the bucket. Given this relationship, [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://peltiertech.com/WordPress/2008/09/08/graphical-approach-to-a-simple-physics-problem/"title="Graphical Approach to a Simple Physics Problem" >Graphical Approach to a Simple Physics Problem</a> I discussed my daughter&#8217;s physics homework. The problem was to determine the relationships between how long it takes water to drain from a hole in the bottom of a bucket, the diameter of this hole, and the initial height of water in the bucket. Given this relationship, the time to drain an initial height of 20 through a hole of diameter 4 was to be computed. The data is shown in this table.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/physdata1.png" alt="physics problem data" /></p>
<p>The first step is to plot the data using XY charts. The charts below show time to drain vs height for various hole sizes and time to drain vs hole size for various diameters.<span id="more-481"></span></p>
<p align="center"><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/phys1a.png" alt="physics problem chart" /><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/phys1b.png" alt="physics problem chart" /></p>
<p>The regression approach can be followed in Excel using the LINEST worksheet function. The help topic for LINEST is pretty good, so I would direct you there first if you have questions.</p>
<p><strong>LINEST Fit 1</strong></p>
<p>I set up the following table based on the initial data. Knowing that we have height<sup>0.5</sup> and diameter<sup>-2</sup> dependencies on time to drain the bucket, I calculated the transformations in columns C and D. The LINEST regression output is in C22:E26.</p>
<p>To compute the regression output, select a range 5 rows high and N+1 columns wide, where N is the number of X variables used. We have two X variables, 1/dia² and sqrt(ht), so we need a range three columns wide. With the range selected, enter the LINEST formula, and use CTRL+SHIFT+ENTER to accept the formula, not just ENTER, because the output is an array. The specific formula used here is:</p>
<pre class="vba">=LINEST(E2:E17,C2:D17,,TRUE)
 </pre>
<p>where E2:E17 contains the Y values, C2:D17 contains two columns of X values, the blank third argument tells Excel to calculate the constant normally, and TRUE tells Excel to provide the extra rows of&nbsp; statistical parameters, even though I will pretty much ignore them.</p>
<p>Note that when the LINEST formula contains no syntax error and is properly entered using CTRL+SHIFT+ENTER, Excel wraps it in curly braces to indicate that it is an array formula. If you try typing these curly braces yourself, you will only cause an error.</p>
<pre class="vba">{=LINEST(E2:E17,C2:D17,,TRUE)}
 </pre>
<p align="center"><img title="physics regression data" src="http://peltiertech.com/WordPress/wp-content/img200809/linest1.png" alt="physics regression data" /></p>
<p>E22 contains the constant, D22 contains the coefficient for 1/dia², and C22 contains the coefficient for sqrt(ht). The predicted value in F2 uses this formula:</p>
<pre class="vba">=E$22+D$22*C2+C$22*D2
 </pre>
<p>This formula is filled down to F17. Row 19 shows the prediction from the regression formula for intermediate values of diameter and height. The time of 15.4 is much different than the graphical interpolation of 8.5 found in <a href="http://peltiertech.com/WordPress/2008/09/08/graphical-approach-to-a-simple-physics-problem/"title="Graphical Approach to a Simple Physics Problem" >Graphical Approach to a Simple Physics Problem</a>.</p>
<p>The predicted values don&#8217;t match the actual values too closely, but let&#8217;s plot them. The following charts use markers and dotted lines for predictions and solid lines for actual values.</p>
<p align="center"><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest1a.png" alt="physics problem chart" /><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest1b.png" alt="physics problem chart" /></p>
<p>Not very good fits at all, and there are some negative values (are we filling the bucket up in these cases?).</p>
<p>The log-log plots below don&#8217;t even have the appropriate shapes.</p>
<p align="center"><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest1c.png" alt="physics problem chart" /><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest1d.png" alt="physics problem chart" /></p>
<p>These plots illustrate out problem. The regression calculated a single coefficient (slope) for each of the X variables, and the terms are added together. The consequence of the single slope and added terms is that all curves have the same slope, and the predicted lines pass through the averages of the actual lines. This is the wrong constraint for this problem.</p>
<p align="center"><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest1e.png" alt="physics problem chart" /><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest1f.png" alt="physics problem chart" /></p>
<p><strong>LINEST Fit 2</strong></p>
<p>After the previous fiasco I brushed off myself and my bruised ego, and started again. This time I ignored the powers I&#8217;d imposed on diameter and height, and simply took logs of all variables. The LINEST formula is:</p>
<pre class="vba">=LINEST(F2:F17,D2:E17,,TRUE)
 </pre>
<p>I could actually have skipped the logarithmic transformations in columns D:F and used this LINEST formula:</p>
<pre class="vba">=LINEST(LOG(C2:C17),LOG(A2:B17),,TRUE)
 </pre>
<p>Remember to select the formula&#8217;s output range, type the formula, and array-enter it by holding CTRL+SHIFT while pressing ENTER. Excel puts curly braces around the formula if it&#8217;s syntactically correct.</p>
<p align="center"><img title="physics regression data" src="http://peltiertech.com/WordPress/wp-content/img200809/linest2.png" alt="physics regression data" /></p>
<p>The predictions in column G use this formula:</p>
<pre class="vba">=F$22+E$22*D2+D$22*E2
 </pre>
<p>These predictions are the logarithms of the times to drain, so they must be converted to their antilogs using:</p>
<pre class="vba">=10^G2
 </pre>
<p>These predictions are pretty close to the actual values. The prediction for the arbitrary starting values in row 19, 8.5, agrees with the graphical interpolation from <a href="http://peltiertech.com/WordPress/2008/09/08/graphical-approach-to-a-simple-physics-problem/"title="Graphical Approach to a Simple Physics Problem" >Graphical Approach to a Simple Physics Problem</a>. Let&#8217;s go to the charts, which use markers and dotted lines for predictions and solid lines for actual values.</p>
<p align="center"><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest2a.png" alt="physics problem chart" /><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest2b.png" alt="physics problem chart" /></p>
<p>The fitting coefficients for log(height) and log(diameter) are constant, so we get parallel lines in the log-log charts.</p>
<p align="center"><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest2c.png" alt="physics problem chart" /><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest2d.png" alt="physics problem chart" /></p>
<p>The corresponding straight lines for time vs. swrt(ht) and 1/diam² are no longer parallel, but instead they converge on the origin.</p>
<p align="center"><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest2e.png" alt="physics problem chart" /><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/linest2f.png" alt="physics problem chart" /></p>
<p>When the regression is done properly, its results agree closely with those from a simple graphical interpolation. In the next post on this topic, we will look at optimization approaches to determining these relationships.</p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F&amp;title=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;bodytext=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20discussed%20my%20daughter%27s%20physics%20homework.%20The%20problem%20was%20to%20determine%20the%20relationships%20between%20how%20long%20it%20takes%20water%20to%20drain%20from%20a%20hole%20in%20the%20bottom%20of%20a%20bucket%2C%20the%20diameter%20of%20this%20hole%2C%20an" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F&amp;title=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;notes=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20discussed%20my%20daughter%27s%20physics%20homework.%20The%20problem%20was%20to%20determine%20the%20relationships%20between%20how%20long%20it%20takes%20water%20to%20drain%20from%20a%20hole%20in%20the%20bottom%20of%20a%20bucket%2C%20the%20diameter%20of%20this%20hole%2C%20an" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F&amp;t=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F&amp;title=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F&amp;title=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;annotation=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20discussed%20my%20daughter%27s%20physics%20homework.%20The%20problem%20was%20to%20determine%20the%20relationships%20between%20how%20long%20it%20takes%20water%20to%20drain%20from%20a%20hole%20in%20the%20bottom%20of%20a%20bucket%2C%20the%20diameter%20of%20this%20hole%2C%20an" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F&amp;title=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F&amp;t=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F&amp;title=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;source=PTS+Blog+PTS+Excel+Charts+and+Tutorials+Blog&amp;summary=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20discussed%20my%20daughter%27s%20physics%20homework.%20The%20problem%20was%20to%20determine%20the%20relationships%20between%20how%20long%20it%20takes%20water%20to%20drain%20from%20a%20hole%20in%20the%20bottom%20of%20a%20bucket%2C%20the%20diameter%20of%20this%20hole%2C%20an" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fregression-approach-to-a-simple-physics-problem%2F&amp;submitHeadline=Regression%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;submitSummary=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20discussed%20my%20daughter%27s%20physics%20homework.%20The%20problem%20was%20to%20determine%20the%20relationships%20between%20how%20long%20it%20takes%20water%20to%20drain%20from%20a%20hole%20in%20the%20bottom%20of%20a%20bucket%2C%20the%20diameter%20of%20this%20hole%2C%20an&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/regression-approach-to-a-simple-physics-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
