0
$\begingroup$

I have an dependent variable $P$ and two independent variables $V$ and $T$. They give me a set of measurements and ask me to fit the data to a "first order lineal model" of the form: $$ P = a_0 + a_1 V + a_2 T + e $$ or a second order model like: $$ P = b_1 + b_1 V + b_2 T + b_3 V^2 + b_4 T^2 + b_5 TV + e $$ where $a_i$ and $b_i$ are the coefficients and $e$ is error.

Where do I can find the method to do it? What kind of fit are they asking for, I mean, what is its name?

I think it has to do with empirical equations but I don't know where to find the way to solve this.

$\endgroup$
2
  • 1
    $\begingroup$ Welcome to math.SE! Please try to use LaTeX to format your equations when asking questions here. Also to answer your question, it's called linear regression...Pretty much all environments/frameworks for analyzing data (Excel, R, etc..) have integrated methods of doing that. $\endgroup$
    – air
    Apr 1, 2016 at 23:46
  • 1
    $\begingroup$ The search term you want is "linear model" (or linear regression) $\endgroup$ Apr 2, 2016 at 2:33

2 Answers 2

0
$\begingroup$

There are many ways to fit linear regression models.

The most common way is to use least squares; that is, to choose the coefficients that minimize the sum of squares of residuals. However, any number of other criteria could be used.

One of the reasons why least squares is popular is that it's solution is of particularly simple form.

If you let $y = [P_i]$ (i.e. let $y$ be the n-vector of $P$ values) and $X = [\mathbf{1},V,T]$ (an $n\times 3$ matrix), then the least squares solution to your first equation corresponds to solving the normal equations $[X^\top X]\,\hat{\alpha}=X^\top y$ for which the algebraic solution is $\hat{\alpha} = [X^\top X]^{-1} X^\top y$. However, in practice you don't ever invert $[X^\top X]$; the solution is obtained in ways that are substantially numerically more stable (most often by performing a QR-decomposition on $X$).

Many programs (including all statistics packages worth the name) offer least squares regression. [As one example, the free software R does this, amongst a host of more sophisticated things; Excel has some very basic ability to do regression, but it's a bit clunky.]

Your second equation can be done the same way by letting $X=[\mathbf{1},V,T,V^2,T^2,VT]$

See Wikipedia, for example its introduction to Linear regression

Also check some of our regression-related tags; the two most popular are regression and multiple-regression

If you want something other than least squares, some additional information on your needs may be required.

$\endgroup$
0
$\begingroup$

I'm not sure if this is what you are looking for, but you could perform backward stepwise selection with two predictors in R, as such,

step(lm(Sepal.Length ~ (Sepal.Width + Petal.Length + I(Sepal.Width^2) + 
I(Petal.Length^2))^2, data = iris), direction = "backward")

this includes the explanatory variables with polynomial transform, just remove these for first order.

Keep in mind the interaction terms between two continuous variables are very difficult to interpret.

$\endgroup$

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.