# Linear Regression

8 messages
Open this post in threaded view
|

## Linear Regression

 hi, look this pics https://gyazo.com/1f61457f939308195d72bba5f4266bc5i need to find linea regression i use this formula: A=[4 3 2 0 1 8] B=[1 2 3 4 5 6] regress(A,B) is write :error: regress: y must be a column vector i don't understand :| i read example but i don't understand that.. i need to find a series of points that approximate my range A -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: Linear Regression

 On 12/7/18 12:52 PM, LucaLuca wrote: > hi, > look this pics > > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgyazo.com%2F1f61457f939308195d72bba5f4266bc5&data=02%7C01%7Cprzemek.klosowski%40nist.gov%7Cc39f54f956684fe06ae208d65c6ceccb%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636798020232877101&sdata=d%2B1VRCbGZzh435lokc8nOMNqo2aUVdPvVfHgcU2VjNk%3D&reserved=0> > i need to find linea regression > > i use this formula: > > A=[4 3 2 0 1 8] > B=[1 2 3 4 5 6] > > regress(A,B) > > is write :error: regress: y must be a column vector regress(A',B') resolves that issue, but your B/A data doesn't look like your picture, so I am not sure if that's what you need. By the way, for simple linear regression, you can do polyfit(x,y,1) > > i don't understand :| > > i read example but i don't understand that.. > > i need to find a series of points that approximate my range A Do you mean some sort of linear approximation of A based on fitted data? polyval(polyfit(x,y,1),x)
Open this post in threaded view
|

## Re: Linear Regression

 In reply to this post by LucaLuca Am 07.12.2018 um 18:52 schrieb LucaLuca: > hi, > look this pics > > https://gyazo.com/1f61457f939308195d72bba5f4266bc5> > i need to find linea regression > > i use this formula: > > A=[4 3 2 0 1 8] > B=[1 2 3 4 5 6] > > regress(A,B) > > is write :error: regress: y must be a column vector > > i don't understand :| you give rows, it needs columns regress(A',B') ans =  0.75824 > > i read example but i don't understand that.. > > i need to find a series of points that approximate my range A > --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. https://www.avast.com/antivirus
Open this post in threaded view
|

## Re: Linear Regression

 In reply to this post by Przemek Klosowski-7 hi, i try this example : function esercizio_interpolazione()     pkg load statistics     a=[4 5 6 -1 0 4 -2 0 -3]     b=[1 2 3 4 5 6 7 8 9]     yi =polyfit(a',b',1)     hold on   plot(b',a','b')     plot(yi,'c') endfunction look this pics: https://gyazo.com/521d0d62cb33d334251e374c27fdce92-- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: Linear Regression

 Am 08.12.2018 um 01:06 schrieb LucaLuca: > hi, > i try this example : > > function esercizio_interpolazione() >     >    pkg load statistics >     >    a=[4 5 6 -1 0 4 -2 0 -3] >     >    b=[1 2 3 4 5 6 7 8 9] >     >    yi =polyfit(a',b',1) Luca, you should read the documentation with some attention   -- P = polyfit (X, Y, N)   -- [P, S] = polyfit (X, Y, N)   -- [P, S, MU] = polyfit (X, Y, N)       Return the coefficients of a polynomial P(X) of degree N that       minimizes the least-squares-error of the fit to the points '[X,       Y]'. You are inverting X and Y   yi =polyfit(b',a',1) yi =    -0.90000   5.94444 >     >    hold on >    plot(b',a','b') >     >    plot(yi,'c') > endfunction > > look this pics: > > https://gyazo.com/521d0d62cb33d334251e374c27fdce92> --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. https://www.avast.com/antivirus
Open this post in threaded view
|

## Re: Linear Regression

 This post was updated on . hi, i don't understand if i want to get this line : https://gyazo.com/942676a11228bc3c610419faa0867bc7how can i do it? :( i try to use https://octave.sourceforge.io/optim/function/LinearRegression.htmlbut it give me error :" 'LinearRegression' undefined near line 1 column 1 " -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html