qqplot(z,z.predict$fit) 2008-08-12 16:59:58.105 R[3203] *** Assertion failure in - [RDeviceView lockFocus], AppKit.subproj/NSView.m:3248 2008-08-12 16:59:58.105 R[3203] *** REngine.runREPL: caught ObjC exception in the main loop! *** Please report the following error on r-sig-mac@r-project.org along with the full description of how to reproduce it: *** reason: lockFocus sent to a view whose window is deferred and does not yet have a corresponding platform window *** name: NSInternalInconsistencyException, info: (null) *** Version: R 2.5.1 (42083) R.app R 2.5.1 GUI 1.20 (4535)/i386 Consider saving your work soon in case this problem leads to a full crash. context: Trying to understand the meaning of predict in the case of predict.lm error occurs with qqplot(z,z.predict$fit) of very much different length vectors (z a matrix) predict.lm is supplied 40000 x,y pairs for a two-parameter regression, but length(z.predict$fit) is only 4912 Code follows here # x.jH.min = 10^x.ljH.min x.jH.max= 10^x.ljH.max y.NO.min=10^y.lNO.min y.NO.max=10^y.lNO.max # x.jH.set = seq(x.jH.min, x.jH.max, by=x.jH.max/200) y.NO.set = seq(y.NO.min, y.NO.max, by=y.NO.max/200) # n.x.jH.set = length(x.jH.set) n.y.NO.set = length(y.NO.set) x.d = vector(mode="numeric",length=n.x.jH.set*n.y.NO.set) y.d = vector(mode="numeric",length=n.x.jH.set*n.y.NO.set) length(x.d) # z = matrix(nrow=length(x.jH.set),ncol=length(y.NO.set)) dim(z) z=matrix(nrow=n.x.jH.set,ncol=n.y.NO.set) dim(z) ind.d = 1 for ( xi in seq(1,n.x.jH.set) ) { xx = x.jH.set[xi] for ( yi in seq(1,n.y.NO.set) ) { yy = y.NO.set[yi] z[xi,yj] = 10^(coefficients(logfit.wt.lm)[1] + coefficients (logfit.wt.lm)[2]*log10(xx) + coefficients(logfit.wt.lm)[3]*log10(yy)) x.d[ind.d] = xx y.d[ind.d] = yy ind.d = ind.d + 1 } } ######################################################################## ############ # xy.d = data.frame(cbind(x.d,y.d)) names(xy.d)=c("x","y") z.predict=predict(logfit.wt.lm,data=xy.d,se.fit = TRUE) ASSUMPTIONS ...where these condistions are more or less all you need to run the code snippet. > length(x.d) [1] 40000 > x.ljH.min [1] 7.75 > x.ljH.max [1] 10.25 > y.lNO.min [1] 9.75 > y.lNO.max [1] 12.25 > > coefficients(logfit.wt.lm + ) (Intercept) l.j.HCHO.m l.NO.m -0.4214285 0.4190370 0.5483868 > [[alternative HTML version deleted]]