Closed Lee211 closed 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.
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 )
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.
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.