-func pvalueGLM(sampleInfo []sampleInfo, onehot []bool) float64 {
- nPCA := len(sampleInfo[0].pcaComponents)
+func normalize(a []float64) {
+ mean, std := stat.MeanStdDev(a, nil)
+ for i, x := range a {
+ a[i] = (x - mean) / std
+ }
+}
+
+// Logistic regression.
+//
+// onehot is the observed outcome, in same order as sampleInfo, but
+// shorter because it only has entries for samples with
+// isTraining==true.
+func pvalueGLM(sampleInfo []sampleInfo, onehot []bool, nPCA int) (p float64) {