流程

优点: 支持图片, 方便分享, 简单操作

1, 在R中编写代码, 生成html文件

b4640a472980f58564433fb287d73c75.png

3, 将md上传到博客上面.

test.R {.title .toc-ignore}

Dengfei {.author}

Thu Nov 08 14:47:01 2018 {.date}

example(aov)

##

## aov> ## From Venables and Ripley (2002) p.165.

## aov>

## aov> ## Set orthogonal contrasts.

## aov> op

##

## aov> ( npk.aov

## Call:

## aov(formula = yield ~ block + N * P * K, data = npk)

##

## Terms:

## block N P K N:P N:K

## Sum of Squares 343.2950 189.2817 8.4017 95.2017 21.2817 33.1350

## Deg. of Freedom 5 1 1 1 1 1

## P:K Residuals

## Sum of Squares 0.4817 185.2867

## Deg. of Freedom 1 12

##

## Residual standard error: 3.929447

## 1 out of 13 effects not estimable

## Estimated effects are balanced

##

## aov> ## No test:

## aov> ##D summary(npk.aov)

## aov> ## End(No test)

## aov> coefficients(npk.aov)

## (Intercept) block1 block2 block3 block4 block5

## 54.8750000 1.7125000 1.6791667 -1.8229167 -1.0137500 0.2950000

## N1 P1 K1 N1:P1 N1:K1 P1:K1

## 2.8083333 -0.5916667 -1.9916667 -0.9416667 -1.1750000 0.1416667

##

## aov> ## to show the effects of re-ordering terms contrast the two fits

## aov> aov(yield ~ block + N * P + K, npk)

## Call:

## aov(formula = yield ~ block + N * P + K, data = npk)

##

## Terms:

## block N P K N:P Residuals

## Sum of Squares 343.2950 189.2817 8.4017 95.2017 21.2817 218.9033

## Deg. of Freedom 5 1 1 1 1 14

##

## Residual standard error: 3.954232

## Estimated effects are balanced

##

## aov> aov(terms(yield ~ block + N * P + K, keep.order = TRUE), npk)

## Call:

## aov(formula = terms(yield ~ block + N * P + K, keep.order = TRUE),

## data = npk)

##

## Terms:

## block N P N:P K Residuals

## Sum of Squares 343.2950 189.2817 8.4017 21.2817 95.2017 218.9033

## Deg. of Freedom 5 1 1 1 1 14

##

## Residual standard error: 3.954232

## Estimated effects are balanced

##

## aov> ## as a test, not particularly sensible statistically

## aov> npk.aovE

##

## aov> npk.aovE

##

## Call:

## aov(formula = yield ~ N * P * K + Error(block), data = npk)

##

## Grand Mean: 54.875

##

## Stratum 1: block

##

## Terms:

## N:P:K Residuals

## Sum of Squares 37.00167 306.29333

## Deg. of Freedom 1 4

##

## Residual standard error: 8.750619

## Estimated effects are balanced

##

## Stratum 2: Within

##

## Terms:

## N P K N:P N:K

## Sum of Squares 189.28167 8.40167 95.20167 21.28167 33.13500

## Deg. of Freedom 1 1 1 1 1

## P:K Residuals

## Sum of Squares 0.48167 185.28667

## Deg. of Freedom 1 12

##

## Residual standard error: 3.929447

## Estimated effects are balanced

##

## aov> summary(npk.aovE)

##

## Error: block

## Df Sum Sq Mean Sq F value Pr(>F)

## N:P:K 1 37.0 37.00 0.483 0.525

## Residuals 4 306.3 76.57

##

## Error: Within

## Df Sum Sq Mean Sq F value Pr(>F)

## N 1 189.28 189.28 12.259 0.00437 **

## P 1 8.40 8.40 0.544 0.47490

## K 1 95.20 95.20 6.166 0.02880 *

## N:P 1 21.28 21.28 1.378 0.26317

## N:K 1 33.14 33.14 2.146 0.16865

## P:K 1 0.48 0.48 0.031 0.86275

## Residuals 12 185.29 15.44

## ---

## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

##

## aov> options(op) # reset to previous

example(plot)

##

## plot> require(stats) # for lowess, rpois, rnorm

##

## plot> plot(cars)

##

## plot> lines(lowess(cars))

##

## plot> plot(sin, -pi, 2*pi) # see ?plot.function

##

## plot> ## Discrete Distribution Plot:

## plot> plot(table(rpois(100, 5)), type = "h", col = "red", lwd = 10,

## plot+ main = "rpois(100, lambda = 5)")

##

## plot> ## Simple quantiles/ECDF, see ecdf() {library(stats)} for a better one:

## plot> plot(x

##

## plot> points(x, cex = .5, col = "dark red")

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