Sei sulla pagina 1di 16

Introducerea dependentei pseudoexperimentale

i  0 16
i
x  5 y  2 x  2  rnd ( 6)
i 20 i i
Interpolare cu spline cubice
s  cspline( xy )
A ( z)  interp ( s xy z)

Calculul functiei regresiei liniare


C  line( xy )
C
L( t)  C t  C
0 1
Nivelarea cu ajutorul algoritmului adaptiv
h  supsmooth ( xy )

S  cspline( xh ) R( p )  interp ( s xh p )

y
A( z )

L( t )

R( p )

xz t p

Interpolarea cu spline cubice:


T T
x  ( 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 ) y  ( 1 3 2 3 5 3 2 0 )

I( xy )  for i  0  last( x)


for j  0  last( x)

M
i j
 x  ilast( x) j
M
1
XM y
X

last ( x) 

last ( x)
zk I( xy) 
Int( z)    ( last ( x)  k)
k 0
Int ( z )

z x

T T
x  ( 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 ) y  ( 1 3 2 3 5 3 2 0 )

s1  lspline( xy ) s2  pspline( xy ) s3  cspline( xy )

s1  s2  s3 
I1( z)  interp ( lspline( xy ) xy z)

I2( z)  interp ( pspline( xy ) xy z)

I3( z)  interp ( cspline( xy ) xy z)

I1( z ) I2( z )

y y

z x z x

I3( z )

z x

Interpolare cu B-spline:

T T
x  ( 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 ) y  ( 1 3 2 3 5 3 2 0 )

T
u1  ( 0 0.27 0.32 0.41 0.55 0.67 0.72 0.81 )
T
u2  ( 0.09 0.25 0.35 0.45 0.55 0.65 0.87 )
T
u3  ( 0 0.23 0.35 0.45 0.67 0.9 )

B1  bspline( xy u1 1) B2  bspline( xy u2 2) B3  bspline( xy u3 3)

B1  B2  B3 
0 0 0

B1 
1

B2 
1
B3 
1

B3 
2

A1( z)  interp( B1xy z) A2( z)  interp( B2xy z) A3( z)  interp( B3xy z)

LINIARA PATRATICA

A1( z ) A2( z )

y y
A1( u1) A2( u2)

z xu1 z xu2

CUBICA

A3( z )

y
A3( u3)

z xu3
REGRESIA

Regresia lineara
a  1 b  2

N  10

Err  rnorm( N 01)

i
i  0 N  1 x  10 y  a x  b  Err
i N i i i

R 
 3.185 
R  line( xy) 
 1.247 

r( z)  z R  R
1 0

f ( t)  a t  b

5
y
f ( t)

r( z ) 0 2 4 6 8 10

5

xt z

Rezultatul regresiei lineare

Folosirea functiilor alternative regresiei liniare

Err  rnorm( N 00.5)


i
i  0 N  1 x  10 y  a x  b  Err
i N i i i

intercept( xy)  1.857 slope( xy)  0.96

Regresia liniara prin metoda medianelor

a  1 b  0

N  10
Err  rnorm( N 00.6)

i
i  0 N  1 x  10 y  a x  b  Err
i N i i i

R  line( xy) M  medfit( xy)

R 
 0.711   0.882 
 M  
 1.148   1.195 

f ( t)  a t  b r ( z)  R  z  R m( k)  M  k  M
1 0 1 0

Regresia liniara calculata prin diferite metode

y
f ( t)

r( z )

m( k)

xt z k

Calculul regresiei dependentei exponentiale cu ajutorul functiei regresiei liniare

1
a  1 k 
3
N  8
Err  rnorm( N 00.6)

i k  xi
i  0 N  1 x  10 y  a e  Err
i N i i

R  line( xln( y) )
R 
 0.151 

exp R 0  1.163
 0.146 
z  R1
f ( t)  a e
kt
 0
r ( z)  exp R  e

Regresie exponentiala, trasata cu ajutorul functiei line(x,y)

y
f ( t)

r( z )

xt z

Metoda abaterii medii patratice

N  150
Err  rnorm( N 01)
1
i  0 N  1 x  5  10 y  x  1  Err
i N i i i

k  1 b  1
Given

N 1 N 1
d y  k x  b 2 d y  k x  b 2
   i   0    i   0
dk i
db i
i 0 i 0

 0.819 
Find ( k b )   
 0 

line( xy)  
 1.683 

 0.478 
Regresia polinomiala
N  10

Err  rnorm( 1005)

i  0 N  1 x  i
i
y  x
i  i3  6xi2  9 xi  12  xiErr i
R  regress ( xy 3)

T
R  ( 3 3 3 20.904 32.993 11.625 0.739 )

N 3
 ti 3 R 
S( t)    i
sau S( t)  interp( R xy t)
i3

3 2
k( z)  z  6 z  9 z  12

Regresia polinomiala

3
110
y
S( t )
500
k ( z)

0 5 10

xt z

Regresie cu fragmente de polinoame


N  30

Err  rnorm( N 00.5)

 i
i
i  0 N  1 x  2  4  y  3 sin x  Err
i N 1 i i

R  loess ( xy 0.3) Rp  regress ( xy 5)

