Skip to content

(no subject)

4 messages · Ida Scheel, Peter Dalgaard, Roger Koenker

#
Hei,

I am trying to fit an ANOVA-model by lm. I get the error-message

Error in lm.fit(x, y, offset = offset, ...) :
    negative length vectors are not allowed

which I don't understand. My data looks fine, but one factor has 
extremely many levels. Does anyone have a tip?

Best regards
Ida Scheel
#
Ida Scheel <ida.scheel at nr.no> writes:
Not really. It sounds like it might be a bug. How many levels? Can you
generate a simple example (possibly with simulated data) showing the
same behaviour?
#
Although not immediately relevant to the present inquiry this might still be
an opportune moment to mention again an item that is at the top of
my R-wish-listr:

The SparseM function slm (for sparse lm) is well suited for problems like this in which
the design matrix is quite sparse, so it would be great to have a version of
model.matrix that would return a matrix in one of the formats of SparseM.  I've
hesitated to dig into this having looked a bit at the C, but if some brave soul
were looking for a nice well-defined summer amusement...

One can handle this "by hand" in specific instances, but it would be great to have
a more automated way to do this via the formula approach.

I think it is not uncommon in large regression problems that this would signficantly
expand the range of applications that could be handled by R, especially on smaller
machines.  Regression/anova problems need only store the non-zero elements of X
and computational effort on such problems should grow roughly proportionally
to the number of these non-zero elements.

Roger

url:	www.econ.uiuc.edu	Roger Koenker		Dept. of Economics UCL,
email	rkoenker at uiuc.edu	Department of Economics Drayton House,
vox: 	217-333-4558		University of Illinois	30 Gordon St,
fax:   	217-244-6678		Champaign, IL 61820	London,WC1H 0AX, UK
							vox:	020-7679-5838
On Tue, 3 Jun 2003, Ida Scheel wrote: