R Quick Reference
Labels
bitwXor
cor
cut
det
eigen
fft
hist
lm
lm_poly
logic-JKFF
LogicalAddition
LogicalMultiplication
lsfit
mean
nls
polyroot
qqnorm
solve
sum
uniroot
var-test
xor
5.27.2014
lm_poly
x <- c(70, 72, 62, 64, 71, 76, 60, 65, 74, 72) y <- c(70, 74, 65, 68, 72, 74, 61, 66, 76, 75) data <- data.frame(X=x, Y=y) result <- lm(y~1 + x + I(x^2),data) coefficients(result) names(result) a <- result$coefficients xx <- seq(min(x),max(x),by=0.1) yy <- a[1]+a[2]*xx+a[3]*xx^2 plot(xx,yy,xlim=c(min(x),max(x)),ylim=c(min(y),max(y)),type="l") par(new=T) plot(x,y,xlim=c(min(x),max(x)),ylim=c(min(y),max(y)))
y ~ 1 + x + I(x^2) 多項式回帰 : y = b0 + b1x1 + b2x2 + ε( ε は誤差項).I(x^2) は poly(x,2) でも可
Newer Post
Older Post
Home