MCPcopy Create free account
hub / github.com/apache/madlib / MLrobuststateToResult

Function MLrobuststateToResult

src/modules/regress/multilogistic.cpp:812–839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

810}
811
812AnyType MLrobuststateToResult(
813 const Allocator &inAllocator,
814 int ref_category,
815 const HandleMap<const ColumnVector, TransparentHandle<double> >& inCoef,
816 const ColumnVector &diagonal_of_varianceMat) {
817
818 MutableNativeColumnVector variance(
819 inAllocator.allocateArray<double>(inCoef.size()));
820 MutableNativeColumnVector stdErr(
821 inAllocator.allocateArray<double>(inCoef.size()));
822 MutableNativeColumnVector waldZStats(
823 inAllocator.allocateArray<double>(inCoef.size()));
824 MutableNativeColumnVector waldPValues(
825 inAllocator.allocateArray<double>(inCoef.size()));
826
827 for (Index i = 0; i < inCoef.size(); ++i) {
828 variance(i) = diagonal_of_varianceMat(i);
829 stdErr(i) = std::sqrt(diagonal_of_varianceMat(i));
830 waldZStats(i) = inCoef(i) / stdErr(i);
831 waldPValues(i) = 2. * prob::cdf(
832 prob::normal(), -std::abs(waldZStats(i)));
833 }
834
835 // Return all coefficients, standard errors, etc. in a tuple
836 AnyType tuple;
837 tuple << ref_category << inCoef << stdErr << waldZStats << waldPValues;
838 return tuple;
839}
840
841
842/**

Callers 1

runMethod · 0.85

Calls 2

cdfFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected