forked from xlladdins/xll_ml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxll_jackknife.cpp
More file actions
40 lines (35 loc) · 814 Bytes
/
xll_jackknife.cpp
File metadata and controls
40 lines (35 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// xll_jackknife.cpp - Jackknife resampling
#include "xll24/include/xll.h"
#include "fms_jackknife.h"
using namespace xll;
Auto<Open> xao_jackknife([]() {
// ensure fms_jackknife is linked
fms::jackknife_test();
return true;
});
#define CATEGORY L"STAT"
AddIn xai_jackknife(
Function(XLL_FP, L"xll_jackknife", CATEGORY L".JK")
.Arguments({
Arg(XLL_FP, L"x", L"is the array of observations."),
})
.Category(CATEGORY)
.FunctionHelp(L"Return the jackknife resampling estimates for the mean of x.")
);
_FP12* WINAPI xll_jackknife(_FP12* x)
{
#pragma XLLEXPORT
try {
int n = size(*x);
fms::jackknife(n, x->array);
return x;
}
catch (const std::exception& ex) {
XLL_ERROR(ex.what());
return nullptr;
}
catch (...) {
XLL_ERROR("xll_jackknife: unknown exception");
return nullptr;
}
}