# forum.alglib.net

ALGLIB forum
 It is currently Fri Jun 09, 2023 6:40 pm

 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.

 Page 1 of 1 [ 1 post ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Multivariate regression w/ lsfitcreatef/lsfitfit not workingPosted: Fri Feb 13, 2015 8:34 pm

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

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 1 post ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 22 guests

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

Search for: