View source: R/calc_score_stats.R
calc_score_stats | R Documentation |
Starting with individual-level data on p factors, generate score test statistics for each factor for input into GBJ/GHC/HC/BJ/minP. Also get the correlations between these test statistics. Designed to be used with linear or logistic or log-linear regression null models.
calc_score_stats(null_model, factor_matrix, link_function, P_mat = NULL)
null_model |
An R regression model fitted using glm(). Do not use lm(), even for linear regression! |
factor_matrix |
An n*p matrix with each factor as one column. There should be no missing data. |
link_function |
Either "linear" or "logit" or "log" |
P_mat |
The projection matrix used in calculation may be passed in to speed up the calculation. See paper for details. Default is null. |
A list with the elements:
test_stats |
The p score test statistics. |
cor_mat |
The p*p matrix giving the pairwise correlation of every two test statistics. |
Y <- rbinom(n=100, size=1, prob=0.5)
null_mod <- glm(Y~1, family=binomial(link="logit"))
factor_mat <- matrix(data=rnorm(n=100*5), nrow=100)
calc_score_stats(null_mod, factor_mat, "logit")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.