Last updated: 2018-08-23
workflowr checks: (Click a bullet for more information) ✔ R Markdown file: up-to-date
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
✔ Repository version: d17f239
wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/.Rhistory
Ignored: docs/.DS_Store
Ignored: docs/figure/
Untracked files:
Untracked: analysis/EM.Rmd
Untracked: analysis/susie_summarySTAT_Mix.Rmd
Unstaged changes:
Modified: analysis/_site.yml
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | d17f239 | zouyuxin | 2018-08-23 | wflow_publish(c(“analysis/index.Rmd”, “analysis/ScaleZ.Rmd”)) |
Suppose we have model \[ \mathbf{y} = \mathbf{x}\beta + \epsilon \quad \epsilon \sim N(0,\sigma^2) \]
From simple linear regression, the estimations are \[ \hat{\beta} = \frac{\mathbf{x}^{T}\mathbf{y}}{\mathbf{x}^{T}\mathbf{x}} \quad \hat{\sigma}^2 = \frac{(\mathbf{y} - \mathbf{x}\hat{\beta})^{T}(\mathbf{y} - \mathbf{x}\hat{\beta})}{n-1} \quad s^{2} = \frac{\hat{\sigma}^2}{\mathbf{x}^{T}\mathbf{x}} \] \[ z = \frac{\mathbf{x}^{T}\mathbf{y}}{\hat{\sigma}\sqrt{\mathbf{x}^{T}\mathbf{x}}} \]
If we scale the \(\mathbf{y}\) and \(\mathbf{x}\) to different variance separately \[ \mathbf{y}_s = \alpha_{y}\mathbf{y} \quad \mathbf{x}_s = \alpha_{x}\mathbf{x} \]
Then \[ \hat{\beta}_{s} = \frac{\alpha_{y}\mathbf{x}^{T}\mathbf{y}}{\alpha_{x}\mathbf{x}^{T}\mathbf{x}} \]
\[ \hat{\sigma}_{s}^{2} = \frac{(\mathbf{y}_s - \mathbf{x}_s\hat{\beta}_s)^{T}(\mathbf{y}_s - \mathbf{x}_s\hat{\beta}_s)}{n-1} = \alpha_{y}^{2} \hat{\sigma}^2 \] The scaled z score is \[ z_s = \frac{\mathbf{x}_{s}^{T}\mathbf{y}_{s}}{\hat{\sigma}_{s}\sqrt{\mathbf{x}_{s}^{T}\mathbf{x}_{s}}} = \frac{\mathbf{x}^{T}\mathbf{y}}{\hat{\sigma}\sqrt{\mathbf{x}^{T}\mathbf{x}}} = z \]
This reproducible R Markdown analysis was created with workflowr 1.1.1