Imagine you got 3 variables :
gestation of the mom
height of the mom
weight of the baby at birth
my 2 variables x are :
gestation of the mom
height of the mom
and my variable y is :
weight of the baby at birth
I would like to got a graphics matrix who explains weight of the baby at birth in function of gestation of the mom and weight of the baby at birth in function of height of the mom
I did it :
pairs((baby$bwt~baby$gestation+baby$age))
I obtains a graphic matrix like on picture :matrix_picture
But i would like to know how i can got only y in function of x1 and y in function of x2 because on my picture I got all, in others terms, i would like to obtain only the first line of my picture.
thanks for reading me
EDIT : [matrix2_picture][2]
As you can see, on my absciss i got always same value ( 0 - 300) but i would like to got better value to got a better visualisation on each graphics, for example for age, i can't got 200 or 300, so i would like to got in absciss 10 m and 50 max for example
thanks
EDIT2:
[matrix3][3]
Just a last question, if I want get same thing than on the picture, how I can do it with ggplot
First is gestation of the mom in function of the weight of baby at birth, second is age of the mom in function of the weight of baby at birth and last is height of the mom in function of weigh of baby at birth
I did it :
df3 <- reshape2::melt(baby, "bwt")
ggplot(df3, aes(x=bwt, y=value)) +
geom_point() + facet_grid(.~variable,scales="free")
But I obtain it :
[matrix3][4]
Or you can see my ordinate is always same, not like when I used pairs.
thanks a lot !!! [2]: https://i.stack.imgur.com/jppCJ.png [3]: https://i.stack.imgur.com/TnEBe.png [4]: https://i.stack.imgur.com/BPOUP.png
Last edit :
Do u know how we can do the same things but only for redidus of each variable A little bit like the function pairs() but pairs with residus
reg=lm(formula=baby$bwt~baby$weight+baby$gestation+baby$age)
summary(reg)
plot(reg)
I would like to have residus of baby$bwt in function of theses 3 variables( weight , gestation, age)