Skip to content

Commit

Permalink
R_chapter 7
Browse files Browse the repository at this point in the history
  • Loading branch information
tcy2627 committed Apr 10, 2023
1 parent 5907da7 commit 3488f5f
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 86 deletions.
30 changes: 15 additions & 15 deletions chapter_7.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,35 @@ class: center, middle
<br>
<h2 lang="en">The hypotheses:</h2>
<br>
<h2 lang="en">H0:The current sample is sampled from a population with $\mu$ of the current value.</h2>
<h2 lang="en">H1:The current sample is sampled from a population with $\mu$ that different from the current value.</h2>
<h2 lang="en">H0:The current sample is sampled from a population with μ of the current value.</h2>
<h2 lang="en">H1:The current sample is sampled from a population with μ that different from the current value.</h2>
<h2 lang="en">The significance level: α = 0.05</h2>
<br>
---
# 回顾*t*检验基础知识
## Typical research questions are:与某一特定值比较的三种情况(大于/小于或等于)

* whether the mean (m) of the sample is equal to the theoretical mean ($\mu$)?
* whether the mean (m) of the sample is equal to the theoretical mean (μ)?

* whether the mean (m) of the sample is less than the theoretical mean ($\mu$)?
* whether the mean (m) of the sample is less than the theoretical mean (μ)?

* whether the mean (m) of the sample is greater than the theoretical mean ($\mu$)?
* whether the mean (m) of the sample is greater than the theoretical mean (μ)?

---
# <h1 lang="zh-CN">回顾*t*检验基础知识</h1>
<br>
<h2 lang="en">In statistics, we can define the corresponding null hypothesis (H0) as follow:</h2>
<br>
<h3 lang="en">H0:m = $\mu$</h3>
<h3 lang="en">H0:m <= $\mu$</h3>
<h3 lang="en">H0:m => $\mu$</h3>
<h3 lang="en">H0:m = μ</h3>
<h3 lang="en">H0:m <= μ</h3>
<h3 lang="en">H0:m => μ</h3>
<br>
<br>
<h2 lang="en">The corresponding alternative hypotheses (H1) are as follow:</h2>
<br>
<h3 lang="en">H1:m ≠ $\mu$ (not equal to)</h3>
<h3 lang="en">H1:m > $\mu$ (greater than)</h3>
<h3 lang="en">H1:m < $\mu$ (less than)</h3>
<h3 lang="en">H1:m ≠ μ (not equal to)</h3>
<h3 lang="en">H1:m > μ (greater than)</h3>
<h3 lang="en">H1:m < μ (less than)</h3>
---
# <h1 lang="zh-CN">回顾*t*检验基础知识</h1>
<br>
Expand Down Expand Up @@ -93,9 +93,9 @@ class: center, middle
<h2 lang="en">The independent samples *t*-test is used to compare the mean of two independent groups.</h2>
<br>
<h2 lang="en">Typical research questions are:</h2>
<h2 lang="en">whether the mean of group A ($\mu_A$) is equal to the mean of group B ($\mu_B$)?</h2>
<h2 lang="en">whether the mean of group A ($\mu_A$) is less than the mean of group B ($\mu_B$)?</h2>
<h2 lang="en">whether the mean of group A ($\mu_A$) is greather than the mean of group B ($\mu_B$)?</h2>
<h2 lang="en">whether the mean of group A (μ) is equal to the mean of group B (μ)?</h2>
<h2 lang="en">whether the mean of group A (μ) is less than the mean of group B (μ)?</h2>
<h2 lang="en">whether the mean of group A (μ) is greather than the mean of group B (μ)?</h2>
---
class: center, middle
<span style="font-size: 60px;">7.2 *t*-test in R</span> <br>
Expand Down Expand Up @@ -230,7 +230,7 @@ writeLines(result.ttest, "./output/chp7/pair_t.md")
![](./picture/chp7/process_8.png)


