patchPSPP - Patches: patch #6488, test for QR decomposition in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #6488: test for QR decomposition in REGRESSION

Submitter:  Jason H Stover <jstover>
Submitted:  Wed 09 Apr 2008 03:55:47 AM UTC
   
 
Category:  None Item Group:  None
Status:  Done Assigned to:  None
Open/Closed:  Closed

Thu 17 Apr 2008 04:49:42 AM UTC, comment #5: 

Closing this patch, as it has been committed.

John Darrington <jmd>
Group administrator
Mon 14 Apr 2008 03:49:54 AM UTC, comment #4: 

If that's what you think best, then I'm happy with it.

John Darrington <jmd>
Group administrator
Mon 14 Apr 2008 03:15:30 AM UTC, comment #3: 

I was trying to make a test something like

grep -i regression | awk '{print $3}'| (some diff action here)

But that got unwieldly fast. This could be another area where PSPP could benefit from being able to save its estimated values in some portable format besides tables meant for human eyes.

Anyway, I'm thinking now the best test is to just use the hard-coded large data set. If no one has any objections, I'll check in the original version of this patch.

Jason H Stover <jstover>
Group Member
Wed 09 Apr 2008 06:44:28 PM UTC, comment #2: 

Randomly generating the data might work, but then the test won't be a straightforward diff. If the least squares line passes exactly through the data, the standard errors of the estimated coefficients will be exactly 0. This stored standard error will be 0 to machine precision, or close to 0, and will then be used in the denominator of any test statistics appearing in the 't' and 'F' columns of the output tables. Since these values are close to, but not exactly 0, and also random, dividing by them will produce random, huge test statistics which will fail the diff. That's what happened to me when I ran the randomly-generated data through make check (output below).

The problem is that the true value of the test statistic is infinity. So to use the randomly-generated data in the test, we either need to:

1. Alter the test so it doesn't just diff the results, but actually compares the relative errors inside the tables, or

2. Change the code to make REGRESSION report 0.0 and FP_INFINITE for the mean squared error and test statistics, respectively. I suspect this approach would cause other, bigger problems elsewhere.

Here is the failed test output:

 11c11
< #        |Regression#     1.01E+010|   2|   5.1E+009|6.1E+032|        .000#
---

> #        |Regression#     1.06E+010|   2|   5.3E+009|9.8E+031|        .000#

13c13
< #        |Total     #     1.01E+010|1499|           |        |            #
---

> #        |Total     #     1.06E+010|1499|           |        |            #

19,21c19,21
< #        |(Constant)#1.23|       .00| .00|6.18E+012|         .00#
< #        |    v1    #4.56|       .00| .38|2.65E+016|         .00#
< #        |    v2    #7.89|       .00| .00|2.31E+016|         .00#
---

> #        |(Constant)#1.23|       .00| .00|2.48E+012|         .00#
> #        |    v1    #4.56|       .00| .37|1.04E+016|         .00#
> #        |    v2    #7.89|       .00| .00|8.95E+015|         .00#

run program
FAILED
FAIL: tests/command/regression-qr.sh

Jason H Stover <jstover>
Group Member
Wed 09 Apr 2008 05:36:22 AM UTC, comment #1: 

I suggest that instead of explicitly providing the test data, we generate it.  Ie, something similar to:

input program.
loop #i = 1 to 1500.
 compute v1 = #i.
 end case.
end loop.
end file.
end input program.

compute v2 = uniform (750).
compute y = 1.23 + v1 4.56 + v2 7.89.

regression /variables=v1, v2
        /dependent=y.

This has a couple of advantages:

1. The test script is a more manageable size.
2. It's easy to see if the calculated coefficients are in fact correct.


John Darrington <jmd>
Group administrator
Wed 09 Apr 2008 03:55:47 AM UTC, original submission:  

This patch implements a test for the QR decomposition in REGRESSION. Note the test may fail unless it is run after applying John Darrington's patch for bug 22788.

Jason H Stover <jstover>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #15426:  regression-test.patch added by jstover (44KiB - text/x-diff)

 

Carbon-Copy List
  • -email is unavailable- added by jmd (Posted a comment)
  • -email is unavailable- added by jstover (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-04-17 jmd StatusNone Done
        Open/ClosedOpen Closed
    2008-04-14 jstover Dependencies- bugs #22788 is dependent
    2008-04-09 jmd Dependencies- Depends on bugs #22788
    2008-04-09 jstover Attached File- Added regression-test.patch, #15426

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code