楼主: amoydigua
|
2703
5
线性回归求助,望高手帮忙 |
本科生 96%
-
|
回帖推荐ls=function(y,x){if(ncol(x)<=1){n=length(y)sxx=sum((x-mean(x))^2)sxy=sum((x-mean(x))*(y-mean(y)))b1=sxy/sxxb0=mean(y)-b1*mean(x)yf=b0+b1*xsse=sum((y-yf)^2)sst=sum((y-mean(y))^2)ssr=sst-ssefc=sse/(n-2)sdb0=sqrt(fc)*sqrt(1/n+mean(x)^2/sxx)sdb1=sqrt(fc)/sqrt(sxx)t0=b0/sdb0t1=b1/sdb1R2=ssr/sstF=ssr*(n-2)/sselist(b0=b0,b1=b1,sd0=sdb0,sd1=sdb1,t0=t0,t1=t1,R2=R2,F=F)}else{n=length(y)c=rep(1,n) x=cbind( ...
本帖被以下文库推荐
| ||
| ||||||||||||
| ||
R is the second language for me!Using R is standing on the shoulders of giants! Let\'s use R together!
|
||
京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明 免责及隐私声明