c:ms:2023:schedule:w10.lecture.note
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
c:ms:2023:schedule:w10.lecture.note [2023/05/08 01:56] – [R. Graph output] hkimscil | c:ms:2023:schedule:w10.lecture.note [2024/05/13 08:54] (current) – [R code] hkimscil | ||
---|---|---|---|
Line 88: | Line 88: | ||
b <- lm.mod2$coefficients[2] | b <- lm.mod2$coefficients[2] | ||
a <- lm.mod2$coefficients[1] | a <- lm.mod2$coefficients[1] | ||
+ | |||
+ | b | ||
+ | a | ||
+ | |||
+ | # y추정치 y.hat = a + bx | ||
ggplot(data=df, | ggplot(data=df, | ||
Line 105: | Line 110: | ||
y.hat <- lm.mod2$fitted.values | y.hat <- lm.mod2$fitted.values | ||
+ | # 참고로 | ||
+ | # y.hat2 <- a + b*x | ||
+ | head(y.hat) | ||
+ | head(y.hat2) | ||
+ | |||
y.hat - mean(df$y) | y.hat - mean(df$y) | ||
explained <- y.hat - mean(df$y) | explained <- y.hat - mean(df$y) |
c/ms/2023/schedule/w10.lecture.note.1683478585.txt.gz · Last modified: 2023/05/08 01:56 by hkimscil