libs/besiq/prior.cpp
double
sample_risk(const snp_row &snp1, const snp_row &snp2, const arma::vec &phenotype, arma::vec &weight)
{
    int cell = random( ) % 9;
    arma::vec permuted_phenotype = permute_phenotype( phenotype, weight );
    arma::mat counts = joint_count( snp1, snp2, permuted_phenotype, weight );

    return ( counts( cell, 1 ) + 1 ) / ( counts( cell, 0 ) + counts( cell, 1 ) + 2 );
}
/**
 * Estimates the risk in a random cell and returns the probability.
 *
 * @param snp1 First snp.
 * @param snp2 Second snp.
 * @param phenotype Phenotype.
 * @param weight Weight for each sample.
 *
 * @return The estimated risk in a random cell.
 */
Estimates the risk in a random cell and returns the probability.
@param snp1 First snp.
@param snp2 Second snp.
@param phenotype Phenotype.
@param weight Weight for each sample.

@return The estimated risk in a random cell.
Estimates the risk in a random cell and returns the probability . @param snp1 First snp . @param snp2 Second snp . @param phenotype Phenotype . @param weight Weight for each sample . @return The estimated risk in a random cell .
double
sample_risk(const snp_row &snp1, const snp_row &snp2, const arma::vec &phenotype, arma::vec &weight)
{
    int cell = random( ) % 9;
    arma::vec permuted_phenotype = permute_phenotype( phenotype, weight );
    arma::mat counts = joint_count( snp1, snp2, permuted_phenotype, weight );
    return ( counts( cell, 1 ) + 1 ) / ( counts( cell, 0 ) + counts( cell, 1 ) + 2 );
}
double sample_risk ( const snp_row & snp1 , const snp_row & snp2 , const arma :: vec & phenotype , arma :: vec & weight ) { int cell = random ( ) % 9 ; arma :: vec permuted_phenotype = permute_phenotype ( phenotype , weight ) ; arma :: mat counts = joint_count ( snp1 , snp2 , permuted_phenotype , weight ) ; return ( counts ( cell , 1 ) + 1 ) / ( counts ( cell , 0 ) + counts ( cell , 1 ) + 2 ) ; }
Estimates the risk in a random cell and returns the probability.
Estimates the risk in a random cell and returns the probability .