This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The code below demonstrates that in R, growing a vector in a loop can be fast, | |
| # as long as there is only reference to the object. When there's only one | |
| # reference to the vector, R grows it in place (in most cases). However, if | |
| # there are other references to the object, R must make a copy the object | |
| # instead of growing it in place, leading to slower performance. | |
| # ========================================================================= | |
| # Timing tests | |
| # ========================================================================= |
Despite the widespread and nonsensical claim, that "logistic regression is not a regression", it constitutes one of the key regression and hypothesis testing tools used in the experimental research (like clinical trials).
Let me show you how the logistic regression (with a few extensions) can be used to test hypotheses about fractions (%) of successes, repacling the classic "test for proportions". Namely, it can replicate the results of:
- the Wald's (normal approximation) z test for 2 proportions with non-pooled standard errors (common in clinical trials) via LS-means on the prediction scale or AME (average marginal effect)
- the Rao's score (normal appr.) z test for 2 proportions with pooled standard errors (just what the
prop.test()does in R) - the z test for multiple (2+) proportions
- ANOVA-like (joint) test for multiple caterogical predictors (n-way ANOVA). Also (n-way) ANCOVA if you employ numerical covariates.
- [the **Cochran-Mantel-Haenszel
OlderNewer