From c54ab0e009482e159d4d05c0a509a793d13c8b74 Mon Sep 17 00:00:00 2001 From: "Per.Andreas.Brodtkorb" Date: Tue, 8 Nov 2011 15:24:32 +0000 Subject: [PATCH] Small updates --- pywafo/.pydevproject | 2 +- pywafo/src/wafo/stats/core.py | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pywafo/.pydevproject b/pywafo/.pydevproject index 56f4b02..4884fb8 100644 --- a/pywafo/.pydevproject +++ b/pywafo/.pydevproject @@ -3,7 +3,7 @@ -/pywafo/src +/google_pywafo/src python 2.6 Default diff --git a/pywafo/src/wafo/stats/core.py b/pywafo/src/wafo/stats/core.py index c80b980..27dac99 100644 --- a/pywafo/src/wafo/stats/core.py +++ b/pywafo/src/wafo/stats/core.py @@ -1209,12 +1209,13 @@ class RegLogit(object): Calculates likelihood for the ordinal logistic regression model. ''' # Author: Gordon K. Smyth - zx = np.hstack((z,x)) - z1x = np.hstack((z1,x)) - g = _logitinv(np.dot(zx,beta)) - g1 = _logitinv(np.dot(z1x,beta)) + zx = np.hstack((z, x)) + z1x = np.hstack((z1, x)) + g = _logitinv(np.dot(zx, beta)) + g1 = _logitinv(np.dot(z1x, beta)) g = np.maximum(y == y.max(), g) g1 = np.minimum(y > y.min(), g1) + p = g - g1 dev = -2 * sum (np.log(p)); @@ -1300,6 +1301,15 @@ def _test_reslife(): mrl = reslife(R, nu=20) mrl.plot() +def test_reglogit(): + y=np.array([1, 1, 2, 1, 3, 2, 3, 2, 3, 3]) + x = np.arange(10).T + b = reglogit(y,x) + b.display() % members and methods + + b.summary() + [mu,plo,pup] = b.predict(); + plot(x,mu,'g',x,plo,'r:',x,pup,'r:') def main(): #_test_dispersion_idx() import doctest @@ -1307,4 +1317,6 @@ def main(): if __name__ == '__main__': + pass main() +