On Wed, Jul 22, 2009 at 2:53 PM, Laurent Gautier<lgaut...@gmail.com> wrote: > Skipper Seabold wrote: >> >> Hello all, >> >> Are RPy bugs still being accepted on the sourceforge page? > > They certainly are. > >> I think I found one when trying to do an rlm estimation. >> >> I can provide code to (possibly) reproduce; however, the short version >> is this. Given the stackloss data from R datasets and a data frame >> and formula given in the examples here >> <http://sekhon.berkeley.edu/library/MASS/html/rlm.html> >> >> from rpy import r >> r.library('MASS') >> results1 = r.rlm(formula, data=frame, psi="psi.huber") >> >> # works correctly >> >> results2 = r.rlm(formula, data=frame, psi="psi.bisquare") >> >> # works correctly >> >> results3 = r.rlm(formula, data=frame, psi="psi.hampel") >> >> # raises exception >> >> The last one raises the following exception, though this works fine at >> the R intepreter. >> >> RPy_RException: Error in x * wts : non-conformable arrays >> >> Anyone have any idea if this is user error or a bug? > > Unfortunately I don't, but someone else might. > > Note: Having a standalone example to demonstrate the bug is always good (I > think that we are missing something in the first part here). > > > L. >
Thanks for the reply. I have a wrapper for RPy that makes the interface similar to some statistical models code that I am working on for SciPy, and this is how the bug comes up. The weird thing that I discovered in trying to replicate is that it only comes up when x is defined from another source and only for psi.hampel, even though it is *exactly* the same as the x below. Very frustrating and odd. I can't think of anything that would make the x array that I have different from the one defined below. If anyone is interested in pursuing this I can provide the rest of the code. On a first pass, the below created the error though I had previously been working at the interpreter. I couldn't replicate after but can replicate with the arrays that are imported. import rpy from rpy import r import numpy as np data = rpy.as_list(r('stackloss')) y = data[0]['stack.loss'] x = np.column_stack(np.array(data[0][name]) for name in data[0].keys()[0:-1]) x = np.column_stack((x,np.ones((len(x),1)))) # x is now a (21,4) array with a constant formula = r('y~ x.1 + x.2 + x.3 + x.4 - 1') frame = r.data_frame(y=y, x=x) r.library('MASS') results1 = r.rlm(formula, data=frame, psi='psi.huber') results2 = r.rlm(formula, data=frame, psi='psi.bisquare') # this works fine results3 = r.rlm(formula, data=frame, psi='psi.hampel') # this raises the exception when x is defined elsewhere though is equivalent to the above x RPy_RException: Error in x * wts : non-conformable arrays Skipper ------------------------------------------------------------------------------ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list