# HP Forums

Full Version: Help with creating residual plot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hello!
I searched the internet high and low, but I could not find any information how to create a residual plot after you run the linear regression. It is simple on a TI calculator used as an example in my class, but I am clueless on how to do the same on my HP50g.
When I attempt to create a list of residual by entering "L2-Y1(L1)" it creates an error because "Y1(L1)" creates a list with one additional number that I am not sure where is coming from.
But, yes, I am very clueless on how to do this.

Hope you all can help,
Phillip

I've got a 48gII, not a 50, but my understanding is that it's similar enough to be getting on with. The question then becomes: how are you creating your L1, your L2, and your Y1?

A bit of playing around shows that if I have something like '.505+1.475*X' stored into Y1, if I then execute Y1 on a list L1 (in either RPN or alg mode) I get a result list whose first element is .505 and the other elements are 1.475 times the elements of L1.

If I write Y1 instead using "ADD" instead of + (in RPN, << 1.475 * .505 ADD>>; probably something similar in alg) then it works as expected. Also, if I rewrite the equation to '1.475*X-(-.505)' it works as expected.

It looks like + is the only operator that doesn't act on each member of a list, which seems a little annoying.

Hi I don't undersstand what are L1 and L2 here...

Perhaps one way is a small program considering that:

- The stat matrix is \GSDAT (SigmaDAT)

- The predicted value given with the PREDV command

And add a new column in the stat matrix with mesured vaue minus expected value

Are you in RPL mode ?

Example :

```« \GSDAT DUP ->COL DROP SWAP « PREDV » MAP - 3 COL+ »
[[ 1. 10. ]
[ 2. 23. ]
[ 3. 29. ]]
->  '1.66666666667+9.5*X'
[[ 1. 10. -1.1666666667 ]
[ 2. 23. 2.3333333333 ]
[ 3. 29. -1.1666666667 ]]
Then you can draw the plot
```

Edited: 10 Oct 2012, 2:39 p.m.