MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / lrbuildzs

Function lrbuildzs

src/linreg.cpp:244–345  ·  view source on GitHub ↗

Like LRBuildS, but builds model Y = A(0)*X[0] + ... + A(N-1)*X[N-1] i.e. with zero constant term. -- ALGLIB -- Copyright 30.10.2008 by Bochkanov Sergey *************************************************************************/

Source from the content-addressed store, hash-verified

242 Copyright 30.10.2008 by Bochkanov Sergey
243*************************************************************************/
244void lrbuildzs(const ap::real_2d_array& xy,
245 const ap::real_1d_array& s,
246 int npoints,
247 int nvars,
248 int& info,
249 linearmodel& lm,
250 lrreport& ar)
251{
252 ap::real_2d_array xyi;
253 ap::real_1d_array x;
254 ap::real_1d_array c;
255 int i;
256 int j;
257 double v;
258 int offs;
259 double mean;
260 double variance;
261 double skewness;
262 double kurtosis;
263
264
265 //
266 // Test parameters
267 //
268 if( npoints<=nvars+1||nvars<1 )
269 {
270 info = -1;
271 return;
272 }
273
274 //
275 // Copy data, add one more column (constant term)
276 //
277 xyi.setbounds(0, npoints-1, 0, nvars+1);
278 for(i = 0; i <= npoints-1; i++)
279 {
280 ap::vmove(&xyi(i, 0), 1, &xy(i, 0), 1, ap::vlen(0,nvars-1));
281 xyi(i,nvars) = 0;
282 xyi(i,nvars+1) = xy(i,nvars);
283 }
284
285 //
286 // Standartization: unusual scaling
287 //
288 x.setbounds(0, npoints-1);
289 c.setbounds(0, nvars-1);
290 for(j = 0; j <= nvars-1; j++)
291 {
292 ap::vmove(&x(0), 1, &xy(0, j), xy.getstride(), ap::vlen(0,npoints-1));
293 calculatemoments(x, npoints, mean, variance, skewness, kurtosis);
294 if( ap::fp_greater(fabs(mean),sqrt(variance)) )
295 {
296
297 //
298 // variation is relatively small, it is better to
299 // bring mean value to 1
300 //
301 c(j) = mean;

Callers 1

lrbuildzFunction · 0.85

Calls 7

vmoveFunction · 0.85
calculatemomentsFunction · 0.85
lrinternalFunction · 0.85
round_fFunction · 0.85
vmulFunction · 0.85
getstrideMethod · 0.80
setboundsMethod · 0.45

Tested by

no test coverage detected