Message Boards Message Boards

0
|
5398 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

[?] Interpret LinearModelFit error messages?

Posted 7 years ago

I'm trying to do multiple linear regression and having a hard time understanding the error messages I'm getting because web search doesn't find them or because the messages use terminology that isn't defined in the documentation.

Here's the synthetic data set I'm using at the moment:

data = {{5, 10, 20, 30}, {7, 13, 25, 36}, {9, 16, 30, 42}, {11, 19, 35, 48}, {13, 22, 40, 54}, {15, 25, 45, 60}, {17, 28, 50, 66}, {19, 31, 55, 72}, {21, 34, 60, 78}, {23, 37, 65, 84}, {25, 40, 70, 90}}

That's built by data = Transpose[{x1, x2, x3, x4}] where x1 = Table[2*x + 5, {x, 0, 10, 1}] and so forth.

When I try to fit it like this:

ftp = LinearModelFit[data, {c1, c2, c3}, p1]

I get this message which leaves it unclear what's wrong. *Is the problem with the list of functions {c1, c2, c3} (in what sense are these functions? My functions are 2x + 5, etc. Is the list too short or too long? What does the (3) and (1) refer to?) And what exactly are the "coordinates" and "variables" mentioned in the message?** Documentation uses neither of these terms in this context.

LinearModelFit::fitc: Number of coordinates (3) is not equal to the number of variables (1).

Many aimless permutations ensued, including this random effort, which at least produced a new but equally murky message:

ftp = LinearModelFit[data, {c1, c2, c3}, {p1, p2, p3}]
LinearModelFit::desmat: Unable to construct a numeric design matrix. Nominal variables may need to be specified, or non-numeric

entries for numeric variables may need to be replaced.

I'm more interested in understanding the terminology than patching the formula, although help of either kind would be appreciated.

POSTED BY: Brad Cox
Posted 7 years ago

It is expected that when you simultaneously post the same question on two different forums that you acknowledge that explicitly at both forums. That's because on one of the forums the answer might have been given and yet those only on the other forum would be wasting their valuable time.

https://mathematica.stackexchange.com/questions/151607/how-to-interpret-linearmodelfit-error-messages

The answer to your question is found in several of the comments at that link.

POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract