ctrl + alt + i
rnorm(80, 5, 2)
## [1] 7.0419162 4.0649209 3.5637076 6.3062667 4.1257668 4.3916187 1.7245860
## [8] 4.9717686 7.1328672 9.5840744 0.1870176 2.6854568 6.0506123 5.6252796
## [15] 4.5025507 4.2008021 2.5291617 5.2070159 1.6080492 3.7104041 4.1366323
## [22] 6.8950489 4.9685984 4.3646854 1.4738031 5.2449153 7.5406335 8.0074182
## [29] 4.6175615 2.9964068 5.2714337 6.9838934 5.3614801 6.2105032 6.4415584
## [36] 5.0486026 5.4349781 4.6925499 4.2145489 4.4272121 4.4065027 3.6495097
## [43] 9.9914607 4.4916822 3.9760712 0.6307873 9.0797381 7.3263784 3.4577390
## [50] 3.5352248 5.8510554 3.3648351 4.9922932 4.2843095 8.9839234 3.6762853
## [57] 3.8973656 5.7327644 4.3747373 8.3263052 7.9736792 4.1462394 6.0431621
## [64] 5.8014459 2.9218176 3.8240643 5.7226376 2.4854832 3.8079734 3.2557989
## [71] 5.6734552 4.1469664 4.3830483 6.0038629 8.3766547 6.5071788 3.9232059
## [78] 8.7416101 3.3604501 5.4124268
investment <- c(200,220,230,240,260,280,300,310,320)
investment <- c(50,55,60,65,70,75,80,85,90.95)
output <- c(200,220,230,240,260,280,300,310,320)
investment
## [1] 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.95
data <- data.frame(investment, output)
data
## investment output
## 1 50.00 200
## 2 55.00 220
## 3 60.00 230
## 4 65.00 240
## 5 70.00 260
## 6 75.00 280
## 7 80.00 300
## 8 85.00 310
## 9 90.95 320
#regresi linear
model <- lm(output ~ investment, data=data)
model
##
## Call:
## lm(formula = output ~ investment, data = data)
##
## Coefficients:
## (Intercept) investment
## 47.874 3.058
plot(data$investment, data$output,
xlab = "Investment (juta dolar)",
ylab = "output (juta unit)",
main = "regresi linear antara investasi dan output industri")
abline(model, col="blue", lwd=2)