Discussion:
PSPP Regression with /noorigin
Hulliger Beat
2017-04-25 07:39:45 UTC
Permalink
Last week a student asked me whether he should eliminate the intercept in a simple linear regression when it is not significantly different from 0. Yes, I said: It is very simple to remove it in PSPP. How wrong was I! There is no option /NOORIGIN in the PSPP Regression procedure.

I have seen the discussions about this issue and the corresponding proposals. I tried GLM but no coefficients are output. I tried with dummies but a bit of algebra convinced me that this does not work. I thought the simplest thing is to delete the column of ones in the design matrix. I have downloaded the code and looked into linreg.c. Of course, things are a bit more complicated than it seems at first. Say, my knowledge of C is not enough to venture into the code.

So back to crude SPSS-Syntax for simple linear regression (say a ratio model): See the code below.

It would be nice to have a /noorigin option in the Regression procedure!

Beat

-------------
* Regression through the origin: Ratio model with PSPP.
* Assign y and x.
compute y = Balance.
compute x = ATM.

* Regression y=beta*x.
COMPUTE xx = x * x.
COMPUTE yx = y * x.
COMPUTE one = 1.
EXECUTE.

AGGREGATE OUTFILE=* MODE=ADDVARIABLES
/PRESORTED
/BREAK= one
/sumyx = SUM (yx)
/sumxx = SUM (xx)
/nsamp = sum(one).

COMPUTE beta = sumyx/sumxx.
COMPUTE resid = y - beta * x.
COMPUTE resid2 = resid * resid.

AGGREGATE OUTFILE=* MODE=ADDVARIABLES
/PRESORTED
/BREAK= one
/SSE = SUM (resid2).

COMPUTE SER = sqrt(SSE/(nsamp-1)).
EXECUTE.

LIST
/Variables beta SER
/cases = from 1 to 1.

delete variables y x one yx xx sumyx sumxx nsamp beta resid2 SSE SER.
John Darrington
2017-04-28 16:22:30 UTC
Permalink
On Tue, Apr 25, 2017 at 07:39:45AM +0000, Hulliger Beat wrote:

Last week a student asked me whether he should eliminate the intercept in a simple linear regression when it is not significantly different from 0. Yes, I said: It is very simple to remove it in PSPP. How wrong was I! There is no option /NOORIGIN in the PSPP Regression procedure.

I have seen the discussions about this issue and the corresponding proposals. I tried GLM but no coefficients are output. I tried with dummies but a bit of algebra convinced me that this does not work. I thought the simplest thing is to delete the column of ones in the design matrix. I have downloaded the code and looked into linreg.c. Of course, things are a bit more complicated than it seems at first. Say, my knowledge of C is not enough to venture into the code.

Unfortunately the author who contributed the regression code is no longer active in PSPP.

What happens when you try removing the ones column? Does it do anything reasonable?

J'
--
Avoid eavesdropping. Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.
martin cohen
2017-04-29 16:35:42 UTC
Permalink
If it is a simple y vs. x regression through the origin, the slope is easily shown to be
sum(xy)/sum(x^2). Marty ***@acm.org

From: "pspp-users-***@gnu.org" <pspp-users-***@gnu.org>
To: pspp-***@gnu.org
Sent: Saturday, April 29, 2017 9:04 AM
Subject: Pspp-users Digest, Vol 131, Issue 11

Send Pspp-users mailing list submissions to
    pspp-***@gnu.org

To subscribe or unsubscribe via the World Wide Web, visit
    https://lists.gnu.org/mailman/listinfo/pspp-users
or, via email, send a message with subject or body 'help' to
    pspp-users-***@gnu.org

You can reach the person managing the list at
    pspp-users-***@gnu.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Pspp-users digest..."


Today's Topics:

  1. Re: PSPP Regression with /noorigin (John Darrington)


----------------------------------------------------------------------

