Post Reply 
HP 50g — import statistical data into hypothesis test
12-07-2018, 05:30 PM
Post: #11
RE: HP 50g — import statistical data into hypothesis test
(12-07-2018 04:22 AM)Carsen Wrote:  
Code:

<<  MEAN OBJ-> DROP SDEV OBJ-> DROP 'S2' STO 'S1' STO 'X2' STO 'X1' STO { X1 X2 S1 S2 } ORDER >> ***Assuming column 1 of ∑DAT is X and column 2 is Y.***

I'm mostly ignorant of the statistical features of the 50g (and statistics in general), but looking at the above code, it strikes me that there's a simplification that might be useful here. STO has the ability to accept lists of both values and variable names, so an alternative form of the above could be:
Code:
\<<
    MEAN AXL SDEV AXL + REVLIST { S2 S1 X2 X1 } STO
\>>

STO iterates through the ID list in the order given, matching the IDs with the corresponding values in the list from stack level 2. Since the most recently stored object shows up at the beginning of your var list (assuming it hasn't already been stored in the current search path), I've reversed the order of values and IDs so that they end up in the desired order without having to execute the ORDER command. The downside to this is that subsequent calls to the program won't move the variables to the beginning of the directory. If this is important, a slight change to the above should take care of that:
Code:
\<<
    MEAN AXL SDEV AXL + { X1 X2 S1 S2 } SWAP OVER STO ORDER
\>>

Finally, a word of caution about the ORDER command:

If ORDER is executed from a running program, there's a particular situation that will cause it to throw an "Invalid Syntax" error. If the program object containing the ORDER command would itself be moved as a result of its execution, the command will fail, sometimes after already having moved some of the identified objects. I believe that's not likely to happen here, but it's useful to bear that in mind whenever using ORDER in a program.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 50g — import statistical data into hypothesis test - DavidM - 12-07-2018 05:30 PM



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