[Scipy-svn] r3954 - trunk/scipy/stats/models
scipy-svn@scip...
scipy-svn@scip...
Fri Feb 22 13:48:44 CST 2008
Author: jonathan.taylor
Date: 2008-02-22 13:48:39 -0600 (Fri, 22 Feb 2008)
New Revision: 3954
Modified:
trunk/scipy/stats/models/formula.py
Log:
allowed reference key for main_effect to be a key or an int
Modified: trunk/scipy/stats/models/formula.py
===================================================================
--- trunk/scipy/stats/models/formula.py 2008-02-21 18:26:04 UTC (rev 3953)
+++ trunk/scipy/stats/models/formula.py 2008-02-22 19:48:39 UTC (rev 3954)
@@ -256,14 +256,24 @@
def main_effect(self, reference=None):
"""
Return the 'main effect' columns of a factor, choosing
- a reference column number to remove.
+ an optional reference key.
+
+ The reference key can be one of the keys of the Factor,
+ or an integer, representing which column to remove.
+ It defaults to 0.
+
"""
+ names = self.names()
+
if reference is None:
reference = 0
+ else:
+ try:
+ reference = names.index(reference)
+ except IndexError:
+ reference = int(reference)
- names = self.names()
-
def maineffect_func(value, reference=reference):
rvalue = []
keep = range(value.shape[0])
More information about the Scipy-svn
mailing list