<?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 Re: Replacing missing data by regressed values in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/256059#M50297</link>
    <description>&lt;P&gt;Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so&amp;nbsp; much. this works really well now. can you explain to me what the last "values[Row()];" does&lt;/P&gt;</description>
    <pubDate>Sat, 04 Apr 2020 01:01:16 GMT</pubDate>
    <dc:creator>tatersalad</dc:creator>
    <dc:date>2020-04-04T01:01:16Z</dc:date>
    <item>
      <title>Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19440#M17725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have a time series for which the variable has missing values. I would like to replace the missing values by a linear model derived from the closest available values in time.&lt;/P&gt;&lt;P&gt;What would be the best way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if the script could do that to all the columns of my table (except the time), that would be even better &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro_emoticon jive_emote jive_macro" src="https://community.jmp.com/7.0.4.3b79b96/images/emoticons/happy.png"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN style="color: #575757; text-decoration: underline;"&gt;What I have&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="240" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;6&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#505050&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#F2F2F2&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;6&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" style="border: 1px solid #c6c6c6; border-image: none; width: 119px; height: 242px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="padding: 6px; width: 25px; text-align: left; color: #505050; background-color: #f2f2f2;" valign="middle"&gt;&lt;STRONG&gt;t&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="padding: 6px; width: 50px; text-align: left; color: #505050; background-color: #f2f2f2;" valign="middle"&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;20&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;What I want:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="230" style="border: 1px solid #c6c6c6; border-image: none; width: 132px; height: 219px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: left; background-color: #f2f2f2; color: #505050; padding: 6px;" valign="middle"&gt;&lt;STRONG&gt;t&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: left; background-color: #f2f2f2; color: #505050; padding: 6px;" valign="middle"&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;&lt;EM&gt;15&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;&lt;EM&gt;20&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;&lt;EM&gt;22.5&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;20&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2016 14:39:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19440#M17725</guid>
      <dc:creator>guilhem</dc:creator>
      <dc:date>2016-07-08T14:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19441#M17726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this for starters&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/docs/DOC-6232" target="_blank"&gt;Imputation Addin&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2016 13:28:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19441#M17726</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2016-10-28T13:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19442#M17727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ron but I don’t see anything in this that does interpolation?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Jul 2016 21:31:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19442#M17727</guid>
      <dc:creator>guilhem</dc:creator>
      <dc:date>2016-07-10T21:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19443#M17728</link>
      <description>&lt;P&gt;here is a script that will do the task&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;STRIKE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
