gusevlab / fusion_twas

methods for functional summary-based imputation
http://gusevlab.org/projects/fusion/
GNU General Public License v3.0
74 stars 43 forks source link

the beta of model top1 #25

Closed Lee211 closed 4 years ago

Lee211 commented 4 years ago

Marginal Z-scores (used for top1)

weights.marginal = function( genos , pheno , beta=F ) { if ( beta ) eff.wgt = t( genos ) %% (pheno) / ( nrow(pheno) - 1) else eff.wgt = t( genos ) %% (pheno) / sqrt( nrow(pheno) - 1 ) return( eff.wgt ) }

For above code, I want to know I can how to select the value of beta : T or F? If T, not need sqrt.

sashagusev commented 4 years ago

I'm sorry I don't understand the question. Setting beta=T will produce the effect size and setting beta=F will produce the Z-score.

Lee211 commented 4 years ago

In the cv, beta = T, but beta=F in the final calculate wgt , is it no problem?

In the script of FUSION.compute_weights.R: line 323: else if ( models[mod] == "top1" ) { pred.wgt = weights.marginal( genos$bed[ cv.sample[ -indx ],] , as.matrix(cv.train[,3,drop=F]) , beta=T ) pred.wgt[ - which.max( pred.wgt^2 ) ] = 0

line 368: else if ( models[mod] == "top1" ) { wgt.matrix[,mod] = weights.marginal( genos$bed , as.matrix(pheno[,3]) , beta=F )

sashagusev commented 4 years ago

I don't think this is a problem. FUSION stores all of the marginal associations (which are useful for other post-TWAS analyses) but only uses the top one for "top1" model prediction.