forum.alglib.net http://forum.alglib.net/ 

Multivariate regression w/ lsfitcreatef/lsfitfit not working http://forum.alglib.net/viewtopic.php?f=2&t=2240 
Page 1 of 1 
Author:  selulven [ Fri Feb 13, 2015 8:34 pm ] 
Post subject:  Multivariate regression w/ lsfitcreatef/lsfitfit not working 
I'm trying to use alglib.lsfitcreatef to do a multivariate regression over 15 parameters and 385 samples. My code is this: double epsf = 0; double epsx = 1; int maxits = 0; int info; alglib.lsfitstate state; alglib.lsfitreport rep; double diffstep = 0.0001; double[] solution = new double[15]; for (int i = 0; i < 15; i++) solution[i] = 1; alglib.lsfitcreatef(independent_vars, dependent_vars, solution, dependent_vars.Length, solution.Length, solution.Length, diffstep, out state); alglib.lsfitsetcond(state, epsf, epsx, maxits); alglib.lsfitfit(state, Function, null, null); alglib.lsfitresults(state, out info, out solution, out rep); In this case, N = 385, M = 15 and K = 15. As you can see, I'm creating an initial solution of 1 for each parameter, and then I use lsfitcreatef and lsfitfit to solve the linear regression. However, the output solution is always the same as the initial  every parameter is 1. If I set K = 1, with everything else unchanged, I get a proper solution for the first parameter  9194173.1672351. If I set K = 2, I get 1 for both parameters. Am I doing something wrong? Thanks. 
Page 1 of 1  All times are UTC 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ 