#include /* log */ #include using namespace Rcpp; // [[Rcpp::export]] double LRTrow(IntegerVector x) { LogicalVector z = x>0; IntegerVector y = x[z]; double lrtc = sum(y); if (lrtc>0) lrtc = - lrtc*log(lrtc); for (int i=1; i<= y.size(); i++) lrtc += y[i-1]*log(y[i-1]); return lrtc; } /*** R LRTrow(c(2,1,0)) */