• Nenhum resultado encontrado

Regressão Linear e Multilinear

N/A
N/A
Protected

Academic year: 2021

Share "Regressão Linear e Multilinear"

Copied!
19
0
0

Texto

(1)

Regressão Linear e

Multilinear

Delineamento Experimental

Mestrado em Sistemas de Produção em

Agricultura Mediterrânica

(2)

Modelo de Regressão

Linear Simples

†

X – Variável Independente

†

Y – Variável Dependente

†

β

0

– ordenada na origem

†

β

1

– coeficiente de regressão

†

ε

i

– erro ou resíduo aleatório

†

A partir de n pares de observações (x

i

, y

i

)

podemos estimar β

0

e β

1

através do

método

dos mínimos quadrados.

†

minimização da soma dos quadrados dos

desvios das observações à recta de regressão

i

0

1 i

i

y

= β + β

x

+ ε

(

)

n

n

2

2

i

i

0

1 i

i 1

i 1

SQE

y

x

=

=

=

ε =

− β − β

(3)

Método dos Mínimos Quadrados

†

Os estimadores de mínimos quadrados são:

†

Recta de Regressão

(

)

(

)

n n n i 0 1 i i 0 1 i 0 i 1 i 1 i 1 n n n n 2 i 0 1 i i i i 0 i 1 i i 1 i 1 i 1 i 1 1

dSQE

0

2

y

x

0

y

n

x

d

dSQE

0

2

y

x x

0

x y

x

x

d

= = = = = = =

=

− β − β

=

= β + β

β

=

− β − β

=

= β

+ β

β

(

)(

)

(

)

n

i

i

xy

i 1

1

n

2

xx

i

i 1

x

x y

y

S

ˆ

S

x

x

=

=

β =

=

0

1

ˆ

y

ˆ

x

β = − β

0

1

ˆ

ˆ

ˆy

= β + β

x

(4)

Pressupostos

Resíduos ε

i

:

„

Distribuição normal

„

Valor médio nulo

„

Variâncias iguais ( σ

2

)

„

Independentes

(5)

Coeficiente de Determinação

Percentagem da variação total que é explicada

pela relação linear entre X e Y.

R

2

=1 Variação total de Y é explicada totalmente

pela variação de X

R

2

=0 Variação de X não contribui em nada para

explicar a variação de Y

(

)

(

)

(

)

n

n

n

2

2

2

i

i

i

i

i 1

i 1

i 1

Variaçao Total

Variaçao Nao Explicada

Variaçao Explicada

ˆ

ˆ

y

y

y

y

y

y

=

=

=

=

+









 

 

 

(

)

(

)

(

)

(

)

n

n

2

2

i

i

i

2

i 1

i 1

n

n

2

2

YY

i

i

i 1

i 1

ˆ

ˆ

y

y

y

y

SQE

R

1

1

S

y

y

y

y

=

=

=

=

=

= −

= −

(6)

Inferência

2

0

0

xx

1

x

ˆ

N

,

n S

β ∩

β σ

+

1

1

xx

ˆ

N

,

S

σ

β ∩

β

(

)

n

2

i

i

2

i 1

ˆ

y

y

SQE

ˆ

QME

n 2

n 2

=

σ =

=

=

0

0

n 2

2

xx

ˆ

t

1

x

QME

n S

β − β

+

1

1

n 2

xx

ˆ

t

QME

S

β − β

(7)

Inferência

†

Intervalo de confiança de nível (1-

α)100%

para

β

0

†

Intervalo de confiança de nível (1-

α)100%

para

β

1

†

Testes de Hipóteses para

β

1

e

β

2

2 2 0 n 2,1 / 2 0 n 2,1 / 2 xx xx

1

x

1

x

ˆ

t

QME

,

ˆ

t

QME

n S

n S

− −α − −α

β −

×

+

β +

×

+

1

n 2,1

/ 2

1

n 2,1

/ 2

xx

xx

QME

QME

ˆ

t

,

ˆ

t

S

S

−α

−α

β −

β +

0 0

0

0

0

0

0

n 2

2

xx

H :

ˆ

T= t

1

x

QME

n S

β = β

β − β

+

0 0

0

1

1

1

1

n 2

xx

H :

ˆ

T= t

QME

S

β = β

β − β

(8)

Predição

†

Estimação pontual para uma nova

observação x

0

†

Intervalo de Confiança para E( Y| x

0

)

de nível (1-α).100%

†

Intervalo de Predição para y

0

de nível

(1-α).100%

0

ˆ

0

ˆ

1 0

ˆy

= β + β

x

(

)

2

(

)

2

0

0

0

n 2,1 /2

0

n 2,1 /2

xx

xx

x x

x x

1

1

ˆ

ˆ

y t

QME 1

, y t

QME 1

n

S

n

S

− −α

− −α

× + +

+

× + +

(

)

2

(

)