Message: 1
Date: Fri, 28 Apr 2017 18:22:30 +0200
From: John Darrington <***@darrington.wattle.id.au>
To: Hulliger Beat <***@fhnw.ch>
Cc: "pspp-***@gnu.org" <pspp-***@gnu.org>
Subject: Re: PSPP Regression with /noorigin
Message-ID: <***@jocasta.intra>
Content-Type: text/plain; charset="us-ascii"

On Tue, Apr 25, 2017 at 07:39:45AM +0000, Hulliger Beat wrote:
   
    Last week a student asked me whether he should eliminate the intercept in a simple linear regression when it is not significantly different from 0. Yes, I said: It is very simple to remove it in PSPP. How wrong was I! There is no option /NOORIGIN in the PSPP Regression procedure.
   
    I have seen the discussions about this issue and the corresponding proposals. I tried GLM but no coefficients are output. I tried with dummies but a bit of algebra convinced me that this does not work.  I thought the simplest thing is to delete the column of ones in the design matrix. I have downloaded the code and looked into linreg.c. Of course, things are a bit more complicated than it seems at first. Say, my knowledge of C is not enough to venture into the code.
   
Unfortunately the author who contributed the regression code is no longer active in PSPP.

What happens when you try removing the ones column?  Does it do anything reasonable?

J'
--
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.gnu.org/archive/html/pspp-users/attachments/20170428/1617fd8f/attachment.pgp>

------------------------------

Subject: Digest Footer

_______________________________________________
Pspp-users mailing list
Pspp-***@gnu.org
https://lists.gnu.org/mailman/listinfo/pspp-users


------------------------------

End of Pspp-users Digest, Vol 131, Issue 11
*******************************************
John Darrington
2017-05-13 05:27:44 UTC
Permalink
On Tue, Apr 25, 2017 at 07:39:45AM +0000, Hulliger Beat wrote:

Last week a student asked me whether he should eliminate the intercept in a simple linear regression when it is not significantly different from 0. Yes, I said: It is very simple to remove it in PSPP. How wrong was I! There is no option /NOORIGIN in the PSPP Regression procedure.

I have seen the discussions about this issue and the corresponding proposals. I tried GLM but no coefficients are output. I tried with dummies but a bit of algebra convinced me that this does not work. I thought the simplest thing is to delete the column of ones in the design matrix. I have downloaded the code and looked into linreg.c. Of course, things are a bit more complicated than it seems at first. Say, my knowledge of C is not enough to venture into the code.

So back to crude SPSS-Syntax for simple linear regression (say a ratio model): See the code below.

It would be nice to have a /noorigin option in the Regression procedure!

I have pushed a change impementing the /origin and /noorigin options.
/noorigin (ie. the intercept is included in the model) is the default.
Right now I have given it only a few rudimentary tests, so - as always - caveat emptor!

J'
--
Avoid eavesdropping. Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.
John Darrington
2017-05-13 09:38:55 UTC
Permalink
I pushed it only within the last hour. So if you want to try it, you will need to
check it out from the git repository and bootstrap it yourself.

See https://savannah.gnu.org/git/?group=pspp

J'

On Sat, May 13, 2017 at 08:54:48AM +0000, Hulliger Beat wrote:
Dear John

Thanks a lot for the implementation!

I tried it with a data set I use in teaching. Unfortunately it does not work. However, I am not 100% sure whether I used your last implementation: I have downloaded and installed GNU pspp 0.10.4-g1f24fd which is from 8 May 2017.

Best wishe,
Beat



It would be nice to have a /noorigin option in the Regression procedure!

I have pushed a change impementing the /origin and /noorigin options.
/noorigin (ie. the intercept is included in the model) is the default.
Right now I have given it only a few rudimentary tests, so - as always - caveat emptor!

J'
--
Avoid eavesdropping. Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.
ftr public
2017-05-14 13:14:38 UTC
Permalink
I guess this runs under Linux only ? I work with Windows.

