From: Dave De Carteret on
I am working to create a multi-variate linear regression where I have:
y=measured observations
x=matrix of parameters that are being used to predict the outcome

regress() and robustfit() have been doing a relatively decent job at returning coefficients, but they often return coefficients that are opposite what is expected and opposite what is shown by the regression of individual factors.

I think this is because the predictive parameters are not fully independent of one another. With the data/observations I'm using, there will always be interactions to some extent.

Can Matlab perform multi-variate linear regressions with interactions? i.e. y = f(a, b, c, ab, ac, bc)? where ab, ac, and bc include interactions between the predictive parameters

or is there another method beyond regress() and robustfit() that will be more robust?
From: Tom Lane on
> Can Matlab perform multi-variate linear regressions with interactions?
> i.e. y = f(a, b, c, ab, ac, bc)? where ab, ac, and bc include
> interactions between the predictive parameters
>
> or is there another method beyond regress() and robustfit() that will be
> more robust?

Dave, some functions such as regstats and rstool will take a 'model'
specification that can include creation of interaction terms like the ones
you describe. For other functions, you can just do it yourself:

>> a = rand(20,1); b = rand(20,1);
>> y = 1 + 2*a + 3*b + 4*a.*b + randn(20,1)/10;
>> X = [ones(20,1), a, b, a.*b];
>> regress(y,X)

ans =

1.0124
1.9711
2.9628
4.1081

-- Tom


 | 
Pages: 1
Prev: Wavelet PAcket
Next: MatlabPool Job on cluster