felixzhao123 发表于 2016-7-12 15:04 
正常数据肯定不会像这样有规律的
但是不管怎样,都是不影响你处理建模的
w=read.csv("sucessBackup.csv")
你看下面这样处理哑变量u,对吗?
x=as.matrix(w[,3])
#u=levels(w$Purpose)
u=factor(as.matrix(w[,2]))# 哑元 用途
y=as.matrix(w[,1])
fit.lm<-lm(y~x+u)
summary(fit.lm)
Call:
lm(formula = y ~ x + u)
Residuals:
Min 1Q Median 3Q Max
-0.57750 -0.24998 0.09995 0.20843 0.48489
运行结果;
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.568173 0.079435 7.153 2.14e-12 ***
x 0.004151 0.025594 0.162 0.871
u1 0.001845 0.081491 0.023 0.982
u2 -0.020469 0.079397 -0.258 0.797
u3 -0.055806 0.086323 -0.646 0.518
u4 -0.087844 0.102627 -0.856 0.392
u5 -0.059861 0.091266 -0.656 0.512
u6 -0.107701 0.087222 -1.235 0.217
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.3003 on 702 degrees of freedom
Multiple R-squared: 0.01075, Adjusted R-squared: 0.0008896
F-statistic: 1.09 on 7 and 702 DF, p-value: 0.3676