Message Boards Message Boards

2
|
5386 Views
|
2 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Multivariate Linear Regression [Constraining to a specific constant]

Posted 10 years ago

I have data of the form {y, x1, x2, x3, x4} for about 20 entries. I want to end up with a regression model in the from y = ax1+bx2+cx3+dx4+6.9. Here's what I have done:

data := Imported data from Excel.
x1 = Transpose[data][[2]]
x2 = Transpose[data][[3]]
x3 = Transpose[data][[4]]
x4 = Transpose[data][[5]]
y = Transpose[data][[1]]
J = Transpose[{x1, x2, x3, x4, y}]
LinearModelFit[ J, {1, x1, x2, x3, x4}, {x1, x2, x3, x4}]

That works except I obviously don't get 6.9 for my constant and when I try to replace 1 with 6.9, I get an error. How should I go about constraining the constant so I get the result I want? I tried using FindFit but I'm having all sorts of syntax errors. Basically, I think FindFit will do what I want because I can constrain constants/coefficients, but I'm having trouble with the syntax. Any help would be lovely and I can provide more information or code if needed.

POSTED BY: Jeffrey Korum
2 Replies
POSTED BY: Jeffrey Korum
Posted 10 years ago
POSTED BY: Peter Crosbie
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