For( rows = 1, rows &amp;lt;= N Rows( dt ), rows++,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If( Rows == 1, counter = 0 );
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If( Is Missing( dt:output[rows] ) == 1,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = counter + 1,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If( counter &amp;gt; 0,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; incr = (dt:output[Rows] - dt:output[Rows - counter - 1]) / (counter + 1);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For( i = Rows - counter, i &amp;lt;= Rows - 1, i++,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt:output = dt:output[i - 1] + incr
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );
);&lt;/CODE&gt;&lt;/STRIKE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Set all default referenced memory variables to this unique application
Names Default To Here( 1 );

// Set the variable dt to be a pointer to the current active data table
dt = Current Data Table();

// Loop through the data table from row 1 to the last row and use a
// variable names "rows" as the index
For( rows = 1, rows &amp;lt;= N Rows( dt ), rows++, 

	// If this is row 1 initialize a variable named counter to 1
	If( Rows == 1, counter = 0 );
       
    // If the current row's value for the column named "Output" in the 
	// data table referenced by "dt" is missing (blank, null) increase
	// the counter
	If( Is Missing( dt:output[rows] ) == 1, 
		counter++
	);
	
	// If row is found with a non missing value for the column called Output,
	// and the counter is &amp;gt; 0, which indicates previous rows with missing
	// values, then calculate the required values and place them in their
	// appropriate rows
	If( counter &amp;gt; 0 &amp;amp; Is Missing( dt:output[rows] ) == 0,
		// Calculate the incremental steps to use for the missing cells
		incr = (dt:output[Rows] - dt:output[Rows - counter - 1]) / (counter + 1);
		
		// Loop across the rows with missing values and fill in the data
		For( i = Rows - counter, i &amp;lt;= Rows - 1, i++,
			dt:output[i] = dt:output[i - 1] + incr
		);
		
		// reinitialize the counter
		counter = 0;
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 17:03:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19443#M17728</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-02-27T17:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19444#M17729</link>
      <description>&lt;P&gt;I had a similar problem some years ago and wrote a script to do imputation by "local regression".&lt;/P&gt;
&lt;P&gt;Here's an updated version:&lt;/P&gt;
&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #032ce4;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="MsoNormal" style="mso-pagination: none; mso-layout-grid-align: none; text-autospace: none;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
n = N Rows(dt);
x = Column(1);// Column("t")
For(i = 2, i &amp;lt;= N Col(dt), i++,
&amp;nbsp;&amp;nbsp;&amp;nbsp; y = Column(i);
&amp;nbsp;&amp;nbsp;&amp;nbsp; For Each Row(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(1 &amp;lt; Row() &amp;lt; n &amp;amp; Is Missing(y[]),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // find previous non-missing row
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Eval(Eval Expr(r1 = Max(dt &amp;lt;&amp;lt; get rows where(!Is Missing(y[]) &amp;amp; Row() &amp;lt; Expr(Row())))));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // find next non-missing row
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Eval(Eval Expr(r2 = Min(dt &amp;lt;&amp;lt; get rows where(!Is Missing(y[]) &amp;amp; Row() &amp;gt; Expr(Row())))));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y[] = y[r1] + (y[r2] - y[r1]) / (x[r2] - x[r1]) * (x[] - x[r1]);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )
&amp;nbsp;&amp;nbsp;&amp;nbsp; )
&amp;nbsp;&amp;nbsp;&amp;nbsp;
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P class="MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&lt;SPAN style="color: #011993;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 27 Feb 2020 14:28:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19444#M17729</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2020-02-27T14:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19445#M17730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Spot on MS,&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2016 08:28:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/19445#M17730</guid>
      <dc:creator>guilhem</dc:creator>
      <dc:date>2016-07-11T08:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/249436#M48983</link>
      <description>&lt;P&gt;txnelson,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could you update the script with comments? I am new to JSL and need help understanding how it applies to my problem. I have the same need as OP but only have one column that i need to fill in.&amp;nbsp; alternatively, I have used the following VBA code in the past in to fill in missing data in excel. I was wondering if there is something similar to the End(xlDown).value function in JSL. the offset is used to specify where the time point data is. Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Sub interpolatedata()
For Each cell In Range("k4:k29") 
If cell.Value = "" Then
y2 = cell.End(xlDown).Value
x2 = cell.End(xlDown).Offset(0, -8).Value
y1 = cell.End(xlUp).Value
x1 = cell.End(xlUp).Offset(0, -8).Value
x = cell.Offset(0, -8).Value
y = (y1) + (x - x1) * (y2 - y1) / (x2 - x1)
cell.Value = y
End If
Next&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 14:25:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/249436#M48983</guid>
      <dc:creator>tatersalad</dc:creator>
      <dc:date>2020-02-27T14:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/249488#M48994</link>
      <description>&lt;P&gt;Here is an updated/annotated version of my original code.&amp;nbsp; All you should have to do, is to change the column name from "Output" to whatever the name of the column you want to change values to.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Set all default referenced memory variables to this unique application
Names Default To Here( 1 );

// Set the variable dt to be a pointer to the current active data table
dt = Current Data Table();

// Loop through the data table from row 1 to the last row and use a
// variable names "rows" as the index
For( rows = 1, rows &amp;lt;= N Rows( dt ), rows++, 

	// If this is row 1 initialize a variable named counter to 1
	If( Rows == 1, counter = 0 );
       
    // If the current row's value for the column named "Output" in the 
	// data table referenced by "dt" is missing (blank, null) increase
	// the counter
	If( Is Missing( dt:output[rows] ) == 1, 
		counter++
	);
	
	// If row is found with a non missing value for the column called Output,
	// and the counter is &amp;gt; 0, which indicates previous rows with missing
	// values, then calculate the required values and place them in their
	// appropriate rows
	If( counter &amp;gt; 0 &amp;amp; Is Missing( dt:output[rows] ) == 0,
		// Calculate the incremental steps to use for the missing cells
		incr = (dt:output[Rows] - dt:output[Rows - counter - 1]) / (counter + 1);
		
		// Loop across the rows with missing values and fill in the data
		For( i = Rows - counter, i &amp;lt;= Rows - 1, i++,
			dt:output[i] = dt:output[i - 1] + incr
		);
		
		// reinitialize the counter
		counter = 0;
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 17:22:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/249488#M48994</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-02-27T17:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/249595#M49019</link>
      <description>&lt;P&gt;thanks it worked!&amp;nbsp; you commented&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;If this is row 1 initialize a variable named counter to 1&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;, did you mean "counter to 0"?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 09:26:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/249595#M49019</guid>
      <dc:creator>tatersalad</dc:creator>
      <dc:date>2020-02-28T09:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/249599#M49020</link>
      <description>&lt;P&gt;Good catch....it should be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If this is row 1 initialize a variable named counter to 0&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Feb 2020 11:03:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/249599#M49020</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-02-28T11:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255835#M50246</link>
      <description>&lt;P&gt;Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a difference between "rows" and "Rows"? could you please explain it. I'm a noob.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 00:20:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255835#M50246</guid>
      <dc:creator>tatersalad</dc:creator>
      <dc:date>2020-04-03T00:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255845#M50248</link>
      <description>JMP is not case specific in functions and statements, so rows=Rows</description>
      <pubDate>Fri, 03 Apr 2020 01:54:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255845#M50248</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-04-03T01:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255857#M50251</link>
      <description>&lt;P&gt;Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for clarifying. I;m having a problem with the script. it wont execute and interpolate the last interval.&amp;nbsp; i cant tell if it has something to do with the nesting of the loops or the "while" conditions. basically regardless of table length it cant fill in the last interval of missing data.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;col_name_list = Current Data Table() &amp;lt;&amp;lt; get column names( string );      
If( !Contains( col_name_list, "Interpolated p (g/L)" ),      
	Current Data Table() &amp;lt;&amp;lt; New Column(      
		"Interpolated p (g/L)",      
		Numeric,     
		Continuous,     
		Formula(
			If(
				Is Missing( :Name( "time (h)" ) ), 
					Empty(),
				:name( "time (h)" ) == 0,
					0,
				!Is Missing( :Name( "p (g/L)" ) ), 
				:name( "p (g/L)" ), 	
				dt = Current Data Table();
				For( rows = 1, rows &amp;lt;= (N Rows( dt )), rows++, 
					If( Rows == 1, counter = 0 );
					If( Is Missing( dt:name( "Interpolated p (g/L)" )[rows] ) == 1,
						counter++);
					If( counter &amp;gt; 0 &amp;amp; Is Missing( dt:name( "Interpolated p (g/L)" )[rows] ) == 0, 
					
						incr = (dt:name( "Interpolated p (g/L)" )[Rows] - dt:name( "Interpolated p (g/L)" )[Rows - counter - 1]) / (dt
						:name( "time (h)" )[Rows] - dt:name( "time (h)" )[Rows - counter - 1]);
						For( i = rows - counter, i &amp;lt;= rows - 1, i++,
							dt:name( "Interpolated p (g/L)" )[i] = dt:name( "Interpolated p (g/L)" )[i - 1] + (incr * (dt:name( "time (h)" )[i]
							-dt:name( "time (h)" )[i - 1]))
						);
						
						counter = 0;
					);
				);
			)
		)
			
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 02:48:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255857#M50251</guid>
      <dc:creator>tatersalad</dc:creator>
      <dc:date>2020-04-03T02:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255858#M50252</link>
      <description>&lt;P&gt;heres the table&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 02:50:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255858#M50252</guid>
      <dc:creator>tatersalad</dc:creator>
      <dc:date>2020-04-03T02:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255879#M50258</link>
      <description>&lt;P&gt;You are running into a recursive issue in the formula, when you try to change values within the formula column itself.&amp;nbsp; I have reworked your formula to do all of the work upfront using a matrix.&amp;nbsp; The resulting values are then used for each rows values&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

col_name_list = Current Data Table() &amp;lt;&amp;lt; get column names( string );
If( !Contains( col_name_list, "Interpolated p (g/L)" ),
	Current Data Table() &amp;lt;&amp;lt; New Column( "Interpolated p (g/L)",
		Numeric,
		Continuous,
		Formula(
			dt = Current Data Table();
			If( Row() == 1,
				counter = 0;
				values = dt:Name( "p (g/L)" ) &amp;lt;&amp;lt; get values;
				If( Is Missing( values[1] ),
					values[1] = 0
				);
				counter = 0;
				For( i = 1, i &amp;lt;= N Rows( values ), i++,
					If( Is Missing( values[i] ),
						counter++,
						If( counter &amp;gt; 0,
							For( k = 1, k &amp;lt;= counter, k++,
								base = values[i - counter - 1];
								incr = Abs( (base - values[i]) / (counter + 1) );
								If( base &amp;lt; values[i],
									values[(i - counter - 1) + k] = base + k * incr,
									values[(i - counter - 1) + k] = base - k * incr
								);
							);
							counter = 0;
						)
					)
				);
			);
			values[Row()];
		)
			
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Apr 2020 11:14:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255879#M50258</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-04-03T11:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255947#M50272</link>
      <description>&lt;P&gt;Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much i'll give it a shot. I'm curious though; going back to the original script i thought the recursive error came from row 3, because of it would go to calculate incr and get rows-counter-1 = 3-2-1 =0. i'd ignore the error message and it successfully interpolates the rest of the column, except for the very end.&amp;nbsp; adding more data to the table to be be interpolated moves the problem down. i thought they might be separate issues.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 16:56:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255947#M50272</guid>
      <dc:creator>tatersalad</dc:creator>
      <dc:date>2020-04-03T16:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255949#M50274</link>
      <description>From my experiences, I have had too many issues when attempting to reference the actual formula column within the formula.  Thus, the approach shown.  I also was concerned with your formula from the standpoint of the number of times you are running through the data with your For() loop.  My method steps through the data table only once....not counting the iteration replacement.</description>
      <pubDate>Fri, 03 Apr 2020 17:07:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/255949#M50274</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-04-03T17:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/256010#M50281</link>
      <description>&lt;P&gt;Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got the script to work. I had to add some math so as to account for the delta time for both the incr calculation for interpolation evaluation loop. final problem is that since i am planning on joining multiple run files together and running the script, I'll have multiple spots where time = 0 (time: 0,12,24,48,0,12,24,48...), thus the first interpolated value should be 0 for the given chunk of data. I'm not sure how to do this with the matrix notation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 19:50:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/256010#M50281</guid>
      <dc:creator>tatersalad</dc:creator>
      <dc:date>2020-04-03T19:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/256012#M50283</link>
      <description>&lt;P&gt;From the code I supplied you, is this what you are asking about?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;
				If( Is Missing( values[1] ),
					values[1] = 0
				);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Apr 2020 19:56:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/256012#M50283</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-04-03T19:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing data by regressed values</title>
      <link>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/256014#M50284</link>
      <description>&lt;P&gt;that does it for the first value, but what i need is everything "Time" is 0, the interpolated value is zero. the time column will have multiple 0's&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 20:05:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Replacing-missing-data-by-regressed-values/m-p/256014#M50284</guid>
      <dc:creator>tatersalad</dc:creator>
      <dc:date>2020-04-03T20:05:52Z</dc:date>
    </item>
  </channel>
</rss>

