R 语言学习笔记(三)
2016-10-12 18:43
183 查看
R语言中各种分布
一元线性回归分析
rnorm(n,mean=0,sd=1) rexp(n,rate=1) rgamma(n,shape,scale=1) rpois(n,lambda) rweibull(n,shape,scale=1)#weibull分布 rcauchy(n,location=0,scale=1)#Cauchy分布 rbeta(n,shape1,shape2)#beta分布 rt(n,df)#t分布 rf(n,df1,df2)#F分布 rchisq(n,df)#卡方分布 rbinom(n,size,prob)#二项分布 rgeom(n,prob)#几何分布 rhyper(nn,m,n,k)#超几何分布 rlogis(n,location=0,scale=1)#logistic分布 rlnorm(n,meanlog=0,sdlog=1)#对数正态 rnbinom(n,size,prob)#负二项分布 runif(n,min,max)#均匀分布
median(x1) [1] 99 quantile(x1) 0% 25% 50% 75% 100% 86 95 99 105 115 fivenum:中位数,上四分位数,下四分位数,最大值,最小值 cor:相关系数 cos:协方差
一元线性回归分析
lm: linear model a=lm(w~1+h) summary(a) Call: lm(formula = y ~ x) Residuals:(对残差的描述) Min 1Q Median 3Q Max -1.81085 -0.66032 0.01576 0.67239 1.60354 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept)(截距) -0.25072 0.44522 -0.563 0.58 x 1.00317 0.03717 26.991 5.16e-16 *** (P值,越小代表预测越准确,***代表预测结果好) --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.9584 on 18 degrees of freedom Multiple R-squared(拟合的越好越接近于1): 0.9759, Adjusted R-squared: 0.9745 F-statistic: 728.5 on 1 and 18 DF, p-value: 5.164e-16 predict(model,data)
相关文章推荐
- JAVA与模式 学习笔记(一) 统一的建模语言UML介绍(2)
- 学习笔记,VB6语言脚本解释器
- Java2核心技术第七版的学习笔记(三) Fundamental Programming Structures in Java(Java语言的基础)(三)
- 关于LINQ(语言集成查询)的一些学习笔记(没实践过的)
- linux下c语言学习笔记——操作mysql
- wpf学习笔记---初识xaml标签语言
- JAVA与模式 学习笔记(一) 统一的建模语言UML介绍(1)
- JavaScript 学习笔记 之 JavaScript 核心语言对象
- C#语言学习笔记
- 计算机学习笔记1:计算机语言的缘何
- 游戏开发学习笔记(一)--采用何种语言开发
- Velocity学习笔记3——Velocity 模板语言(VTL: Velocity Template Language)简介
- JAVA语言规范学习笔记(4)
- Java2核心技术第七版的学习笔记(三) Fundamental Programming Structures in Java(Java语言的基础)(二)
- JBoss Rules 学习笔记(六)—— Drools规则语言详解(上)
- JAVA与模式 学习笔记(一) 统一的建模语言UML介绍(2)
- JAVA语言规范学习笔记(3)
- HTML语言学习笔记之三
- wpf学习笔记---初识xaml标签语言
- sql学习笔记(一)----Transact语言