help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Model object as output for linear regression in Octave 3.8


From: Juan Pablo Carbajal
Subject: Re: Model object as output for linear regression in Octave 3.8
Date: Mon, 22 Sep 2014 14:50:40 +0200

On Mon, Sep 22, 2014 at 1:40 PM, Narayanan, Krishnaprasad
<address@hidden> wrote:
> Hallo all,
>
>
>
> I am using Octave 3.8.0 to build a linear model that has several input
> features and one output feature. I will be using this model in order to
> predict the output for the given set of input features. When I searched on
> the web for statistical packages, I found the following functions: polyfit
> and regress. But none of these functions returns me a model object which I
> can use it for prediction.
>
>
>
> Can I kindly know from the forum is there a function in octave that returns
> me a model object for linear regression?
>
>
>
> Regards,
>
> Krishnaprasad
>
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave
>

Krishnaprasad

If you want to use linear regression you do not need polyfit. The
function regress indeed returns a model you can use, here a minimalist
example

X = randn(10,5);
y = X*linspace(-1,1,5).' + 0.01*randn(10,1);
B = regress (y, X);
plot(y,'.;data;',X*B,'o;train;')
X_new = randn(100,5);
y_predict = X_new*B

Just make sure you read the help of regress to understand its outputs
and also check your theory on linear regression for more robust
results.

Hope this helps.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]