0
$\begingroup$

I have a data set with three columns, say, $Y$, $X_1$ and $X_2$ of which $Y$ is the dependent variable (on $X_1$ and $X_2$). I need to know how to use any software (I have MATLAB) to develop a model in the form:

$$ \hat Y=f(X_1,X_2)=\frac {1+aX_1+bX_2}{1+cX_1+dX_2} $$

where $a$,$b$,$c$,and $d$ are constant coefficients. Can someone help me with a step-by-step guide?

$\endgroup$
6
  • $\begingroup$ (1) Please edit your title to make it more descriptive. (2) It looks like you mean to say that X1, X2, and Y are vectors, not entire datasets. Is this correct? (3) What do you mean by "develop a correlation for a model"? This is not a sensible use of the term "correlation". $\endgroup$ Commented Aug 12, 2016 at 17:06
  • $\begingroup$ @Kodiologist, many thanks for your response. Please what do you mean by vectors and datasets? By correlation, I basically mean, a function in that form shown above where a,b,c, and d are obtained statistically from the given data of (Y, X1, and X2). $\endgroup$
    – Sean001
    Commented Aug 12, 2016 at 17:30
  • 3
    $\begingroup$ Do you have any idea what a,b,c,d should be? Are there any constraints (restrictions) on their values? If not, there are going to be local minima like crazy with this function. Depending on the underlying algorithm and starting values used for the nonlinear optimization, you could get very different values. You really ought to think about what constraints, if any, make sense. How did you arrive at this particular form of $f(X_1,X_2)$? If you just follow the standard "spiel" at the mathworls links provided to you in the answer by @Alex R, things may not go well, even if they appear to. $\endgroup$ Commented Aug 12, 2016 at 18:12
  • 2
    $\begingroup$ What is the purpose of your model fitting? Do you really want to know the values of a,b,c,d ? Or do you want to make accurate interpolations (predictions of Y for interpolated values of $X_1$ and $X_2$)? Or extrapolations? $\endgroup$ Commented Aug 12, 2016 at 18:16
  • 4
    $\begingroup$ I suspect a good survey of techniques and case studies could be had by searching our site on relevant keywords, such as nonlinear fit. $\endgroup$
    – whuber
    Commented Aug 12, 2016 at 18:41

1 Answer 1

1
$\begingroup$

You want a nonlinear fit model. Check out: http://www.mathworks.com/help/stats/nonlinearmodel.fit.html

and http://www.mathworks.com/help/stats/fitnlm.html

$\endgroup$
4
  • 1
    $\begingroup$ What would a "standard nonlinear fit mode" be? Given that linear models alone cover a rich and varied territory, I would be surprised to find any commonly accepted standard nonlinear model! $\endgroup$
    – whuber
    Commented Aug 12, 2016 at 18:22
  • 4
    $\begingroup$ @whuber, I think Alex R is proposing that the OP "plug and chug" his $f(X_1,X_2)$ into the MATLAB Statistics and Machine Learning Toolbox function NonLinearModel.fit described at mathworks.com/help/stats/nonlinearmodel.fit.html , presumably using default options. As hinted at in my comments to the question, I think that course of action is fraught with peril, especially for someone who's not already knowledgeable in nonlinear least squares and optimization, which based on the question, the OP does not appear to be. $\endgroup$ Commented Aug 12, 2016 at 18:33
  • $\begingroup$ @MarkL.Stone, Well you are right, I don't have much statistical knowledge. I carried out an experiment where I got data relating Y to X1 and X2. Now based on how Y relates to X1 (at constant X2) and with X2 (at constant X1), I wanted to select a model that characterizes that and then using the data, obtain suitable coefficients such that when I input X1 and X2, I would get an output close or equal to Y. $\endgroup$
    – Sean001
    Commented Aug 13, 2016 at 19:40
  • $\begingroup$ @MarkL.Stone, However, I used MATLAB cftool and tried to fit my data into a cubic rational function. I obatined an expression which gave a good fit. My worry is whether it will be valid if I apply it to other experimental data (similar experiment nonetheless) outside the ones I used to do the fitting. $\endgroup$
    – Sean001
    Commented Aug 13, 2016 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.