Greg Heath <
he...@alumni.brown.edu> wrote in message <
eddb55b2-e582-4ca7...@z25g2000vbs.googlegroups.com>...
>
> Why don't you extend the model to 3 variables and post the results.
> Then post the results for 4 variables.
>
> Hope this helps.
>
> Greg
> Do the same for
I tried this and got the following result which was a bit ambiguous:
> x1 = randn(15,1); x2 = randn(15,1); x3 = randn(15,1); x4 = randn(15,1);
> y = 15 + 14*x1 + 13*x2 + 12*x3 + 11*x4 + 10*x1.^2 + 9*x2.^2 + 8*x3.^2 + 7*x4.^2 + 6*x1.*x2 + 5*x1.*x3 + 4*x1.*x4 + 3*x2.*x3 + 2*x2.*x4 + 1*x3.*x4 + randn(size(x1))/100;
> x = [x1 x2 x3 x4];
> x2fx(x,'quadratic')\y
ans =
14.5224
13.2438
11.9884
12.5123
12.8083
4.6481
5.5425
8.0585
3.9399
3.6584
0.0052
9.9893
9.1804
7.8304
5.4853
But then I figured that the problem was the random term, so a second try gave the desired result:
> x1 = randn(15,1); x2 = randn(15,1); x3 = randn(15,1); x4 = randn(15,1);
> y = 15 + 14*x1 + 13*x2 + 12*x3 + 11*x4 + 10*x1.^2 + 9*x2.^2 + 8*x3.^2 + 7*x4.^2 + 6*x1.*x2 + 5*x1.*x3 + 4*x1.*x4 + 3*x2.*x3 + 2*x2.*x4 + 1*x3.*x4;
> x = [x1 x2 x3 x4];
> x2fx(x,'quadratic')\y
ans =
15.0000
14.0000
13.0000
12.0000
11.0000
6.0000
5.0000
4.0000
3.0000
2.0000
1.0000
10.0000
9.0000
8.0000
7.0000
So the order is indeed beta0, x1, x2, x3, x4, x1*x2, x1*x3, x1*x4, x2*x3, x2*x4, x3*x4, x1^2, x2^2, x3^2, x4^2.
Then I'll have to figure out what else could be the result for the non-fitting residuals.
Thanks for your help and for being patient :-)