search for: myfitline

Displaying 2 results from an estimated 2 matches for "myfitline".

2004 Mar 03
3
Adding text (coefts) to pairs panels
...like to plot a linear regression line in each panel and, also in each panel, I'd like to have some text in the panel showing the coefts, etc. I'm able to get the regressions line plotted, but not the text/coefficients. Using one of the R examples, example(pairs), I have got this far: panel.myfitline<-function(x, y, digits=2, prefix="", cex.cor, ...) { res<-panel.smooth(x,y, col.smooth="blue", ...) reg <- coef(lm(y ~ x)) abline(coef=reg,untf=F) const<-format(reg[1], trim = FALSE, digits = NULL, nsmall = 0, justify = "left", ...) cons...
2004 Apr 10
1
adding text in (pair) panels (splom)
...nce of the correlation or both, or a star if p < 0.05, etc... The function text() is useless (probably because I cannot pass appropriates coordinates in each panel). Googling the R-archives, I have found only one hint of Andy Liaw relating a rather complex (to me) script within a home-made panel.myfitline() function. Is there a simple way to add text in panels created eg with: panel=function(x,y,...){ panel.xyplot(x,y,...) panel.abline(lm(y~x),...) }) ? Any hint appreciated, Patrick Giraudoux