Economics of Money and Banking / Perry G Mehrling / Ders 1

R ggplot2 tekli scatter çizimleri





Basic single scatterplots with regression lines


#Kütüphaneler
library(ggplot2)
library(reshape2)


#Kullanacağımız değişkenler
CPI <- allgroups$CPI
group1 <- allgroups$Group1



ggplot(allgroups, aes(x=CPI, y=group1)) +
geom_point(shape=1) # Use hollow circles






ggplot(allgroups, aes(x=CPI, y=group1)) +
geom_point(shape=1) + # Use hollow circles
geom_smooth(method=lm) # Add linear regression line
# (by default includes 95% confidence region)


ggplot(allgroups, aes(x=CPI, y=group1)) +
geom_point(shape=1) + # Use hollow circles
geom_smooth(method=lm, # Add linear regression line
se=FALSE) # Don't add shaded confidence region



ggplot(allgroups, aes(x=CPI, y=group1)) +
geom_point(shape=1) + # Use hollow circles
geom_smooth() # Add a loess smoothed fit curve with confidence region
#> `geom_smooth()` using method = 'loess'



Dr. Engin YILMAZ
29/11/2017
ANKARA

Yorumlar