On Wed, 14 Jan 1998, Andreas Weingessel wrote:
>
> I have the following problem. I have some multidimensional data points
> "x" and a curve "fit" fitted to these points. How can I
combine
> R> pairs(x)
> and
> R> pairs(fit,panel=lines)
> in one plot, so that I can see how good the curve fits the data?
>
> A command like
> R> pairs(x, panel=function(x,y) {points(x,y); lines(lowess(x,y))})
> does not work, since I fit the curve in all dimensions at once.
You can write
fit<-compute.fit.somehow()
pairs(x, fitted.lines=fit,
panel=function(x,y,fitted.lines){
points(x,y)
however.you.display.lines(fitted.lines,x,y)
}
)
that is, pass the fit as an extra argument into pairs(). In R but not in S
you could even use the fit without passing it in
fit<-compute.fit.somehow()
pairs(x,
panel=function(x,y){
points(x,y)
however.you.display.lines(fit,x,y)
}
)
This would only work in S if it were called from the top-level prompt --
inside a function it would fail mysteriously.
-thomas
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._