Skip to content

Commit

Permalink
updated preface & some minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hcp4715 committed Sep 9, 2024
1 parent 223214a commit 983bc7d
Show file tree
Hide file tree
Showing 42 changed files with 8,704 additions and 7,975 deletions.
5 changes: 5 additions & 0 deletions Book/00-author.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 关于作者 {-}

胡传鹏(<http://huchuanpeng.com>), 南京师范大学心理学院教授。\

开放科学的支持者,开放科学中文社区(Chinese Open Science Network)的发起人之一。\
7 changes: 4 additions & 3 deletions Book/1008-lesson8_2024.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,14 @@ knitr::include_graphics('pic/chp8/SPSS.png')

这种情况下,我们需要更深入地理解平方和的计算方法,以便正确解读R的输出结果。这也是我们在使用R进行统计分析时,需要不断强化统计知识的一个重要原因。因为相比于SPSS这类点击式操作的软件,R提供了更多的选项,而正确理解和使用这些选项,就需要我们对统计学有更深入的理解。

我们是否能得到完全相同的结果呢?实际上,这是完全可能的。例如,我们可以使用afex这个包,这是在2017或2018年后出现的一个包。afex是为了满足实验心理学家进行方差分析的需求而设计的,其中包含了各种方差分析的功能。如果我们按照这样的写法,即将被试的identity写在这里,然后将类型设置为三,我们就能得到完全相同的结果。我们也可以在其他地方使用同样的方法,同样能得到一模一样的结果。

[car::Anova()]
```{r}
# 结果不一致,原因PPT显示不全,请回到rmd文档查看
aov1 <- car::Anova(stats::aov(Temperature ~ climate * romantic, data = df))
aov1
```
我们是否能得到完全相同的结果呢?实际上,这是完全可能的。例如,我们可以使用afex这个包,这是在2017或2018年后出现的一个包。afex是为了满足实验心理学家进行方差分析的需求而设计的,其中包含了各种方差分析的功能。如果我们按照这样的写法,即将被试的identity写在这里,然后将类型设置为三,我们就能得到完全相同的结果。我们也可以在其他地方使用同样的方法,同样能得到一模一样的结果。

```{r}
# 原因debug
# 查看R的默认对比设置
Expand Down Expand Up @@ -560,6 +559,7 @@ res1 <- bruceR::MANOVA(data = df,
dv = "Temperature",
between = c("climate", "romantic"))
```

```{r,echo=FALSE}
res1 %>%
capture.output()
Expand All @@ -582,6 +582,7 @@ res1 %>%
然后,我们通过改变分组条件,看了在不同climate下,恋爱关系是否有影响。结果显示,在热带和温带,恋爱关系没有显著影响,但在寒带,恋爱关系则有显著影响。这个结果与我们的预期相符,表明在较冷的气候下,恋爱关系对体温有调节作用。

此外,我们还进行了F检验,实际上是在热带、温带和寒带三种条件下进行了单因素方差分析。由于只有两个水平(恋爱和单身),所以这个F检验的结果与后面的t检验结果基本一致。这是因为在只有两个水平的情况下,F检验和t检验的结果是一样的。如果你对这个有兴趣,你可以进一步查看t值和F值之间的关系。

```{r, results='asis'}
sim_eff <- res1 %>%
bruceR::EMMEANS("climate", by = "romantic") %>%
Expand Down Expand Up @@ -616,4 +617,4 @@ res2 <- bruceR::MANOVA(

最后,我们留了一个思考题:对于重复测量设计(within-subject design),如何用回归模型进行分析?此外,我们还给出了一些课堂练习,建议大家尝试自己编写代码来完成这些练习,以加深对课程内容的理解。

本节课在此结束。感谢大家的参与,如果有任何问题,请随时提问。
本节课在此结束。感谢大家的参与,如果有任何问题,请随时提问。
Binary file modified Book/_book/_main_files/figure-html/unnamed-chunk-255-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Book/_book/_main_files/figure-html/unnamed-chunk-275-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Book/_book/_main_files/figure-html/unnamed-chunk-277-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Book/_book/_main_files/figure-html/unnamed-chunk-278-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Book/_book/_main_files/figure-html/unnamed-chunk-286-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Book/_book/_main_files/figure-html/unnamed-chunk-287-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
554 changes: 297 additions & 257 deletions Book/_book/index.html

Large diffs are not rendered by default.

583 changes: 292 additions & 291 deletions Book/_book/lesson-1.html

Large diffs are not rendered by default.

1,067 changes: 534 additions & 533 deletions Book/_book/lesson-5.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Book/_book/reference-keys.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
id_0-index
开放电子书的初衷
如何帮助完善本书
使用许可
Expand Down
489 changes: 245 additions & 244 deletions Book/_book/references.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Book/_book/search_index.json

Large diffs are not rendered by default.

622 changes: 622 additions & 0 deletions Book/_book/关于作者.html

Large diffs are not rendered by default.

865 changes: 433 additions & 432 deletions Book/_book/第七讲描述性统计与数据可视化基础.html

Large diffs are not rendered by default.

527 changes: 264 additions & 263 deletions Book/_book/第三讲git-rstudio工作流.html

Large diffs are not rendered by default.

795 changes: 398 additions & 397 deletions Book/_book/第九讲回归模型二分层线性模型.html

Large diffs are not rendered by default.

561 changes: 281 additions & 280 deletions Book/_book/第二讲如何开始使用r.html

Large diffs are not rendered by default.

910 changes: 455 additions & 455 deletions Book/_book/第八讲回归模型一.html

Large diffs are not rendered by default.

995 changes: 498 additions & 497 deletions Book/_book/第六讲数据预处理.html

Large diffs are not rendered by default.

885 changes: 443 additions & 442 deletions Book/_book/第十一讲回归模型四中介分析.html

Large diffs are not rendered by default.

1,093 changes: 547 additions & 546 deletions Book/_book/第十三讲基于网络模型的心理学研究.html

Large diffs are not rendered by default.

1,013 changes: 507 additions & 506 deletions Book/_book/第十二讲数据可视化进阶.html

Large diffs are not rendered by default.

757 changes: 379 additions & 378 deletions Book/_book/第十四讲心理学元分析入门.html

Large diffs are not rendered by default.

759 changes: 380 additions & 379 deletions Book/_book/第十讲回归模型三广义线性模型.html

Large diffs are not rendered by default.

801 changes: 401 additions & 400 deletions Book/_book/第四讲如何导入数据.html

Large diffs are not rendered by default.

2,055 changes: 1,028 additions & 1,027 deletions Book/_book/补充1如何进行基本的数据分析-相关与回归.html

Large diffs are not rendered by default.

547 changes: 274 additions & 273 deletions Book/_book/补充2从分析到手稿.html

Large diffs are not rendered by default.

715 changes: 358 additions & 357 deletions Book/_book/补充3效应量和元分析.html

Large diffs are not rendered by default.

Binary file modified Book/_main_files/figure-html/unnamed-chunk-255-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Book/_main_files/figure-html/unnamed-chunk-275-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Book/_main_files/figure-html/unnamed-chunk-277-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Book/_main_files/figure-html/unnamed-chunk-278-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Book/_main_files/figure-html/unnamed-chunk-286-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Book/_main_files/figure-html/unnamed-chunk-287-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 47 additions & 2 deletions Book/index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ link-citations: yes
knitr::opts_chunk$set(echo = TRUE)
```

# 引言 {#0-index}
# 引言 {-}

本电子书通过[`bookdown`](https://bookdown.org/)进行创建,由于文字稿来自于对课堂录音的整理,加之本人时间不多,因此,可能存在如下问题:

- 文字口语化严重
- 图片或者文献引用不全
- 错别字等

望读者朋友多多包涵。欢迎有兴趣有能力的朋友多多批评指正。指出问题的方式:在本电子书的GitHub仓库的[issues](https://github.com/hcp4715/R4PsyBook/issues)中开新的issue。

参与贡献方式:见下面《如何帮助完善本书》这一小节。

## 开放电子书的初衷
分享知识,向众多开源的电子书作者致敬,为中文心理学领域略尽绵薄之力。
Expand All @@ -28,10 +38,45 @@ knitr::opts_chunk$set(echo = TRUE)

第一,创建github账号,然后fork这个项目。\
第二,将fork后的项目clone到您自己的电脑上。\
第三,在自己的电脑上使用Rstudio打开这个项目,然后修改您想要修改的内容。\
第三,在自己的电脑上使用Rstudio打开`Book`这个文件夹中的`Book.Rproj`,完善您觉得需要完善的内容。*\
第四,将修改后的内容push到您的github上。\
第五,在github上提交pull request。\


\* 本项目的文件夹结构如下,内容修改主要在`Book`这个子文件夹下的`100*-lesson*_2024.rmd`文件。

```
.
├── Book
│ ├── 1001-lesson1_2024.Rmd
│ ├── 1002-lesson2_2024.Rmd
│ ├── 1003-lesson3_2024.Rmd
│ ├── 1004-lesson4_2024.Rmd
│ ├── 1005-lesson5_2024.Rmd
│ ├── 1006-lesson6_2024.Rmd
│ ├── 1007-lesson7_2024.Rmd
│ ├── 1008-lesson8_2024.Rmd
│ ├── 1009-lesson9_2024.Rmd
│ ├── 1010-lesson10_2024.Rmd
│ ├── 1011-lesson11_2024.Rmd
│ ├── 1012-lesson12_2024.Rmd
│ ├── 1013-lesson13_2024.Rmd
│ ├── 1014-lesson14_2024.Rmd
│ ├── 1015-lesson15_2023.Rmd
│ ├── 1016-lesson16_2023.Rmd
│ ├── 1017-lesson17_2023.Rmd
| ├── ...
|
│ ├── data
│ │ ├── Template_Folder_System_Empirical_Chuan-Peng_Lab
│ │ ├── Template_Folder_System_Meta_Chuan-Peng_Lab
│ │ ├── match
│ │ └── penguin
├── LICENSE.md
├── R4PsyBook.Rproj
└── README.md
```
## 使用许可

本电子书使用CC4.0作为使用许可,如果您使用本电子书内容,请规范引用。
Expand Down
2 changes: 1 addition & 1 deletion Book/output/chp8/Corr.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Descriptive Statistics and Correlation Matrix:
✔ Table saved to "/Users/hcp4715/Downloads/Book/./output/chp8/Corr.doc"
✔ Table saved to "/Users/hcp4715/Library/CloudStorage/OneDrive-Personal/Teaching/Grad_R_course/R4PsyBook/Book/./output/chp8/Corr.doc"

Correlation matrix is displayed in the RStudio `Plots` Pane.

2 changes: 1 addition & 1 deletion Book/output/chp8/Lm.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
✔ Table saved to '/Users/hcp4715/Downloads/Book/./output/chp8/Lm.doc'
✔ Table saved to '/Users/hcp4715/Library/CloudStorage/OneDrive-Personal/Teaching/Grad_R_course/R4PsyBook/Book/./output/chp8/Lm.doc'

Binary file modified Book/pic/chp12/p1.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ account: hcp4715
server: bookdown.org
hostUrl: https://bookdown.org/__api__
appId: 13774
bundleId: 100415
bundleId: 100422
url: https://bookdown.org/hcp4715/R4PsyBook/
version: 1
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# R语言在心理学研究中的应用: 从数据到论文(2024版)

本repo用于将《R语言在心理学研究中的应用》一课的内容转化为文字版,并形成一本在线的bookdown电子书
本repo用于将《R语言在心理学研究中的应用》一课的内容转化为文字版,并通过[`bookdown`](https://bookdown.org/)这一R包形成一本在线的bookdown电子书

课程相关的repo:[https://github.com/hcp4715/R4Psy](https://github.com/hcp4715/R4Psy)

在线电子书地址:[https://bookdown.org/hcp4715/R4PsyBook/](https://bookdown.org/hcp4715/R4PsyBook/)

由于文字稿来自于对课堂录音的整理,而且第一版中我们只有精力完成的课堂内容的文字转换,因此,可能存在如下问题:
由于文字稿来自于对课堂录音的整理,而且目前我们主要只能完成的课堂内容的文字转换,因此,可能存在如下问题:

- 文字口语化严重
- 图片或者文献引用不全
- 错别字等

欢迎小伙伴对文字进行修改,并通过pull request的方式参与整理和完善本电子书
欢迎各位一起完善,共同将这个电子书变得更好,贡献方式见[这里](https://bookdown.org/hcp4715/R4PsyBook/#%E5%A6%82%E4%BD%95%E5%B8%AE%E5%8A%A9%E5%AE%8C%E5%96%84%E6%9C%AC%E4%B9%A6)

## 作者信息

胡传鹏(教授),南京师范大学心理学院
胡传鹏(教授),南京师范大学心理学院

### V2 版本(2024春季学期)得到以下同学的大力协助:

Expand All @@ -30,15 +30,15 @@
- 司远宁,信阳师范大学教育科学学院硕士生;
- 武婷婷,南京师范大学心理学院硕士生;
- 温佳慧,南京师范大学心理学院硕士生;
- 亓鹤潼, 南京师范大学文学院硕士生;
- 亓鹤潼,南京师范大学文学院硕士生;
- 陈逸群,南京师范大学心理学院硕士。


### V1 版本(2023春季学期)得到以下助教同学的大力协助:

-镇, 南京师范大学心理学院硕士生(2021级)
- 柏松石 南京师范大学心理学院本科生(2020级)
- 孙禾嘉 南京师范大学心理学院本科生(2020级)
- 镇, 南京师范大学心理学院硕士生(2021级)
- 柏松石, 南京师范大学心理学院本科生(2020级)
- 孙禾嘉, 南京师范大学心理学院本科生(2020级)

## 使用许可/LICENSE

Expand Down

0 comments on commit 983bc7d

Please sign in to comment.