Here's the quickest way I know of to get a scatterplot of many variables 
against a single variable. I create example data to illustrate.

x <- 1:10
ys <- matrix( runif(30), ncol=3)

matplot(x,ys)
## or, a little better,
matplot(x,ys, type='b')

To add regression lines:

for (iy in seq(ncol(ys))) abline(lsfit(x, ys[,iy]))

Coloring the regression lines to match the matplot will take a little more work 
(but not a lot more).

Don't ask me about putting the regression line formulas on the plot like in 
Excel. I don't do things that way...

There is probably something in ggplot2 or some other package.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 
 

On 11/27/17, 12:56 AM, "R-help on behalf of Engin YILMAZ" 
<r-help-boun...@r-project.org on behalf of ispanyol...@gmail.com> wrote:

    Dear
    
    I try to realize one scatter matrix which draws *one single variable to all
    variables* with *regression line* . You can see my eviews version  in the
    annex .
    
    How can I draw this graph with R studio?
    
    
    Sincerely
    Engin YILMAZ
    ______________________________________________
    R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
    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.
    

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to