pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src regression.q


From: Jason H Stover
Subject: [Pspp-cvs] pspp/src regression.q
Date: Thu, 29 Dec 2005 18:02:14 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Branch:         
Changes by:     Jason H Stover <address@hidden> 05/12/29 18:02:14

Modified files:
        src            : regression.q 

Log message:
        First functioning export of prediction and confidence intervals

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/regression.q.diff?tr1=1.27&tr2=1.28&r1=text&r2=text

Patches:
Index: pspp/src/regression.q
diff -u pspp/src/regression.q:1.27 pspp/src/regression.q:1.28
--- pspp/src/regression.q:1.27  Mon Dec 26 07:14:15 2005
+++ pspp/src/regression.q       Thu Dec 29 18:02:14 2005
@@ -36,7 +36,7 @@
 #include "lexer.h"
 #include <linreg/pspp_linreg.h>
 #include "missing-values.h"
-#include "reg_export_comments.h"
+#include "regression_export.h"
 #include "tab.h"
 #include "var.h"
 #include "vfm.h"
@@ -515,7 +515,7 @@
       assert (fp != NULL);
       fp = fopen (handle_get_filename (model_file), "w");
       fprintf (fp, "%s", reg_preamble);
-      fprintf (fp, "#include <string.h>\n\n");
+      fprintf (fp, "#include <string.h>\n#include <math.h>\n\n");
       reg_print_getvar (fp, c);
       fprintf (fp, "%s", reg_export_t_quantiles_1);
       increment = 0.5 / (double) increment;
@@ -542,7 +542,7 @@
       fprintf (fp, "int i;\n\tint j;\n\n\t");
       fprintf (fp, "for (i = 0; i < %d; i++)\n\t", c->n_indeps);
       fprintf (fp, "%s", reg_getvar);
-      fprintf (fp, "const double cov[%d][%d] = {\n\t",c->n_indeps, 
c->n_indeps);         
+      fprintf (fp, "const double cov[%d][%d] = {\n\t", c->n_coeffs, 
c->n_coeffs);        
       for (i = 0; i < c->cov->size1 - 1; i++)
        {
          fprintf (fp, "{");
@@ -562,7 +562,13 @@
       fprintf (fp, "double unshuffled_vals[%d];\n\t",c->n_indeps);
       fprintf (fp, "%s", reg_variance);
       fprintf (fp, "%s", reg_export_confidence_interval);
-      fprintf (fp, "%s", reg_export_prediction_interval);
+      tmp = c->mse * c->mse;
+      fprintf (fp, "%s %.15e", reg_export_prediction_interval_1, tmp);
+      fprintf (fp, "%s %.15e", reg_export_prediction_interval_2, tmp);
+      fprintf (fp, "%s", reg_export_prediction_interval_3);
+      fclose (fp);
+      fp = fopen ("pspp_model_reg.h", "w");
+      fprintf (fp, "%s", reg_header);
       fclose (fp);
     }
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]