<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Date Based Equations, Line of Fit, Setting X to mean different units of time in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Date-Based-Equations-Line-of-Fit-Setting-X-to-mean-different/m-p/194997#M41589</link>
    <description>&lt;P&gt;With JMP often we are asked to roll up raw data, group it by week, month, quarter, year, etc.&amp;nbsp; Then go look for a trend.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What are the best practices for dealing with longitudinal data?&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Data Type&lt;/LI&gt;&lt;LI&gt;Modeling Type&lt;/LI&gt;&lt;LI&gt;Format&lt;/LI&gt;&lt;LI&gt;Maybe tricks in graph builder?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I'm having trouble getting the graphical output to be both executive presentation friendly AND include an equation that makes sense.&amp;nbsp; &amp;nbsp;For example, it's typically with reference for what x represents.&amp;nbsp;Does X represent a date, a growing integer, a quarter, etc.?&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When&amp;nbsp; I use a "raw index" (just a integer for whatever frame of refrence, in this case weeks) the equation makes sense, but the graph x-axis labels aren't human readable.&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;Units are going up 47 units per week, but over what time frame?&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;When I use a date the represents the first day of the week, the x-axis on the graph looks nice but the equation doesn't lend insight.&amp;nbsp;&lt;STRONG&gt;The time frame is clear, but how fast are units increasing?&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here's an example with raw data rolled up to the week.&amp;nbsp; And we are interested in trend based on weekly increment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "DateMathExample_RollByWeek",
	Add Rows( 6 ),
	New Script(
		"Source",
		Data Table( "DateMathExample" ) &amp;lt;&amp;lt; Summary(
			Group( :First Day of Week, :Raw Fiscal Week Index, :Fiscal Week YYYYWW ),
			Sum( :Units ),
			Freq( "None" ),
			Weight( "None" ),
			Link to original data table( 0 ),
			output table name( "DateMathExample_RollByWeek" )
		)
	),
	New Script(
		"Sum(Units) vs. First Day of Week",
		Graph Builder(
			Variables( X( :First Day of Week ), Y( :Name( "Sum(Units)" ) ) ),
			Elements(
				Points( X, Y, Legend( 5 ) ),
				Smoother( X, Y, Legend( 6 ) ),
				Line Of Fit(
					X,
					Y,
					Legend( 7 ),
					Confidence of Fit( 0 ),
					Equation( 1 )
				)
			)
		)
	),
	New Script(
		"Sum(Units) vs. Raw Fiscal Week Index",
		Graph Builder(
			Variables( X( :Raw Fiscal Week Index ), Y( :Name( "Sum(Units)" ) ) ),
			Elements(
				Points( X, Y, Legend( 5 ) ),
				Smoother( X, Y, Legend( 6 ) ),
				Line Of Fit(
					X,
					Y,
					Legend( 7 ),
					Confidence of Fit( 0 ),
					Equation( 1 )
				)
			)
		)
	),
	New Column( "First Day of Week",
		Numeric,
		"Continuous",
		Format( "m/d/y", 12 ),
		Input Format( "m/d/y" ),
		Set Selected,
		Set Values(
			[3628368000, 3628972800, 3629577600, 3630182400, 3630787200, 3631392000]
		)
	),
	New Column( "Raw Fiscal Week Index",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 15, 0 ),
		Set Values( [1, 2, 3, 4, 5, 6] )
	),
	New Column( "Fiscal Week YYYYWW",
		Character,
		"Ordinal",
		Set Values( {"201852", "201901", "201902", "201903", "201904", "201905"} )
	),
	New Column( "N Rows",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 0 ),
		Set Values( [3, 6, 5, 5, 5, 5] )
	),
	New Column( "Sum(Units)",
		Numeric,
		"Continuous",
		Format( "Best", 15 ),
		Set Values( [65, 251, 79, 162, 312, 340] )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMP Community Date Math.jpg" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17013i6D357515C4491244/image-size/large?v=v2&amp;amp;px=999" role="button" title="JMP Community Date Math.jpg" alt="JMP Community Date Math.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Apr 2019 17:54:54 GMT</pubDate>
    <dc:creator>BSwid</dc:creator>
    <dc:date>2019-04-25T17:54:54Z</dc:date>
    <item>
      <title>Date Based Equations, Line of Fit, Setting X to mean different units of time</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Based-Equations-Line-of-Fit-Setting-X-to-mean-different/m-p/194997#M41589</link>
      <description>&lt;P&gt;With JMP often we are asked to roll up raw data, group it by week, month, quarter, year, etc.&amp;nbsp; Then go look for a trend.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What are the best practices for dealing with longitudinal data?&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Data Type&lt;/LI&gt;&lt;LI&gt;Modeling Type&lt;/LI&gt;&lt;LI&gt;Format&lt;/LI&gt;&lt;LI&gt;Maybe tricks in graph builder?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I'm having trouble getting the graphical output to be both executive presentation friendly AND include an equation that makes sense.&amp;nbsp; &amp;nbsp;For example, it's typically with reference for what x represents.&amp;nbsp;Does X represent a date, a growing integer, a quarter, etc.?&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When&amp;nbsp; I use a "raw index" (just a integer for whatever frame of refrence, in this case weeks) the equation makes sense, but the graph x-axis labels aren't human readable.&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;Units are going up 47 units per week, but over what time frame?&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;When I use a date the represents the first day of the week, the x-axis on the graph looks nice but the equation doesn't lend insight.&amp;nbsp;&lt;STRONG&gt;The time frame is clear, but how fast are units increasing?&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here's an example with raw data rolled up to the week.&amp;nbsp; And we are interested in trend based on weekly increment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "DateMathExample_RollByWeek",
	Add Rows( 6 ),
	New Script(
		"Source",
		Data Table( "DateMathExample" ) &amp;lt;&amp;lt; Summary(
			Group( :First Day of Week, :Raw Fiscal Week Index, :Fiscal Week YYYYWW ),
			Sum( :Units ),
			Freq( "None" ),
			Weight( "None" ),
			Link to original data table( 0 ),
			output table name( "DateMathExample_RollByWeek" )
		)
	),
	New Script(
		"Sum(Units) vs. First Day of Week",
		Graph Builder(
			Variables( X( :First Day of Week ), Y( :Name( "Sum(Units)" ) ) ),
			Elements(
				Points( X, Y, Legend( 5 ) ),
				Smoother( X, Y, Legend( 6 ) ),
				Line Of Fit(
					X,
					Y,
					Legend( 7 ),
					Confidence of Fit( 0 ),
					Equation( 1 )
				)
			)
		)
	),
	New Script(
		"Sum(Units) vs. Raw Fiscal Week Index",
		Graph Builder(
			Variables( X( :Raw Fiscal Week Index ), Y( :Name( "Sum(Units)" ) ) ),
			Elements(
				Points( X, Y, Legend( 5 ) ),
				Smoother( X, Y, Legend( 6 ) ),
				Line Of Fit(
					X,
					Y,
					Legend( 7 ),
					Confidence of Fit( 0 ),
					Equation( 1 )
				)
			)
		)
	),
	New Column( "First Day of Week",
		Numeric,
		"Continuous",
		Format( "m/d/y", 12 ),
		Input Format( "m/d/y" ),
		Set Selected,
		Set Values(
			[3628368000, 3628972800, 3629577600, 3630182400, 3630787200, 3631392000]
		)
	),
	New Column( "Raw Fiscal Week Index",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 15, 0 ),
		Set Values( [1, 2, 3, 4, 5, 6] )
	),
	New Column( "Fiscal Week YYYYWW",
		Character,
		"Ordinal",
		Set Values( {"201852", "201901", "201902", "201903", "201904", "201905"} )
	),
	New Column( "N Rows",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 0 ),
		Set Values( [3, 6, 5, 5, 5, 5] )
	),
	New Column( "Sum(Units)",
		Numeric,
		"Continuous",
		Format( "Best", 15 ),
		Set Values( [65, 251, 79, 162, 312, 340] )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMP Community Date Math.jpg" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17013i6D357515C4491244/image-size/large?v=v2&amp;amp;px=999" role="button" title="JMP Community Date Math.jpg" alt="JMP Community Date Math.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2019 17:54:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Based-Equations-Line-of-Fit-Setting-X-to-mean-different/m-p/194997#M41589</guid>
      <dc:creator>BSwid</dc:creator>
      <dc:date>2019-04-25T17:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Date Based Equations, Line of Fit, Setting X to mean different units of time</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Based-Equations-Line-of-Fit-Setting-X-to-mean-different/m-p/195050#M41599</link>
      <description>&lt;P&gt;If you do value labels you can make the axis say anything you want.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);
