add_sd_z: add_sd_z

View source: R/MODULE_5_TER_ALT.R

add_sd_zR Documentation

add_sd_z

Description

Function to add standard deviation and z statistic to test results

Usage

add_sd_z(x)

Arguments

x

A matrix representing output from a regression test or similar, with two columns per predictor (may include intercept). The first column contains a measure of effect size e.g. regression coefficient. The second column contains p-values. The matrix follows a [, beta1 p1 beta2 p2 ...] format.

Details

Regression fitting algorithms calculate a standard deviation (SD) for each coefficient (beta) and then calculate a z staistic by dividing each coefficient by its SD. P-value is obtained by comapring the statistic to the standard normal distribution. SD and z are usually not reported in the regression output because they can be recovered easily from beta and p. Z is required for empirical null testing. Both SD and z are required for the correlated tests meta-analysis. Function add_sd_z adds these two components to the (beta & p) outputs so that they can be used as input to functions such as test_ENZ or meta_test. If p-value was calculated from a distribution other than standard normal, the add_sd_z function should not be used. The user must add the SD and z columns to the output manually using apprporiate operations.

Examples

fit1_LMCN_short <- fit1_LMCN[, c(TRUE, FALSE, FALSE, TRUE)]
fit1_LMCN_restored <- add_sd_z(fit1_LMCN_short)

goodarzilab/Ribolog documentation built on Oct. 7, 2022, 10:14 p.m.