【发布时间】:2016-10-13 17:02:12
【问题描述】:
有人能解释一下为什么我在绘图时会得到不同的线条吗?不知怎的,我认为这条线应该是一样的
data(aircraft)
help(aircraft)
attach(aircraft)
lgWeight <- log(Weight)
library(KernSmooth)
# a) Fit a nonparametric regression to data (xi,yi) and save the estimated values mˆ (xi).
# Regression of degree 2 polynomial of lgWeight against Yr
op <- par(mfrow=c(2,1))
lpr1 <- locpoly(Yr,lgWeight, bandwidth=7, degree = 2, gridsize = length(Yr))
plot(Yr,lgWeight,col="grey", ylab="Log(Weight)", xlab = "Year")
lines(lpr1,lwd=2, col="blue")
lines(lpr1$y, col="black")
如何从模型中获取值?如果我打印模型,它会给我$x 和$y 上的值,但不知何故,如果我绘制它们,与蓝线不同。我需要每个x 的拟合模型(蓝色)的值,有人可以帮我吗?
【问题讨论】:
标签: r regression