forum.alglib.net

ALGLIB forum
It is currently Thu Mar 28, 2024 8:55 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Multivariate regression w/ lsfitcreatef/lsfitfit not working
PostPosted: Fri Feb 13, 2015 8:34 pm 
Offline

Joined: Tue Feb 10, 2015 8:33 pm
Posts: 2
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 54 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group