2 0 0 0 n 2,1 / 2 0 n 2,1 / 2 xx xx

x

x

x

x

1

1

ˆ

ˆ

y

t

QME

, y

t

QME

n

S

n

S

− −α − −α

×

+

+

×

+

(9)
(10)

Exemplo:

X – Preço Y – Quantidade

0 10 20 30 40 50 60 70 0 20 40 60 80 Preço Q u a n ti da de

ˆy 66.25 0.8125x

=

Model Summary ,920a ,846 ,827 6,29670 Model 1 R R Square Adjusted R Square Std. Error of the Estimate Predictors: (Constant), Preço

a. Coefficientsa 66,250 4,840 13,687 ,000 55,088 77,412 -,813 ,123 -,920 -6,630 ,000 -1,095 -,530 (Constant) Preço Model 1 B Std. Error Unstandardized Coefficients Beta Standardized Coefficients

t Sig. Lower Bound Upper Bound 95% Confidence Interval for B

Dependent Variable: Quantidade a.

Scatterplot

Dependent Variable: Quantidade

Regression Standardized Predicted Value 2,0 1,5 1,0 ,5 0,0 -,5 -1,0 -1,5 Regr es si on St andar di zed Res idual 1,5 1,0 ,5 0,0 -,5 -1,0 -1,5 -2,0

Normal P-P Plot of Regression St Dependent Variable: Quantidade

Observed Cum Prob

1,0 ,8 ,5 ,3 0,0

Expected Cum Prob

1,0

,8

,5

,3

(11)

Modelo de Regressão

Múltipla

†

X

1

, X

2

, ...X

k

Variáveis Independentes

†

Y –

Variável Dependente

†

A partir de n>k observações podemos

estimar β

i

(i=0, 1, 2, ..., k) através do

método dos mínimos quadrados.

i

0

1 i1

2 i2

k

ik

i

y

= β + β

x

+ β

x

+ + β

...

x

+ ε

(

) (

)

n

T

2

T

i

i 1

SQE

Y X

Y X

=

=

ε = ε ε =

− β

− β

1

11

1k

0

1

2

21

2k

1

2

n

n1

nk

k

n

Y

1 X

... X

Y

1 X

... X

Y

; X=

;

;

Y

1 X

... X

 

 

β

 

ε

 

 

 

 

 

β

 

ε

 

 

 

=

 

β =

 

ε =

 

 

 

 

 

 

β

 

ε

 

 

 

 

 

 

#

#

#

#

#

#

Y X

= β + ε

(12)

Estimação de Parâmetros

†

†

Matriz de Variância-Covariância

†

(

T

)

1

T

ˆ

X X

X Y

β =

( )

ˆ

2

(

T

)

1

ˆ X X

/

Σ β = σ

T

ˆ

T

T

SQE

=

Y Y

− β

X Y

2

SQE

ˆ

QME

n k 1

σ =

=

− −

(13)

Significância do Modelo

Coeficiente de Determinação

†

(

)

(

)

(

)

n

n

n

2

2

2

i

i

i

i

i 1

i 1

i 1

SQTot

SQE

SQ Reg

ˆ

ˆ

y

y

y

y

y

y

     

=

=

=

=

+

2

YY

SQ Reg

SQE

R

1

SQTot

S

=

= −

0

1

2

k

1

i

H :

...

0

H :

0, para pelo menos um i (i=1, 2, ..., k)

β = β = β =



 β ≠



n-1

Total

n-k-1

Erro

k

Regressão

F

QM

SQ

GL

OV

2 n T T i i 1

1

ˆ X Y

y

n

=



β



T

ˆ

T T

Y Y

− β

X Y

2 n T i i 1

1

Y Y

y

n

=





QM Reg

F

QME

=

SQ Reg

k

SQE

n k 1

− −

0

k, n-k-1,

(14)

Contribuições Parciais

†

Determinar se as variáveis contribuem

significativamente para o modelo de regressão.

Ajustar o modelo assumindo H

0

1

=0 Verdadeira

1 2 r

X ,X ,...X

(

)

1

1

2

2

1 1

2 2

0

1

1

1

,

~ r 1 e

~ k 1 r

1

Y

X

X

H :

0

H :

0

 

β

 

 

β = − β

 

×

β

− − ×

 

β

 

 

=

β +

β + ε

β =



 β ≠



(

)

( )

(

)

( )

( )

1

T

T

2 2

2

2

2

2

T

2

2

2

1

2

2

ˆ

Y

X

X X

X Y

ˆ

SQReg

X Y

SQ Reg

|

SQReg

SQ Reg

=

β + ε →

β =

β = β

β β =

β −

β

(

1 2

)

0 r, n-k-1,

1-SQReg

|

/ r

Rejeitar H ao nivel sse F=

f

QME

α

β β

(15)

Inferência

†

Intervalo de confiança de nível

(1-

α)100% para β

j

C

jj

– elemento da matriz (X

T

X)

-1

†

Testes de Hipóteses para

β

j

(

2

2

)

j

n k 1,1

/ 2

jj

j

n k 1,1

/ 2

jj

ˆ

t

ˆ

C ,

ˆ

t

ˆ

C

− − −α

− − −α

β −

σ

β +

σ

0

0

0

j

j

j

j

n k 1

2

jj

H :

ˆ

E.T.

T=

t

ˆ C

− −

β = β

β − β

σ

(16)

Inferência

†

Intervalo de confiança de nível

(1-

α) 100% para E(Y

0

)

†

Predição de Novas Observações

(

)

1

2 T

T

0

n k 1,1

/ 2

0

0

ˆ

ˆ

y

t

− − −α

x X X

x

±

σ

01

T

0

0

0

0

0k

1

x

ˆ

ˆ

E(Y )

y

x x

x

=

=

β

=  

#

(

)

1

2

T

T

0

n k 1,1

/ 2

0

0

ˆ

ˆ

y

t

− − −α

1 x X X

x

±

σ

+

(17)

Exemplo 1:

X

1

– Fertilizante; X

2

– Precipitação

Y – Produção de um cereal (kg/ha)

Coefficientsa 126,314 181,914 ,694 ,518 -341,311 593,939 ,781 ,216 ,463 3,616 ,015 ,226 1,337 1,032 ,241 ,547 4,276 ,008 ,412 1,652 (Constant) Fertilizante Precip. Model 1 B Std. Error Unstandardized Coefficients Beta Standardized Coefficients

t Sig. Lower Bound Upper Bound 95% Confidence Interval for B

Dependent Variable: Produção a. ANOVAb 1185768 2 592884,236 266,608 ,000a 11119,028 5 2223,806 1196887 7 Regression Residual Total Model 1 Sum of

Squares df Mean Square F Sig.

Predictors: (Constant), Precip., Fertilizante a.

Dependent Variable: Produção b. Model Summaryb ,995a ,991 ,987 47,15724 Model 1 R R Square Adjusted R Square Std. Error of the Estimate Predictors: (Constant), Precip., Fertilizante

a.

Dependent Variable: Produção b. Correlations 1,000 ,978 ,983 ,978 1,000 ,942 ,983 ,942 1,000 . ,000 ,000 ,000 . ,000 ,000 ,000 . 8 8 8 8 8 8 8 8 8 Produção Fertilizante Precip. Produção Fertilizante Precip. Produção Fertilizante Precip. Pearson Correlation Sig. (1-tailed) N

Produção Fertilizante Precip.

Descriptive Statistics 1631,2500 413,50203 450,0000 244,94897 1117,5000 219,26826 Produção Fertilizante Precip. Mean Std. Deviation

(18)

Exemplo 1 (Cont.)

Scatterplot

Dependent Variable: Produção

Regression Standardized Predicted Value

1,5 1,0 ,5 0,0 -,5 -1,0 -1,5

Regression Standardized Residual

1,5 1,0 ,5 0,0 -,5 -1,0 -1,5 -2,0

Normal P-P Plot of Regression St

Dependent Variable: Produção

Observed Cum Prob

1,0 ,8

,5 ,3

0,0

Expected Cum Prob

1,0 ,8 ,5 ,3 0,0

(19)

Regressão Não-Linear

†

Modelo Potência (Log-log)

†

Modelo Exponencial (Log-lin)

†

Modelo Logarítmico (Lin-log)

†

Modelo Inverso

†

Modelo Log-Inverso

1

ˆ

0

ˆ

ˆY

= β

X

β

0

1

ˆ

ˆ X

ˆY e

=

β +β

0

1

ˆ

ˆ

ˆY

= β + β

ln X

0

1

1

ˆ

ˆ

ˆY

X

= β + β

0

1

1

ˆ

ˆ

X

ˆY e

=

β +β

Referências

Documentos relacionados

Considerando o brincar como uma atividade essencial na vida da criança, a construção dessa monografia teve como referência as minhas experiências pedagógicas

Especificamente sobre a Sociedade Italiana Pelotense, existe um Trabalho de Conclusão do Curso de História no Núcleo de Documentação Histórica (NDH) da

Os resultados mostram que a detecção é maior quando se usa tomografia computadorizada de feixe cônico e que, logo, esta é uma confiável ferramenta para detecção

Twenty- eight cognitively unimpaired participants performed Egocentric and Allocentric Spatial Memory Tasks, as well as Spatial Span from CANTAB, Benton ’s Judge of Line

Nas tabela 14 e 15 são apresentadas as diferenças em hertz e porcentagem das medições de frequência rotacional em regime transitório de tombamento, fornecidas

A determinados intervalos os laços de histerese foram

media had profound effects on the transformation of post–communist media systems (Sparks, 2000). There is at least one clear ideological dimension within this