The R Project SVN R

Rev

Rev 61153 | Rev 79177 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61153 Rev 61168
Line 80... Line 80...
80
## the x- and y-axis, and an integer grid
80
## the x- and y-axis, and an integer grid
81
abline(h = 0, v = 0, col = "gray60")
81
abline(h = 0, v = 0, col = "gray60")
82
text(1,0, "abline( h = 0 )", col = "gray60", adj = c(0, -.1))
82
text(1,0, "abline( h = 0 )", col = "gray60", adj = c(0, -.1))
83
abline(h = -1:5, v = -2:3, col = "lightgray", lty = 3)
83
abline(h = -1:5, v = -2:3, col = "lightgray", lty = 3)
84
abline(a = 1, b = 2, col = 2)
84
abline(a = 1, b = 2, col = 2)
85
text(1,3, "abline( 1, 2 )", col = 2, adj = c(-.1,-.1))
85
text(1,3, "abline( 1, 2 )", col = 2, adj = c(-.1, -.1))
86
 
86
 
87
## Simple Regression Lines:
87
## Simple Regression Lines:
88
require(stats)
88
require(stats)
89
sale5 <- c(6, 4, 9, 7, 6, 12, 8, 10, 9, 13)
89
sale5 <- c(6, 4, 9, 7, 6, 12, 8, 10, 9, 13)
90
plot(sale5)
90
plot(sale5)
91
abline(lsfit(1:10,sale5))
91
abline(lsfit(1:10, sale5))
92
abline(lsfit(1:10,sale5, intercept = FALSE), col = 4) # less fitting
92
abline(lsfit(1:10, sale5, intercept = FALSE), col = 4) # less fitting
93
 
93
 
94
z <- lm(dist ~ speed, data = cars)
94
z <- lm(dist ~ speed, data = cars)
95
plot(cars)
95
plot(cars)
96
abline(z) # equivalent to abline(reg = z) or
96
abline(z) # equivalent to abline(reg = z) or
97
abline(coef = coef(z))
97
abline(coef = coef(z))