I am discovering PSTricks's plotstyle=LSM to make a regression analysis y=m x + c. Here is my code:

0.0     0.0
144.321  0.84
159.407     0.8925




\psaxes[axesstyle=frame,Dx=50,Dy=0.5, ticksize=0 4pt](150,3)
\listplot [xStart=0, xEnd=150,xunit=1,plotstyle=values,rot=90] {\data}
\listplot [xStart=0,xEnd=150,xunit=1,linewidth=1.5pt,linecolor=red,showpoints, dotstyle=square] {\data}
\listplot[PstDebug=1,xStart=0, xEnd=150,xunit=1,plotstyle=LSM,linecolor=blue, linestyle=dashed]{\data}


The parameter xEnd=150 makes the Linear regression analysis only to consider the first two lines of the data file.

On compiling I get the line equation as

y = 0.291017 x + 9.64966e-08

I see that the gradient of 0.291017 seems to be wrong as the gradient should be 0.84/144.321 = 0.0058...

What am I doing wrong here?


that was a problem with different axes unit. Try it with this version:


With this file it works for me.

And by the way, there is now a pst-fit, see http://texnik.dante.de/doc/generic/pst-fit/pst-fit-doc.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.