Hi
not sure that i understand what you want but maybe something like this can
help you
df<-data.frame(x=1:10, y=5*(1:10)+3+rnorm(10))
plot(df)
abline(fit<-lm(y~x, data=df))
matlines(predict(fit, interval="confidence"))
segments(df$x, df$y, df$x, df$y-resid(fit))
Regards
Petr
r-help-bounces at r-project.org napsal dne 22.10.2009 22:29:37:
> Hi all,
>
> I have re-begging to use R.
>
> I need to using a matrix Y and X with the first row been the name to get
a> ols regression and to plot a two elements graph...on the top
> the scattergraph and the line representing the regressi?n....below the
> resids...at the same time I want to plot with small lines representing
the> error or one desviation from the regressi?n.
>
> I attach a graph...to get better understood.
>
> Please if you writte me the code explain how to put names on both plots.
> MAny Thanks???
>
> I saw a document explaining but I can?t find....
>
> Thanks in advance....
>
> Imagine you load on a directory (in example mydocuments) the data file
and> that it is an xls or *.txt file.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.