Home > Net >  Optimization problem - multivariable linear array, fitting data to data
Optimization problem - multivariable linear array, fitting data to data

Time:12-28

I have a multivariable linear optimization problem that I could use some guidance with on finding an optimal function/code method (Matlab). My problem is as as follows:

  1. I have a set of observed data, I'll call this d(i), which is a 5000x1 vector (# of rows may change).

  2. I have 10 - 100 sets of simulated data, the number of sets is a number I decide on. Each of these sets is also a 5000x1 vector (again, # of rows may change). I'll call these c1(i), c2(i), etc.

  3. I would like to fit the simulated data sets to the observed data set with this equation:

sf1*c1(i) sf2*c2(i) sf3*c3(i) sf4*c4(i) ... = d(i) error

In this equation, I would like to solve for all of the scale factors (sf) (non-negative constants) and the error. I am assuming I need to set initial values for all the scale factors for this problem to work. I have looked into things like lssqnonneg, but I am unclear on whether that function can solve or optimize for this many variables per equation.

See above - I have also manually input the values of some scale factors and I can get a pretty good fit to the data by hand, but this is impractical for large quantities of simulated data sets.

CodePudding user response:

did you try looking at https://www.mathworks.com/help/stats/linear-regression.html?s_tid=CRUX_lftnav ?

Instead of using c1,c2,...c100 as different vectors better concatenate them into an array 100x5000, say A=[c1;c2;...;c100] this will be needed to make life easier.

Then look for example at ridge regression

Ans= ridge(d,A,k)

where k is the regularization parameter that can be found by cross-validation:

[U,s,V]=svd( A,"econ");
k=gcv(U,diag(s),d,'tsvd'); 

see the function gcv here https://www.mathworks.com/matlabcentral/fileexchange/52-regtools

  • Related