- ftr
Post by John Darrington
I pushed it only within the last hour. So if you want to try it, you will need to
check it out from the git repository and bootstrap it yourself.
See https://savannah.gnu.org/git/?group=pspp
J'
Dear John
Thanks a lot for the implementation!
I tried it with a data set I use in teaching. Unfortunately it does not work. However, I am not 100% sure whether I used your last implementation: I have downloaded and installed GNU pspp 0.10.4-g1f24fd which is from 8 May 2017.
Best wishe,
Beat
It would be nice to have a /noorigin option in the Regression procedure!
I have pushed a change impementing the /origin and /noorigin options.
/noorigin (ie. the intercept is included in the model) is the default.
Right now I have given it only a few rudimentary tests, so - as always - caveat emptor!
J'
_______________________________________________
Pspp-users mailing list
https://lists.gnu.org/mailman/listinfo/pspp-users
John Darrington
2017-05-14 16:34:19 UTC
Permalink
On Sun, May 14, 2017 at 03:14:38PM +0200, ftr public wrote:
I guess this runs under Linux only ? I work with Windows.


PSPP is part of the GNU project [1]. As such, it runs best on GNU. It also
runs on GNU/Linux [2]. We also try to make sure it runs as well as possible
on other free operating systems, such as FreeBSD. In addition, we have
had reports that it runs OK on Windows, Mac, and other proprietary systems.
However GNU and GNU/Linux always were, and will remain the priority. If there
ever was (for some strange reason) a situation where PSPP could be made to run
on GNU OR Windows, but not both - then GNU would be the one we would choose.
However that situation hasn't come about.


We do have an (incomplete) list of systems for which we are aware PSPP works [3]
We don't distribute precompiled binaries of PSPP - to do so for all the hundreds
of variants of the dozens of operating systems in the world would not be feasible.
So the short answer to your question is - it runs on whatever system you compile
it to run on.


J'


[1] : http://www.gnu.org
[2] : https://www.gnu.org/gnu/linux-and-gnu.html
[3] : https://www.gnu.org/software/pspp/get.html
--
Avoid eavesdropping. Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.
Harry Thijssen
2017-05-13 19:16:02 UTC
Permalink
Hi Beat

A little explanation. The PSPP developers produce a PSPP source. The
packages a lot of users use or not produced within the PSPP project.
When you encounter problems It is better if you state which operating
system you use to avoid confusion.

I just build a new MSWindows test version. Try that one.

Have fun
Post by John Darrington
Dear John
Thanks a lot for the implementation!
I tried it with a data set I use in teaching. Unfortunately it does
not work. However, I am not 100% sure whether I used your last
implementation: I have downloaded and installed GNU pspp 0.10.4-g1f24fd
which is from 8 May 2017.
Best wishe,
Beat
It would be nice to have a /noorigin option in the Regression
procedure!
I have pushed a change impementing the /origin and /noorigin options.
/noorigin (ie. the intercept is included in the model) is the default.
Right now I have given it only a few rudimentary tests, so - as
always - caveat emptor!
J'
Hulliger Beat
2017-08-11 13:32:42 UTC
Permalink
Dear John and Harry

Sorry for the long silence.

I tested the /origin command with a multiple regression with 6 independent variables on a larger dataset (the regression is only partially useful). I used the new windows installer 0.10.5pre3-g9a68ff. The output of SPSS and PSPP coincides, i.e. I could not see any difference. I attach the output as pdfs.

Thanks again!

Best wishes,
Beat
John Darrington
2017-08-11 14:23:07 UTC
Permalink
Thanks for taking the time to test it.

J'

On Fri, Aug 11, 2017 at 01:32:42PM +0000, Hulliger Beat wrote:

I tested the /origin command with a multiple regression with 6 independent variables on a larger dataset (the regression is only partially useful). I used the new windows installer 0.10.5pre3-g9a68ff. The output of SPSS and PSPP coincides, i.e. I could not see any difference. I attach the output as pdfs.
--
Avoid eavesdropping. Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.
Loading...