-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDS-Paradigm-1.qmd
1977 lines (1295 loc) · 45.7 KB
/
DS-Paradigm-1.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "大数据时代教学、科研、出版的新范式"
subtitle: 以数据分析为中心的全场景生态建设探索
institute: "华东师范大学"
author: "汤银才"
date: "`r Sys.Date()`"
# from: markdown+emoji
format:
metropolis-revealjs:
html-math-method: katex
transition: slide
background-transition: fade
logo: images/statLogo-02.png #rlogo.png #images/quarto.png statLogo-02.png
# footer: "[汤银才, ECNU](https://faculty.ecnu.edu.cn/_s35/tyc/main.psp) "
# theme: [metropolis.scss]
reveal-header:
# sc-sb-title: true
# header-logo: images/statLogo-02.png
# subtitle-as-header: true
include-in-header:
- mathjax_HEP.html
title-slide-attributes:
data-background-image: images/slidecover2.jpeg
# data-background-size: contain
toc: true
toc-depth: 1
toc-title: 目录
margin: 0.05
width: 1600 # default 1050
height: 900 # default 700
code-overflow: wrap # scroll
slide-number: true
# embed-resources: true # obtain self-contained HTML
slide-level: 3
chalkboard:
boardmarker-width: 5
menu: true
pointer:
- # set pointer configuration options here
revealjs-plugins:
- pointer
#filters:
# - reveal-auto-agenda
#auto-agenda:
# bullets: numbered
# heading: "目录"
#jupyter: julia-1.9
#题目:数据科学引领下统计教学、科研与出版范式变革的探索
#摘要:以生成式人工智能为特点的大语言模型的出现给大数据时代贴上了新的标签,开启了统计和数据科学人才培养体系与机制的探讨。基于开源或低成本的技术工具打造一个兼具高标准化和个性化的灵活的文学化统计编程架构,探索建立数据驱动的教学、科研和出版新范式,时机与技术已经成熟。它将为多学科交叉提供便利,有助于培养符合市场需求的数据分析人才。本报告将从一个从事教学和科研多年的老师的角度,分享自己的一些想法,并通过一些具体的案例说明自己在如何高效率、高质量地进行教学、科研和出版方面正在做的一些尝试。
#主讲人:汤银才教授,简介:华东师范大学教授,博士生导师,《Statistical Theory and Related Fields》执行主编,《应用概率统计》编辑部主任, 中国现场统计研究会大数据统计分会常务理事、副秘书长,中国现场统计研究会可靠性工程分会常务理事、副理事长,中国运筹学会可靠性分会常务理事、中国现场统计研究会计算统计分会理事、上海市工业与应用数学会理事,主要从事可靠性统计及贝叶斯统计理论与应用研究,主持国家自然科学基金4项,作为子课题负责人参与国家自然科学基金重大项目与重点项目三项,完成包括华为机器有限公司、罗氏制药、中国航天第八研究院在内的企业横向项目20多项,在国内外学术刊物上发表论文100多篇,著有《R语言与统计分析》、《可靠性统计》、《贝叶斯统计》,译著6本。先后获得华为上海研究所优秀技术成果奖,华东师范大学研究生教育优秀教师奖,上海市科学技术三等奖,上海市教育发展基金会申银万国奖,华东师范大学优秀任课教师奖,上海市教学成果三等奖,上海市科技进步三等奖,全国统计科学技术进步二等奖,上海市统计科学研究成果课题类一等奖等荣誉。
---
### 自我介绍 --- 主要工作与兴趣
::: columns
::: {.column width="28%"}
- 从教40年(1985-现在)
- 研究兴趣
- 贝叶斯统计与
- 可靠性分析
- R 与$\TeX$的深度玩家与推广者,中国 R 会议(上海)的发起人之一
- 管理二本期刊
- 统计理论及其应用(STARF),执行主编
- 应用概率统计(APS), 编辑部主任
:::
::: {.column width="28%"}
```{r}
#| echo: FALSE
#| out.width: "80%"
#| fig.align: 'center'
knitr::include_graphics("./loc-figs/STARF-Cover-New.jpg")
```
- 17年国际创刊, 21年国内创刊
- 19年入选《中国科技期刊卓越行动计划》高起点新刊项目
- 被Scopus,CSCD, DOAJ,ESCI收录
- 入选数学领域高质量科技期刊分级目录(T3)
:::
::: {.column width="28%"}
```{r}
#| echo: FALSE
#| out.width: "85%"
#| fig.align: 'center'
knitr::include_graphics("./loc-figs/APS-1.jpg")
```
- 1985年创刊
- 被CSCD,北大核心等收录
- 入选数学领域高质量科技期刊分级目录(T3)
:::
:::
### 自我介绍 --- 教材
::: columns
::: {.column width="28%"}
- 国内第一本R语言教材
- 第二版(2023)有大幅更新
```{r}
#| echo: FALSE
#| out.width: "99%"
#| fig.align: 'center'
#| layout-nrow: 2
knitr::include_graphics("./loc-figs/R-BookV2.jpg")
```
:::
::: {.column width="28%"}
- 可靠性统计教材
```{r}
#| echo: FALSE
#| out.width: "98%"
#| fig.align: 'center'
#| layout-nrow: 3
knitr::include_graphics("./loc-figs/Reliability-Book.jpg")
```
:::
::: {.column width="28%"}
- 贝叶斯统计教材
- 新版即将完成
```{r}
#| echo: FALSE
#| out.width: "90%"
#| fig.align: 'center'
#| layout-nrow: 3
knitr::include_graphics("./loc-figs/Bayes-Book.jpg")
```
:::
:::
### 自我介绍 --- 译著
::: columns
::: {.column width="28%"}
- INLA系列从书
- 更多译著正在推进中
- [Bayesian Modeling using WinBUGS]{.small}
- [Statistical Methods for Reliability Data, 2E]{.small}
```{r}
#| echo: FALSE
#| out.width: "75%"
#| fig.align: 'center'
#| layout-nrow: 2
knitr::include_graphics("./loc-figs/INLA-Book1.jpg")
```
:::
::: {.column width="28%"}
```{r}
#| echo: FALSE
#| out.width: "60%"
#| fig.align: 'center'
#| layout-nrow: 3
knitr::include_graphics("./loc-figs/INLA-Book2.jpg")
knitr::include_graphics("./loc-figs/INLA-Book3.jpg")
```
:::
::: {.column width="28%"}
```{r}
#| echo: FALSE
#| out.width: "60%"
#| fig.align: 'center'
#| layout-nrow: 3
knitr::include_graphics("./loc-figs/INLA-Book4.jpg")
knitr::include_graphics("./loc-figs/INLA-Book5.jpg")
```
:::
:::
# I. 一些思考与想法 {background-image=images/bdbg.jpg}
## 1.1. 引言 {background-image=images/slidecover.png}
### [思考 ]{.red}: 大数据时代我们学习与科研的效率如何?
我们在学习、教学、科研过程中会
. . .
::: columns
::: {.column width="45%"}
- 与各类知识打交道,浏览许多资料
- pdf 文档
- html 文档
- 电子书
- 与数据打交道,查看图表
- 与程序打交道,做可视化和数据分析
- 目标: 完成各类任务
- 写报告
- 写学术论文
- 撰写毕业论文
- 出版学术专著
:::
::: {.column width="45%"}
- 用什么工具?
- Word/WPS
- $\LaTeX$
- ... ?
- 怎么提高生产率?
:::
:::
### [场景1 ]{.red}: 大数据时代如何打造一个高效的教学与科研生态?
目标: 赋能教学与科研
. . .
::: columns
::: {.column width="45%"}
- [通过标准化与个性化的权衡]{.content-box-red}
- 建立教学与科研的生态
- 提升教学与科研的效率
:::
::: {.column width="45%"}
- 标准化,[要?]{.red}
- 个性化,[怎么做?]{.red}
- 标准化基础上个性化,[可落地?]{.red}
:::
:::
. . .
答案:[文学化统计编程 ]{.center .content-box-red}
. . .
::: columns
::: {.column width="45%"}
- 编程与写作融合 ([knitr]{.blue})
- [[编程]{.blue}(code)]{.content-box-red}
- [[写作]{.blue}(prose)]{.content-box-red}
:::
::: {.column width="45%"}
- [标准化定制]{.content-box-red}
- CSS/SCSS 定制
- $\TeX$ 定制
:::
:::
### [场景2 ]{.red}: 如何打造一个高效的数据科学写作/出版系统?
- 目标: 赋能期刊与图书出版
. . .
::: columns
::: {.column width="45%"}
- [通过Quarto平台]{.content-box-red}
- 使编程与写作融为一体
- 建立作者与出版社的桥梁
- 为读者提供良好的阅读场景
:::
::: {.column width="45%"}
- [多格式出版]{.content-box-red}
- PDF
- HTML
- ePub
- Word
:::
:::
## 1.2. 编程语言的选择? {background-image=images/slidecover.png}
### 编程/分析工具应具备的品质
::: columns
::: {.column width="45%"}
- 极易入门(基本功能简单)
- 费用低廉(免费)
- 代码开放/开源(共享)
- 无平台限制(共享)
- 求助方便
:::
::: {.column width="45%"}
- 良好生态与社区
- 数据分析高效(工具包)
- 可视化容易而强(工具包)
- 编程能力强(可扩展性)
- 有卓越的IDE
:::
:::
### [过去]{.red}与[现在]{.red}的统计软件
::: columns
::: {.column width="45%"}
- Excel
- [SAS]{.red} (好贵,好重)
- [Matlab]{.red}
- SPSS
- Minitab
- Fortran
- Eviews
- Stata
:::
::: {.column width="45%"}
- [R]{.content-box-red}
- [Python]{.content-box-red}
- [Julia]{.content-box-red}
- [Shiny/Observable]{.content-box-red}---动态可视化
:::
:::
### 三大开源语比较: R, Python, Julia
```{r}
#| label: fig-comp3
#| fig.cap: 编程语言性能比较(相对于C=1.0)
#| fig.align: 'center'
#| echo: FALSE
#| out.width: "65%"
knitr::include_graphics("./loc-figs/HPC-julia2.jpg")
```
### R与Python的比较
::: columns
::: {.column width="45%"}
[R:]{.content-box-red} - [倚天剑]{.content-box-green}
1. 一种[解释性程序语言]{.red},专注于统计建模与数据分析
1. 拥有丰富的[统计计算]{.red}和[数据可视化]{.red}包
1. 良好的社区和开源生态系统非常活跃,已经大量R包(超过[2万]{.red})
1. 轻松地处理大型数据集和矩阵(借助R包)
1. 可实现和Python的pandas媲美的高速数据处理能力
1. 缺点: [效率相对较低]{.red}
1. [主要是统计学院的选择]{.content-box-green}
:::
::: {.column width="45%"}
[Python:]{.content-box-red} - [屠龙刀]{.content-box-green}
1. 一种[通用的编译语言]{.red},可用于机器学习
1. 拥有丰富的[机器学习、深度学习]{.red}库
1. 社区和开源生态系统也非常活跃,有大量的开源库([12万]{.red})
1. 支持多线程和分布式计算,可更好地处理大规模数据集
1. 拥有更多的库(如NumPy和Pandas等),可以实现更加高效的编程
1. 缺点: [统计计算/建模]{.red}能力偏弱
1. [主要是工程类学院的选择]{.content-box-red}
:::
:::
## 1.3. 写作工具的选择? {background-image=images/slidecover.png}
### 写作工具的选择?
- Word/WPS
. . .
- $\LaTeX$
- TeXlive
- Overleaf,示例: [ECNU本科毕业论文模板](https://www.overleaf.com/project/66849279fae8720d32590ec4)
. . .
- Markdown
. . .
::: columns
::: {.column width="45%"}
1. 一种轻量级标记语言
1. 目标:实现“易读易写”
1. 转换成结构化的HTML(超文本标记语言)
1. 语法简单易懂易学
1. 主流的平台几乎都使用/支持
:::
::: {.column width="45%"}
- [ChatGPT]{.red}/[Kimi]{.red}/[ChatGLM]{.red}/...
- Github
- Jupyter Notebook
- [Typora]{.red} (推荐使用)
- ... ...
:::
:::
## 1.4. 我们要感谢的人!{background-image=images/slidecover.png}
### Donald Knuth (高德纳)
::: columns
::: {.column width="45%"}
- [$\TeX$的鼻祖]{.blue}
- 美国科学院院士, 美国工程院院士, 英国、法国、挪威和德国科学院的外籍院士.
斯坦福大学荣誉退休教授
- 通常写作与编程是分离的,整个过程会涉及大量繁琐的[复制和粘贴]{.blue}
- 观点: 文章应该是由文本与代码(chunks)组成的流构成
- 代码对结果(图、表格等)格式化
- 文本解释所发生的
- 两者编织(knitr)形成人与机器可读的文章
:::
::: {.column width="45%"}
```{r, out.width='20%', fig.show='hold', echo=FALSE, fig.align='center'}
knitr::include_graphics("./loc-figs/knuth.gif")
```
```{r, out.width='90%', fig.show='hold', echo=FALSE,}
knitr::include_graphics("./loc-figs/lp3.jpg")
```
```{r, out.width='90%', fig.show='hold', echo=FALSE,}
knitr::include_graphics("./loc-figs/lp2.jpg")
```
:::
:::
### R的创始人
::: columns
::: {.column width="35%"}
```{r, echo=FALSE, out.width = "99%"}
knitr::include_graphics("./loc-figs/UAucland.jpeg")
```
:::
::: {.column width="55%"}
```{r, echo=FALSE, out.width = "99%"}
knitr::include_graphics("./loc-figs/RR.png")
```
:::
:::
### Hardley Wickham
::: columns
::: {.column width="28%"}
- [重构了R的新生态]{.blue}
- [一个改变 R的人](https://zhuanlan.zhihu.com/p/77570704)
- [2019年COPSS总统奖获得者](http://hadley.nz/)
```{r, echo=FALSE, out.width = "99%"}
knitr::include_graphics("./loc-figs/Hadley.png")
```
:::
::: {.column width="28%"}
- 著有R数据可视化畅销书ggplot2 (3E)
```{r, echo=FALSE, out.width = "92%"}
knitr::include_graphics("./loc-figs/Hardleybook1.jpeg")
```
:::
::: {.column width="28%"}
- 著有数据科学领域的畅销书 [R for Data Science, 2E ](https://r4ds.hadley.nz/)
```{r, echo=FALSE, out.width = "95%"}
knitr::include_graphics("./loc-figs/Hardleybook2.png")
```
:::
:::
### Hardley Wickham: packages created
```{r, echo=FALSE, out.width = "100%"}
knitr::include_graphics("./loc-figs/Harleypks1.jpg")
```
### Guido van Rossum
::: columns
::: {.column width="28%"}
- [Python 之父]{.blue},见[他的故事](https://techapple.com/archives/10553)
- 荷兰程序员,曾供职于google,现任职于dropbox
- 1982年,在阿姆斯特丹大学获得数学和计算机科学硕士学位
- 2001年度自由软件进步奖
- 2006年,ACM认定为著名工程师
- 1989年12月, 为了打发圣诞节的空余时间,编写一个以ABC语言作为基础的电脑程式语言,并以Python命名
- Python 亦为称为「胶水语言」(glue language),因为它提供了丰富的API和工具
:::
::: {.column width="28%"}
```{r, echo=FALSE, out.width = "99%"}
knitr::include_graphics("./loc-figs/Guido van Rossum.png")
```
:::
::: {.column width="28%"}
- 2016年, 在语言编程排行中,Python升至第五名
- 2017年, Python首次超越R成为数据分析、数据科学和机器学习领域的No.1
```{r, echo=FALSE, out.width = "95%"}
knitr::include_graphics("./loc-figs/Python2016.png")
knitr::include_graphics("./loc-figs/Python>R.png")
```
:::
:::
### Wes McKinney
::: columns
::: {.column width="52%"}
- [成就Python在AI中的地位]{.blue}, 见[主页](https://wesmckinney.com/)
- 毕业于MIT,杜克大学的数学和统计学两个博士学位
- 曾供职于Ursa Labs, Cloudera, DataPad, AQR等公司
- Pandas的创建者, 并借助AI的风力,青云直上
- Apache Arrow的创建者,是跨语言共享科学数据主要格式
```{r, echo=FALSE, out.width = "55%", fig.align='center'}
knitr::include_graphics("./loc-figs/Wes McKinney.png")
```
:::
::: {.column width="36%"}
- 著有数据科学领域的畅销书[Python for Data Analysis, 3E (2022)](https://wesmckinney.com/book/)
```{r, echo=FALSE, out.width = "95%",fig.align='center'}
knitr::include_graphics("./loc-figs/Pythonfordataanalytics.png")
```
:::
:::
### 文学化编程的践行者
- [谢益辉]{.blue}: 2009年 John M. Chambers奖获得者
- knitr, animation, bookdown, blogdown, pagedown, xaringan, tinytex 等R包的作者
- 自我评价: [随机漫步十八年的傻瓜](https://slides.yihui.org/2020-random-walk.html)
. . .
::: columns
::: {.column width="25%"}
```{r, echo=FALSE, out.width = "95%"}
knitr::include_graphics("./loc-figs/yihui.png")
```
:::
::: {.column width="62%"}
```{r, echo=FALSE, out.width = "99%"}
knitr::include_graphics("./loc-figs/yihuibooks.jpg")
```
:::
:::
# II. 文学化统计编程的实现 {background-image=images/bdbg.jpg}
## 2.1. 文学化统计编程的核心工具/技术 {background-image=images/slidecover.png}
### 核心工具/技术
::: columns
::: {.column width="45%"}
1. IDE: Rstudio/VS Code/Jupyter nootbook
- 语法高亮显示
- 代码自动补全
- 支持UTF-8编码
- 支持Rmd/Qmd
2. R/Quarto Markdown
- 几乎万能的(文学化写作)工具
- 完美整合R,TeX 和 Markdown
:::
::: {.column width="45%"}
3. knitr
- 支持
- [多种编程语言, 如 `R`, `Python`, `Julia`, `Observable`]{.smaller}
- [markup语言, 如`TeX`, `HTML`, `Markdown`]{.smaller}
4. [Pandoc](http://pandoc.org)
- 万能格式转换器([瑞士军刀]{.blue})
:::
:::
### Quarto IDE
- [Rstudio]{.red}: Rstudio/Posit (2022年) 推出了一个基于R的数据分析平台
- [VS Code]{.red}: Erich Gamma推出,微软维护
- [Jupyter notebook]{.red}: 支持超过40种编程语言的交互式计算
```{r}
#| label: fig-posit
#| echo: false
#| out.width: "60%"
#| fig.cap: "Rstudio到Posit"
knitr::include_graphics("./loc-figs/posit-rebrand2022.jpeg")
```
### Rstudio介绍
::: columns
::: {.column width="45%"}
- 开源免费,优秀的代码编辑器
- 可[成倍成倍]{.red}提高数据分析的效率
- 最好的跨平台IDE
- 集成多个R/Quarto Markdown文档类型/模板
- Visual 与 Source 两种编辑模式自由切换
:::
::: {.column width="45%"}
```{r}
#| label: fig-rstudio
#| echo: false
#| out.width: "90%"
#| fig.cap: "Rstudio界面"
#| fig.align: 'center'
knitr::include_graphics("./loc-figs/Rstudio-Windows.jpg")
```
:::
:::
### VS Code介绍
::: columns
::: {.column width="45%"}
- 开源免费,优秀的跨平台IDE
- 可.red[成倍成倍]提高编程的效率
- 优秀的跨平台TeX/R/Python/... IDE
- 海量的插件
- 灵活方便的个性化定制
- Visual 与 Source 两种编辑模式自由切换
:::
::: {.column width="45%"}
```{r}
#| label: fig-vscode
#| echo: false
#| out.width: "99%"
#| fig.cap: "VS Code界面"
#| fig.align: 'center'
knitr::include_graphics("./loc-figs/VScode.png")
```
:::
:::
### Quarto Markdown {.smaller}
根据 [Posit](https://posit.co/) (前身为 RStudio):
- 全新打造: 下一代的RMarkdown,与R Markdown类似, 于2021年1月开始开发,2022年12月发布第一版
- 基于 [Pandoc]{.red} 构建的开源的出版系统
- 功能更加强大和灵活: 适用于数据分析和机器学习等领域
- 支持[代码块]{.red}执行: [R, Python,Julia,JavaScript Observable]{.red} 等
- 支持多格式输出: PDF、HTML、$\LaTeX$、Word等
- 支持自定义: CSS、JavaScript和$\LaTeX$模板
- 支持优秀的IDE: VS Code, Rstudio (具备可视化编程)及Jupyter notebook
. . .
从技术的角度来看 ([Mock, 2022](https://jthomasmock.github.io/quarto-2hr-webinar/materials/01-intro-quarto.html#/so-what-is-quarto)):
> 一个**命令行界面**(CLI),[将混合格式文件(`.ipynb`/Jupyter 笔记本)或纯文本文件(`.qmd`、`.rmd`、`.md`)]{.fragment}[以不同的格式(PDF/Word/HTML等)]{.fragment}[渲染(render)成不同的输出(报告、书籍、网站、演示文稿等)]{.fragment}.
## 2.2. 文学化统计编程的要素 {background-image=images/slidecover.png}
### 数学公式
通过$\TeX$/[MathJax](https://www.mathjax.org/)/KaTeX 实现
``` tex
$$
\frac{\partial C}
{ \partial t}
+ \frac{1}{2}\sigma^2 S^2
\frac{\partial^2 C}
{\partial C^2}
+ r S
\frac{\partial C}
{\partial S}
\ = r C
$$ {#eq-black-scholes}
```
$$
\frac{\partial C}
{ \partial t}
+ \frac{1}{2}\sigma^{2} S^{2}
\frac{\partial^{2} C}
{\partial C^2}
+ r S
\frac{\partial C}
{\partial S}
\ = r C
$$ {#eq-black-scholes}
### 执行R代码
::: columns
::: {.column width="45%"}
```{r}
#| echo: TRUE
#| eval: FALSE
par(mar = c(4, 4, 1, .1))
fit = lm(dist ~ 1 + speed,
data = cars)
plot(cars, pch = 19,
col = 'blue', las = 1)
abline(fit, lwd = 2)
```
:::
::: {.column width="45%"}
```{r}
#| label: fig-regression
#| echo: false
#| eval: true
#| out.width: "99%"
#| fig.cap: "R图形: 回归分析"
#| fig.align: 'center'
par(mar = c(4, 4, 1, .1))
fit = lm(dist ~ 1 + speed,
data = cars)
plot(cars, pch = 19,
col = 'blue', las = 1)
abline(fit, lwd = 2)
```
:::
:::
### 执行Python代码
::: columns
::: {.column width="45%"}
```{r, echo=TRUE}
library(reticulate)
```
```{python}
#| echo: TRUE
#| eval: FALSE
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)
plt.grid(True)
plt.show()
plt.close("all")
```
:::
::: {.column width="45%"}
```{python}
#| label: fig-python
#| echo: false
#| eval: true
#| out.width: "99%"
#| fig.cap: "Python图形"
#| fig.align: 'center'
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)
plt.grid(True)
plt.show()