vektor

Cara membuat data dalam bentuk vektor

 #create sample data
X <- c(15, 17, 19, 20, 22, 44, 25, 50) 
Y <- c(150, 200, 235, 220, 267, 300, 400)
 #print simple        
X
## [1] 15 17 19 20 22 44 25 50
Y
## [1] 150 200 235 220 267 300 400

simple Linear Regresion

Y = a + bx

Y = 170 + 17x

scatter plot

plot(Y-X, ylan="Y", pch=20)
## Warning in Y - X: longer object length is not a multiple of shorter object
## length
## Warning in plot.window(...): "ylan" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "ylan" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "ylan" is not a
## graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "ylan" is not a
## graphical parameter
## Warning in box(...): "ylan" is not a graphical parameter
## Warning in title(...): "ylan" is not a graphical parameter
#Systematic Relationship to the plot

abline(a = 310, b= -40)