• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 Stats resid func does not work with median-median
07-10-2015, 02:21 PM
Post: #1
 mkokot Junior Member Posts: 2 Joined: Oct 2015 Reputation: 0
Stats resid func does not work with median-median
In the process of helping my daughter with her Advance Algebra course we found that the Resid() function does not work with the Statistics 2Var App when Median-Median is the method used. We get "Error: Invalid input" when entering Resid(S1).

This works just fine when using the Linear mode or other types.

I am using the latest firmware of rev: 8151.
11-10-2015, 09:43 PM
Post: #2
 mkokot Junior Member Posts: 2 Joined: Oct 2015 Reputation: 0
RE: Stats resid func does not work with median-median
(07-10-2015 02:21 PM)mkokot Wrote:  In the process of helping my daughter with her Advance Algebra course we found that the Resid() function does not work with the Statistics 2Var App when Median-Median is the method used. We get "Error: Invalid input" when entering Resid(S1).

This works just fine when using the Linear mode or other types.

I am using the latest firmware of rev: 8151.

After researching this more it would appear the median-median mode in Statistics 2Var app was something just recently added and it has not fully been integrated in with the rest of the stats functions and resid is not the only function that does not work with this mode. The median-median line method of solving a set of points seems to be popular with high school algebra texts books so I took the time to write this simple little program to resolve this. Maybe in the near future a new firmware will fix this but until then here is a simple way to work around this. I also create a spread sheet with results, but it is to ugly to share. I will paste the code for residmed() below.

To use this properly first go into your Statistics 2Var App and enter your x & y values and generate the y=mx+b formula for a Median-Median line. Place your cursor in the Fit1 field and copy the formula generated when using the Type1: Median-Median. To copy use the Shift/Copy keys. Next go to your home key and on the line type "residmed(" here paste back your forumal but replace the "*x" with a "," to pass the function the slope and the y intercept values. Then close the function call with a ")"

So it will look something like this "residmed(.025, 3)". This function then returns a list of residuals. If you wanted the sum of all the residuals you would type something like this. -> sum(residmed(.025, 3))

Here is the simple code from the program residmed().

//sl Passed in slope value
//yin Passed in y intercept
EXPORT residmed(sl,yin)
BEGIN

local n;

L1 :={}; // list of X values
L2 :={}; // list of Y values
L3 :={}; // list of residuals

//Get list of X values from Stats 2Var app
L1 := Statistics_2Var.C1;

//Get list of Y values from Stats 2Var app
L2 := Statistics_2Var.C2;

// Compute list of y^ and build list of residuals
n:=1;
while (n <= Statistics_2Var.NbItem) do
L3(n) := L2(n) - ((L1(n)*sl) +yin);
n:= n+1;
end;

return L3;

END;
 « Next Oldest | Next Newest »

Forum Jump:

User(s) browsing this thread: 1 Guest(s)