MATLAB Answers

## Multivariate nonlinear regression model fitting

Asked by Jorge

### Jorge (view profile)

on 6 Jul 2018
Latest activity Edited by Anton Semechko

### Anton Semechko (view profile)

on 6 Jul 2018
Accepted Answer by Anton Semechko

### Anton Semechko (view profile)

I apologize since I am new to matlab
I have built a multivariate model to describe experimental data and I am trying to set up a nonlinear regression fitting to extract parameters for the model.
The model has two dependent variables that depend nonlinearly on two independent variables The model has three parameters.
I found the mvregress function, but as I understand it, it is a multivariate linear regression, which does not apply to my problem.
Thank you in advance for any help

#### 0 Comments

Sign in to comment.

R2017a

## 1 Answer

### Anton Semechko (view profile)

Answer by Anton Semechko

### Anton Semechko (view profile)

on 6 Jul 2018
Edited by Anton Semechko

### Anton Semechko (view profile)

on 6 Jul 2018
Accepted Answer

If the function you are trying to fit is linear in terms of model parameters, you can estimate these parameters using linear least squares ( 'lsqlin' documentation). If there is a nonlinear relashionship between model parameters and the function, use nonlinear least squares ( 'lsqnonlin' documentation). For example, F(x,y,c1,c2,c3)=c1*x^2 + c2*exp(y) + c3*cos(x-y), is nonlinear in terms of (x,y), but is a linear function of (c1,c2,c3) (i.e., model parameters).

Anton Semechko

### Anton Semechko (view profile)

on 6 Jul 2018
Returning to the previous example, suppose that v1 and v2 are variances of {f1_i} and {f2_i}. Define w=v1/v2. To ensure that f1 and f2 contribute equally to the sum of squares, compute residuals as R2_i=(f1_i-f1(x_i,y_i,C))^2 + w*(f2_i-f2(x_i,y_i,C))^2.
Jorge

### Jorge (view profile)

on 6 Jul 2018
I see, fantastic! Thank you!
If I can ask further, is there a simple way to obtain confidence intervals for the parameters? maybe using a bootstrap method? Thank you!
Anton Semechko

### Anton Semechko (view profile)

on 6 Jul 2018
Bootstraping is one option. Another option is to use jack-knife (i.e., leave-one-out cross-validation). Although if you have a large dataset, boostraping may be a more effective option (from computational perspective).

Sign in to comment.