Polyfit with three variable

classic Classic list List threaded Threaded
7 messages Options
SGM
Reply | Threaded
Open this post in threaded view
|

Polyfit with three variable

SGM
Hi,
I need help with linear regression with three variables.

I was running the following code:
   N_Liner=1; 
    P_Liner=polyfit(G,Temp,I_PV,N_Liner)

getting the following error "error: polyfit: N must be a non-negative integer".

Is there any way out?

Regards,
Swagata


Reply | Threaded
Open this post in threaded view
|

Re: Polyfit with three variable

Doug Stewart-4


On Sun, Dec 20, 2020 at 7:13 AM swagata Mukherjee <[hidden email]> wrote:
Hi,
I need help with linear regression with three variables.

I was running the following code:
   N_Liner=1; 
    P_Liner=polyfit(G,Temp,I_PV,N_Liner)

getting the following error "error: polyfit: N must be a non-negative integer".

Is there any way out?

Regards,
Swagata

Show us what these values are.
G
Temp
I_PV
N_Liner

--
DASCertificate for 206392



SGM
Reply | Threaded
Open this post in threaded view
|

Re: Polyfit with three variable

SGM
Hi,
The files are attached.

Regards,
Swagata

On Sun, Dec 20, 2020 at 5:57 PM Doug Stewart <[hidden email]> wrote:


On Sun, Dec 20, 2020 at 7:13 AM swagata Mukherjee <[hidden email]> wrote:
Hi,
I need help with linear regression with three variables.

I was running the following code:
   N_Liner=1; 
    P_Liner=polyfit(G,Temp,I_PV,N_Liner)

getting the following error "error: polyfit: N must be a non-negative integer".

Is there any way out?

Regards,
Swagata

Show us what these values are.
G
Temp
I_PV
N_Liner

--
DASCertificate for 206392




linear_regression_model_IPV.m (976 bytes) Download Attachment
PV Modeling Book Data Source.xlsx (9M) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Polyfit with three variable

Doug Stewart-4


On Sun, Dec 20, 2020 at 8:16 AM swagata Mukherjee <[hidden email]> wrote:
Hi,
The files are attached.

Regards,
Swagata

On Sun, Dec 20, 2020 at 5:57 PM Doug Stewart <[hidden email]> wrote:


On Sun, Dec 20, 2020 at 7:13 AM swagata Mukherjee <[hidden email]> wrote:
Hi,
I need help with linear regression with three variables.

I was running the following code:
   N_Liner=1; 
    P_Liner=polyfit(G,Temp,I_PV,N_Liner)

getting the following error "error: polyfit: N must be a non-negative integer".

Is there any way out?

Regards,
Swagata

Show us what these values are.
G
Temp
I_PV
N_Liner

--
DASCertificate for 206392

If you look at the help for polyfit:
help polyfit

You will see that your inputs to polyfit are wrong. 
 you should give it the x and y values and the deg. of polynomial that you want.


--
DASCertificate for 206392



SGM
Reply | Threaded
Open this post in threaded view
|

Re: Polyfit with three variable

SGM
Hi,
My question is whether we have any method by which I can use regression with 3 variables like polyfit(x,y,z,N)?
Regards

On Sun 20 Dec, 2020, 8:24 PM Doug Stewart, <[hidden email]> wrote:


On Sun, Dec 20, 2020 at 8:16 AM swagata Mukherjee <[hidden email]> wrote:
Hi,
The files are attached.

Regards,
Swagata

On Sun, Dec 20, 2020 at 5:57 PM Doug Stewart <[hidden email]> wrote:


On Sun, Dec 20, 2020 at 7:13 AM swagata Mukherjee <[hidden email]> wrote:
Hi,
I need help with linear regression with three variables.

I was running the following code:
   N_Liner=1; 
    P_Liner=polyfit(G,Temp,I_PV,N_Liner)

getting the following error "error: polyfit: N must be a non-negative integer".

Is there any way out?

Regards,
Swagata

Show us what these values are.
G
Temp
I_PV
N_Liner

--
DASCertificate for 206392

If you look at the help for polyfit:
help polyfit

You will see that your inputs to polyfit are wrong. 
 you should give it the x and y values and the deg. of polynomial that you want.


--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: Polyfit with three variable

mmuetzel
Am 20. Dezember 2020 um 15:57 Uhr schrieb "swagata Mukherjee":
> Hi,
> My question is whether we have any method by which I can use regression with 3 variables like polyfit(x,y,z,N)?
> Regards 

This answer on the discourse forum might be helpful:
https://octave.discourse.group/t/execucao-do-codigo/497/8

In principle, that approach also works for multi-dimensional polynomials of higher degree.

HTH,
Markus



Reply | Threaded
Open this post in threaded view
|

Re: Polyfit with three variable

Andreas Stahel
mmuetzel wrote

> Am 20. Dezember 2020 um 15:57 Uhr schrieb "swagata Mukherjee":
>> Hi,
>> My question is whether we have any method by which I can use regression
>> with 3 variables like polyfit(x,y,z,N)?
>> Regards 
>
> This answer on the discourse forum might be helpful:
> https://octave.discourse.group/t/execucao-do-codigo/497/8
>
> In principle, that approach also works for multi-dimensional polynomials
> of higher degree.
>
> HTH,
> Markus

The linl given by Markus is a good one.

You might have a look at the command LinearRegression() in the optimization
package or the command regress().
To deal with multiple variable have a look at Section 2.2 in
https://web.sha1.bfh.science/Labs/PWF/Documentation/OctaveAtBFH.pdf
Example 2 (p. 162) and Example 4 (p. 168) use multiple variables.

I hope this helps

Andreas




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html