Skip to content

Error in lm.fit(

3 messages · Peter Lauren, PIKAL Petr

#
I am using R.2.4.1 on Windows XP 5.1 (SP 2).

I have the following line in my R code.

Analysis=anova(lm(PM ~ x))

It works the first 60 or so times it is called but
then I get the following error message.

Error in lm.fit(x, y, offset = offset, singular.ok =
singular.ok, ...) : 0 (non-NA) cases

In order to examine the input, I preceeded the call
with the following.

print(PM)
print(x)

This gave the following.

[1] 245.0 189.0 249.8 188.0 184.3 230.0 147.0 185.3
196.0 142.3 282.0 169.0
[13] 231.5 162.0 115.0 168.8 195.0 214.0 173.0 111.3
360.0 192.3 305.5 206.0
[25] 111.0 247.0 188.0 246.0 252.0 114.0

 [1] 20.00 20.00 20.00 20.00 20.00 10.00 10.00 10.00
10.00 10.00  7.50  7.50
[13]  7.50  7.50  7.50  5.00  5.00  5.00  5.00  5.00 
2.50  2.50  2.50  2.50
[25]  2.50  1.25  1.25  1.25  1.25  1.25

I would be most grateful if someone could help with
this problem.  I do not see why these input vectors
would give this error message.  

Also, is there a way to make it so the script keeps
running if it gets an error like this?

Many thanks in advance,
Peter Lauren.
#
Hi

r-help-bounces at r-project.org napsal dne 03.10.2007 14:56:19:
Upgrade R. Version 2.6.0 is imminent.
Somehow x or PM is without any numbers.
Check from where you printed it. Maybe you have these somwhere in your 
environment but actual lm is using different ones.
Maybe ?try.

You did not reveal much information for anybody to get you some help. If 
you try to construct an artificial example which anybody can reproduce you 
would maybe find what is the problem yourself.

Regards
Petr
http://www.R-project.org/posting-guide.html
#
Hi,

I checked my code and found that it was actually a
subsequent call to lm.fit()  (which only gets called
occasionally) where the problem occurred.  I found
that I was accidentally passing a matrix called PMs
instead of the vector PM.

Sorry about that.

Thanks,
Peter.
--- Petr PIKAL <petr.pikal at precheza.cz> wrote: