<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="m11209">

  <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Squared Differences Simulation</name>

  <metadata xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
  <md:version xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">1.3</md:version>
  <md:created xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2003/05/29</md:created>
  <md:revised xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2003/07/14 17:43:20.778 GMT-5</md:revised>
  <md:authorlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:author xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="dmlane">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">David</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Lane</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">lane@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="dmlane">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">David</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Lane</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">lane@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="mjeanes">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Matthew</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Jeanes</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">mjeanes@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  

  <md:abstract xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/"/>
</metadata>

  <content xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="beginby">
      Begin by answering the questions, even if you have to guess. The
      first time you answer the questions you will not be told whether
      you are correct or not.
    </para>

    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="onceyou">
      Once you have answered all the questions, answer them again
      using the simulation to help you. This time you will get
      feedback about each individual answer.
    </para>

    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="showsim">
      <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="genins">Show Simulation</cnxn>
    </para>
    
    <media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="application/x-java-applet" src="questionbase.questionBase.class">
      <param name="ARCHIVE" value="questionbase.jar"/>
      <param name="width" value="480"/>
      <param name="height" value="330"/>
      <param name="XML" value="squared_sim.xml"/>
      <param name="Background" value="16777164"/>
      <param name="FontSize" value="14"/>
      <param name="EndInfo" value="Please use the simulation to help you discover and understand the answers to the questions."/>
    </media>
    
    
    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="genins">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">General Instructions</name>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="thisdem">
	This demonstration allows you to examine the sum of absolute
	deviations from a given value. The graph to the left shows the
	numbers 1, 2, 3, 4, and 5 and their deviations from 0. The
	first number, 1, is represented by a red dot. The deviation
	from 0 is represented by a red line from the red dot to the
	black line. The value of the black line is 0.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="similarly">
	Similarly, the number 2 is represented by a blue dot and its
	deviation from 0 is represented by a blue line. The graph with
	the colored rectangles shows the sum of the absolute
	deviations. Since the deviations for the numbers 1, 2, 3, 4,
	and 5 from 0 are the numbers themselves, the sum of the
	deviations is equal to 1 + 2 + 3 + 4 + 5 = 15 as shown by the
	height of the colored bar.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="inthis">
	In this demonstration, you can move the black bar by clicking
	on it and dragging it up or down. To see how it works, move it
	up to 1.0. The deviation of the red point from the black bar
	is now 0 since they are both 1. The sum of the deviations is
	now 10.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="asyou">
	As you move the bar up and down, the value of the sum of
	absolute deviations changes. See if you can find the placement
	of the black bar that produces the smallest value for the sum
	of the absolute deviations. To check and see if you found the
	smallest value, click the "OK" button at the bottom of the
	graph. It will move the bar to the location that produces the
	smallest sum of absolute deviations.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="youcan">
	You can also move the individual points. Click on one of the
	points and move it up or down and note the effect.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="yourgoal">
	Your goal for this demonstration is to discover a rule for
	determining what value will give you the smallest sum of
	absolute deviations.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="whenyou">
	When you have discovered the rule, go back and answer the
	questions again.
      </para>
    </section>

    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="stepbystep">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Step by Step Instructions</name>
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="link">
	<cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="beginby">Show Questions</cnxn>
      </para>
      
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="ifitis">
	If it is not already there, move the black bar at the bottom
	of the graph up so that it crosses the Y axis at 1. The bar
	should go right through the red circle. Notice the numerical
	indicator of the black bar immediately to its right.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="thedeviation">
	The deviation of the red circle from the bar is 0, so you
	won't see a red rectangle on the right-hand portion of the
	graph. The line between the bar and the blue circle is the
	deviation of the circle from the bar. It has a length of
	1. Notice that the height of the blue rectangle is 1.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="thegreen">
	The green line has a length of 2 and the height of the green
	rectangle is also 2. The total height of the rectangle is the
	sum of all the line lengths: 0 + 1 + 2 + 3 + 4 = 10. This
	height is the sum of the absolute deviations from the bar. It
	is marked below the rectangle.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="yourgoalis">
	Your goal is to find the placement of the bar that gives you
	the shortest rectangle. This will be the value that minimizes
	the sum of the rectangles. Move the bar up and down until you
	think you have found this value. Then, to make sure you are
	correct, click on the "OK" button at the bottom of the
	graph. This will move the black bar to the correct
	location. If nothing changes, you found the correct location
	on your own.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="nowchange">
	Now, change the value of the green circle from 3 to somewhere
	between 2 and 3. You move the circle by clicking on it and
	dragging it. Notice that the value of the point is shown at
	the bottom of the graph in green.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="nextfind">
	Next, find the value that minimizes the sum of absolute
	deviations for the new data. Once again it is the same value
	as the green circle.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="nowmove">
	Now move the blue circle to somewhere between 3 and 4 and
	again find the value that minimizes the sum of absolute
	differences. This time it is the value of the blue circle.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="howdoyou">
	How do you know which point it will be? The correct placement
	of the bar will always be at the value of the circle with the
	middle value. That is, the circle that has two point higher
	than it and two points lower than it.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="whyis">
	Why is this? If the bar is at the circle with the middle
	value, then moving the bar will bring the bar closer to two
	points but farther from three points. So, any movement of the
	bar from the middle value increases the sum of absolute
	deviations.
      </para>

      <media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="application/x-java-applet" src="mean.Mean.class">
	<param name="archive" value="mean.jar"/>
	<param name="width" value="480"/>
	<param name="height" value="460"/>
	<param name="name" value="Mean"/>
      </media>

    </section>
    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="summary">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Summary</name>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="themiddle">
	The middle number minimizes the sum of the absolute
	deviations. If you have 7 numbers, say 0, 1, 2, 5, 6, 9, and
	12, then the middle number is the fourth highest which is
	5. Therefore 5 is the value that minimizes the sum of the
	absolute deviations. This middle number is called the median.
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="ifyou">
	If you have an even number of numbers such as the four
	numbers: 2, 4, 6, and 9, then any value between 4 and 6 will
	give you the same minimum sum of the absolute deviations. By
	convention, we define the median as the average of the two
	numbers closest the middle (2 and 4 in this case). So the
	median of the numbers 2, 4, 6, and 9 is 5.
      </para>
    </section>
  </content>
  
</document>
