Skip to content

error message in plot(aov-object) -- repost

3 messages · Pascal A. Niklaus, Uwe Ligges, Peter Dalgaard

#
Hi all,

I posted this question several days ago, but did not get any answer 
until now. Since I still have no clue about the source of this error 
message, I repost a description of the problem including some code:

A student at our institute fitted an aov model, and got the following 
error message:

	> plot(p.aov)
	Hit <Return> to see next plot:
	Hit <Return> to see next plot:
	Error in plot.window(xlim, ylim, log, asp, ...) :
	       need finite ylim values

The second plot was not produced. I then tried to produced the plot
manually, which worked, and checked the range of the residuals:

	> qqnorm(resid(p.aov))
	> range(resid(p.aov))
	[1] -0.2428688  0.2020649

Her data set and the model are as follows:

Data:
  http://www.bot.unibas.ch/~pascal/ParzJan.csv

Model (I don't understand the model, but that's not the issue here)
  p <- read.csv("ParzJan.csv",header=T)
  p.aov <-aov(terms(JI~SP+Ex+Neig+pH+K/G+H+D+tN+br+aN:br+tN:D
    +br:D+aN:br:D+br:tN+aN:br:D + aN:br:tN+ K:D+ K:tN+ K:br
    +K:aN:br+ G:K:D+ G:K:tN+ G:K:br+G:K:aN:br+ D:H+ tN:H+ br:H
    + aN:br:H, keep.order=T), data=p)

Any help regarding the source of this plot() error message is appreciated.

Pascal

P.S.: She used R 1.7.1 on a Mac, but the problem was reproducible on R 
1.8.1 under Linux.
#
Pascal A. Niklaus wrote:

            
Without the data nobody was able to reproduce your problem ..


plot.lm() produces the error message, in particular the lines

    hii <- lm.influence(x, do.coef = FALSE)$hat

which appears to be 1 in some cases, and

    rs <- r.w/(s * sqrt(1 - hii))

(you get a division by zero and the outcome is Inf, hence it's not 
possible to scale the plot any more).


I'd call it a bug, but I don't know what the bug really is. I'll think 
about it...


Uwe Ligges
#
Uwe Ligges <ligges at statistik.uni-dortmund.de> writes:
If the $hat is 1, then the residual is theoretically zero and you
should get 0/0 == NA which would be much less trouble. 

Apparently, floating poing arithmetic makes it not quite so and you
get Inf in some cases. I'd expect that rs[hii==1] <- NA would fix
things up, although you might possibly need a fuzz factor (hii >
1-1e-10 or so).