Small updates

master
Per.Andreas.Brodtkorb 13 years ago
parent 0bc782a2cc
commit c54ab0e009

@ -3,7 +3,7 @@
<pydev_project> <pydev_project>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/pywafo/src</path> <path>/google_pywafo/src</path>
</pydev_pathproperty> </pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property> <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>

@ -1209,12 +1209,13 @@ class RegLogit(object):
Calculates likelihood for the ordinal logistic regression model. Calculates likelihood for the ordinal logistic regression model.
''' '''
# Author: Gordon K. Smyth <gks@maths.uq.oz.au> # Author: Gordon K. Smyth <gks@maths.uq.oz.au>
zx = np.hstack((z,x)) zx = np.hstack((z, x))
z1x = np.hstack((z1,x)) z1x = np.hstack((z1, x))
g = _logitinv(np.dot(zx,beta)) g = _logitinv(np.dot(zx, beta))
g1 = _logitinv(np.dot(z1x,beta)) g1 = _logitinv(np.dot(z1x, beta))
g = np.maximum(y == y.max(), g) g = np.maximum(y == y.max(), g)
g1 = np.minimum(y > y.min(), g1) g1 = np.minimum(y > y.min(), g1)
p = g - g1 p = g - g1
dev = -2 * sum (np.log(p)); dev = -2 * sum (np.log(p));
@ -1300,6 +1301,15 @@ def _test_reslife():
mrl = reslife(R, nu=20) mrl = reslife(R, nu=20)
mrl.plot() 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(): def main():
#_test_dispersion_idx() #_test_dispersion_idx()
import doctest import doctest
@ -1307,4 +1317,6 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
pass
main() main()

Loading…
Cancel
Save