<h4 lang="zh-CN">以上均为假想的问题无关,大家可结合自己的数据改写代码</h4>
<h4 lang="zh-CN">以上均与假想的问题无关,大家可结合自己的数据改写代码</h4>
---
class: center, middle
<span style="font-size: 60px;">7.3 anova</span> <br>
Expand Down
96 changes: 37 additions & 59 deletions chapter_7.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions output/chp7/inde_t.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ If significant (violation of the assumption),
then you should better set `var.equal=FALSE`.

Results of t-test:
────────────────────────────────────────────────────────────────────────────────────────────
t df p Difference [95% CI] Cohen’s d [95% CI] BF10
────────────────────────────────────────────────────────────────────────────────────────────
ECR_mean: sex (2 - 1) -1.47 1488 .141 -0.07 [-0.17, 0.02] -0.08 [-0.19, 0.03] 1.85e-01
────────────────────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────────────────
t df p Difference [95% CI] Cohen’s d [95% CI] BF10
────────────────────────────────────────────────────────────────────────────────────────
ECR_mean: sex (2 - 1) -1.47 1488 .141 -0.07 [-0.17, 0.02] -0.08 [-0.19, 0.03]
────────────────────────────────────────────────────────────────────────────────────────

2 changes: 1 addition & 1 deletion output/chp7/one_sample_t.doc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ table th, table td {padding-left: 5px; padding-right: 5px; height: 19px;}
<tr> <th align='left'></th> <th align='right'><i>t</i></th> <th align='right'><i>df</i></th> <th align='right'><i>p</i></th> <th align='right'> </th> <th align='right'>Difference [95% CI]</th> <th align='right'>Cohen’s <i>d</i> [95% CI]</th> <th align='right'>BF<sub>10</sub></th> </tr>
</thead>
<tbody>
<tr> <td align='left'>HOME_mean: (HOME_mean - 3.5)</td> <td align='right'>25.97</td> <td align='right'>1489</td> <td align='right'>< .001</td> <td align='left'>***</td> <td align='right'>0.49 [0.45, 0.53]</td> <td align='right'>0.67 [0.62, 0.72]</td> <td align='right'>1.21e+119</td> </tr>
<tr> <td align='left'>HOME_mean: (HOME_mean - 3.5)</td> <td align='right'>25.97</td> <td align='right'>1489</td> <td align='right'>< .001</td> <td align='left'>***</td> <td align='right'>0.49 [0.45, 0.53]</td> <td align='right'>0.67 [0.62, 0.72]</td> <td align='right'></td> </tr>
</tbody>
</table>
<p></p>
Expand Down
10 changes: 5 additions & 5 deletions output/chp7/pair_t.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Descriptives:
─────────────────────────────────

Results of t-test:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
t df p Difference [95% CI] Cohen’s d [95% CI] BF10
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
Paired: (Temperature_t2 - Temperature_t1) 16.70 1489 <.001 *** 0.22 [0.20, 0.25] 0.43 [0.38, 0.48] 7.65e+53
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────
t df p Difference [95% CI] Cohen’s d [95% CI] BF10
───────────────────────────────────────────────────────────────────────────────────────────────────────────
Paired: (Temperature_t2 - Temperature_t1) 16.70 1489 <.001 *** 0.22 [0.20, 0.25] 0.43 [0.38, 0.48]
───────────────────────────────────────────────────────────────────────────────────────────────────────────

2 changes: 1 addition & 1 deletion output/chp7/single_t.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Descriptives:
HOME_mean 1490 3.99 (0.73)
───────────────────────────

Table saved to "/Users/hcp4715/Library/CloudStorage/OneDrive-Personal/Teaching/2023NNU_R/R4Psy/./output/chp7/one_sample_t.doc"
Table saved to "D:/R4Psy/./output/chp7/one_sample_t.doc"

0 comments on commit 3488f5f

Please sign in to comment.