Reg( t)  interp( R xy t) Regp( t)  interp( Rp xy t)

Regresia polonomiala si regresie cu fragmente de polinoame


y
Reg( t )

3 sin( z )

xt z

y
Regp ( t )

3 sin( z )

xt z

Regresia polinomiala bidimensionala


N  6

i  0 N  1 j  0 N  1
10 i j
x  5 y  10 5
i j N 1 i j N 1

Err  rnorm N 00.3 2 


z
i j  ij2  yij2  xij  yijErr i j i
 x

Suprafata construita reiesind din prelevare neprelucrata


( xy z)
( xy z)

R  n 0 Z  n 0

for i  0  last x  
 0
for i  0  last z
 0
 
for j  0  last x 
 0
for j  0  last z
 0
 
R1  x Z z
n i j n i j
R2  y n n1
n i j
Z
n n1
R  augment ( R1 R2)
R

T
Z  0 1 2 3 4 5 6 7
0 51.317 35.054 26.79 26.527 34.263 50 35.631 ...

0 1 2 3 4 5 6 7 8 9
T
R  0 -5 -5 -5 -5 -5 -5 -3 -3 -3 -3
1 -5 -3 -1 1 3 5 -5 -3 -1 ...

S  regress ( R Z 2)


I( t k)  interp S R Z 
 t 

  k 
Rezultatul regresiei polinomiale bidimensionale
I I

Calculul regresiei pentru datele care se schimba conform legii periodicitatii

N  15

i  0 N  1 j  0 N  1
4  i 4  j
x   2 y   2
i j N 1 i j N 1

Err  rnorm N 00.2 2 


z
i j
 sin x  ij  cos yij  Err i j i
R  n 0 Z  n 0

for i  0  last x  
 0
for i  0  last z  
 0

for j  0  last x  
 0
for j  0  last z 
 0

R1  x Z z
n i j n i j
R2  y n n1
n i j
Z
n n1
R  augment ( R1 R2)
R

S  regress ( R Z 11) S1  loess ( R Z 0.15)


I( t k)  interp S R Z 
 t    t 
 I1( t k)  interpS1R Z  
  k    k 
Dupa date initiale
( xy z)
( xy z)

Rezultatul calculului regresiei polinomiale

I
I

Regresia exponentiala
a  3 b  2 c  6

N  10

Err  rnorm( N 00.5)

xi b
i  0 N  1 x  2 i y  a e
i
ce
xi b
 Err
i
i N 1

1 4  15 
g1   1  g2   1  g3   2 
     
1 3 6
R1  expfit( xy g1) R2  expfit( xy g2) R3  expfit( xy g3)

 2.732   2.732   2.732 


R1   2.191  R2   2.191  R3   2.191 
     
 6.048   6.048   6.048 

R11 t R21 t R31 t


f1( t)  R1  e  R1 f2( t)  R2  e  R2 f3( t)  R3  e  R3
0 2 0 2 0 2

b t
F( t)  a e c

N 1
N 1 N 1
 f1xk   Fxk   0.131
2
 f2xk   Fxk   f3xk   Fxk   0.131
2 2
 0.131
k 0
k 0 k 0

10

y
9
F( t )

f1( t )

f2( t )

f3( t ) 8

7
0 0.5 1
xt

y 7.5

F( t )

f1( t )
7
f2( t )

f3( t )

6.5

6
2 0 2 4
xt
Regresia generala

Determinarea regresiei pentru suma lineară a functiilor aleatoare


a  2 b  3 c  4
N  15

Err  rnorm( N 00.8)

i  0 N  1 x  2  4
i
y  x a 
1 xi 
 b  c e  Err e  x
xi 
N 1 i i
 i
i i i 2
1 x

 x 
 1 
F( x)   2  2.529 
1 x  R  linfit( xy F) R   5.477 
 ex   
 3.641 

R
b t 1 t
f ( t)  a t   c e r ( t)  R  t   R e
2 0 2 2
1 t 1 t

Regresia combinarii lineare de functii

20

y
f ( t) 10
r ( t)

2 1 0 1 2

xt
Regresia generala

N  10

Err  rnorm( N 00.3)

i  0 N  1 x  3  6
i xi
y  e  e
 xi 
 x  Err e  e
xi  xi
x

i N 1 i i i i

 eC0 x 
 
G( xC)   C1 x 
e 
 C x 
 0 

1 1 1


g2    g3    g1   
 3   1  7

R1  genfit( xy g1G) R2  genfit( xy g2G) R3  genfit( xy g3G)

1
R1     1.008 
7 R2    R3  
 1.149 
 2.517  
 0.978 

t t
f ( t)  e  e t

N 1 2
 f x  
  i

 i G x R1  1.739  1018

i0
N 1 2
 f x  
   i 
6
 i G x R2  3.677  10
i0

N 1 2
 f xi  GxiR3  166.42
i0

f1( t)  G(t R1) f2( t)  G(t R2) f3( t)  G(t R3)


Curbele regresiei generale, obtinute prin aproximari de exactitate diferita
30

y
f ( t) 20
f1( t )

f2( t )
10
f3( t )

2 0 2

xt

Potrebbero piacerti anche