dt = New Table( "DateMathExample_RollByWeek",
	Add Rows( 6 ),
	New Script(
		"Source",
		Data Table( "DateMathExample" ) &amp;lt;&amp;lt; Summary(
			Group( :First Day of Week, :Raw Fiscal Week Index, :Fiscal Week YYYYWW ),
			Sum( :Units ),
			Freq( "None" ),
			Weight( "None" ),
			Link to original data table( 0 ),
			output table name( "DateMathExample_RollByWeek" )
		)
	),
	New Script(
		"Sum(Units) vs. First Day of Week",
		Graph Builder(
			Variables( X( :First Day of Week ), Y( :Name( "Sum(Units)" ) ) ),
			Elements(
				Points( X, Y, Legend( 5 ) ),
				Smoother( X, Y, Legend( 6 ) ),
				Line Of Fit(
					X,
					Y,
					Legend( 7 ),
					Confidence of Fit( 0 ),
					Equation( 1 )
				)
			)
		)
	),
	New Script(
		"Sum(Units) vs. Raw Fiscal Week Index",
		Graph Builder(
			Variables( X( :Raw Fiscal Week Index ), Y( :Name( "Sum(Units)" ) ) ),
			Elements(
				Points( X, Y, Legend( 5 ) ),
				Smoother( X, Y, Legend( 6 ) ),
				Line Of Fit(
					X,
					Y,
					Legend( 7 ),
					Confidence of Fit( 0 ),
					Equation( 1 )
				)
			)
		)
	),
	New Column( "First Day of Week",
		Numeric,
		"Continuous",
		Format( "m/d/y", 12 ),
		Input Format( "m/d/y" ),
		Set Selected,
		Set Values(
			[3628368000, 3628972800, 3629577600, 3630182400, 3630787200, 3631392000]
		)
	),
	New Column( "Raw Fiscal Week Index",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 15, 0 ),
		Set Values( [1, 2, 3, 4, 5, 6] )
	),
	New Column( "Fiscal Week YYYYWW",
		Character,
		"Ordinal",
		Set Values( {"201852", "201901", "201902", "201903", "201904", "201905"} )
	),
	New Column( "N Rows",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 0 ),
		Set Values( [3, 6, 5, 5, 5, 5] )
	),
	New Column( "Sum(Units)",
		Numeric,
		"Continuous",
		Format( "Best", 15 ),
		Set Values( [65, 251, 79, 162, 312, 340] )
	)
);
//making a value labels list
// format is {actual value = shown value}
labels = {};
for(i=1, i&amp;lt;=nrows(dt), i++, 
	insert into(labels, 
		EvalExpr( //this is to keep it an unevaluated expression
			//the Expr() just says to evaluate that part but leave the rest as is
			// we're trying to get 1 = "12/23/2018" to be the first item in the list
			Expr(Column(dt, "Raw Fiscal Week Index")[i]) = 
			// the date is a number so we have to turn it into string
			Expr(short date(Column(dt, "First Day of Week")[i]) )
		)
	);
);
show(labels);
Column(dt, "Raw Fiscal Week Index") &amp;lt;&amp;lt; Set Property("Value Labels", 
	labels
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2019 23:19:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Based-Equations-Line-of-Fit-Setting-X-to-mean-different/m-p/195050#M41599</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2019-04-25T23:19:12Z</dc:date>
    </item>
  </channel>
</rss>

