Last updated: 2021-10-16
Checks: 2 0
Knit directory: misc/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
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.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version c38464e. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use 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: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: data/.DS_Store
Untracked files:
Untracked: analysis/EM_var.md
Untracked: data/ROTS_results.RData
Untracked: data/ROTS_results2.RData
Untracked: data/cate_cate_high.RData
Untracked: data/cate_cate_low.RData
Untracked: data/cate_cate_mid.RData
Untracked: data/cate_cate_null.RData
Untracked: data/mout_low.RData
Untracked: data/mout_mid.RData
Untracked: data/mout_null.RData
Untracked: data/nonUMI_simu1.RData
Untracked: data/pbmc.rds
Untracked: data/pbmc3k_filtered_gene_bc_matrices/
Untracked: data/pbmc_counts.rds
Untracked: data/prices.csv
Untracked: data/scCD14.RData
Untracked: data/scCD4.RData
Untracked: data/scCD8.RData
Untracked: data/scMB.RData
Untracked: data/sva_sva_low.RData
Untracked: data/sva_sva_mid.RData
Untracked: data/sva_sva_null.RData
Unstaged changes:
Modified: analysis/index.Rmd
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.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/logistic_bound.Rmd
) and HTML (docs/logistic_bound.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | c38464e | Dongyue Xie | 2021-10-16 | wflow_publish(“analysis/logistic_bound.Rmd”) |
Let \(y\) be a binary variable with \(p(y=1) = p\), where \(p = g(\beta)\) and \(g(x) = \frac{1}{1+\exp(-x)}\). The function \(g\) is usually called logistic function or sigmoid function.
The log likelihood is
\[\begin{equation} \begin{split} l(\beta) &= \log p(y|\beta) \\&= y\log g(\beta)+(1-y)\log (1-g(\beta)) \\&= (-\beta-\log(1+\exp(-\beta))) +y\beta \\&= (y-1)\beta - \log(1+\exp(-\beta)) \end{split} \end{equation}\]
It’s sometimes more convenient to write
\[l(\beta) = g((2y-1)\beta).\]
The summation inside \(\log\) function is a pain and it is hard to deal with. For example in variational inference of logistic regression. One method to bypass the log sum is to lower bound the function \(-\log(1+\exp(-\beta))\).
In the paper Jaakkola and Jordan, 2000, the following lower bound is suggested.
Notice that \[-\log(1+\exp(-\beta)) = \frac{\beta}{2}-\log(\exp(\beta/2)+\exp(-\beta/2)),\]
where \(f(\beta) = -\log(\exp(\beta/2)+\exp(-\beta/2))\) is a convex function in \(\beta^2\). So we can bound \(f(\beta)\) globally with a first order Taylor expansion in \(\beta^2\), leading to
\[f(\beta)\geq -\frac{\eta}{2}-\log(1+\exp(-\eta))+\frac{1}{4\eta}tanh(\frac{\eta}{2})(\beta^2-\eta^2).\]
This lower bound is exact if \(\beta^2 = \eta^2\). The lower bound is also a quadratic function in \(\beta^2\) which is a very useful property for doing Gaussian approximation.
The unknown parameter \(\eta\) is suggested to be optimized within the algorithm. It turns out that \(\eta^2 = E(\beta^2)\), the second moment of \(\beta\).
Another two useful reference: