Está en la página 1de 2

Cuestionario

Determine los parmetros de la recta de regresin y= a+bx, as como r2

1. X=[8,2,0,4,6] ; Y=[6.8,5.0,2.2,0.5,1.3]. Si x=4.0,y=. Si y=3.0,x=
2. X=[6,2,0,2,6] ; Y=[5.3,3.5,1.7,0.2,4.0]. Si x=5.0,y=. Si y=2.0,x=

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
x = np.array( [-8,-2,0,4,6] )
y = np.array( [6.8,5.0,2.2,0.5,-1.3] )
print('Parametros de y = a + bx')
print('a = {0}'.format(R[0]))
print('b = {0}'.format(R[1]))
print('r = {0}'.format(R[2]))
xx = np.linspace(x[0],x[-1],100)
yy = R[0] + R[1]*xx
plt.plot (xx,yy,'r',x,y,'b*')
print('si x=-4 : y=',R[0] + R[1]*(-4.0) )
print('si y=3 : x=', (3.0-R[0])/R[1])
Parametros de y = a + bx
a = 2.6399999999999997
b = -0.585
r = -0.9753161259028391
si x=-4 : y= 4.98
si y=3 : x= -0.615384615385

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
x = np.array( [-6,-2,0,2,6] )
y = np.array( [-5.3,-3.5,-1.7,0.2,4.0] )
print('Parametros de y = a + bx')
print('a = {0}'.format(R[0]))
print('b = {0}'.format(R[1]))
print('r = {0}'.format(R[2]))
xx = np.linspace(x[0],x[-1],100)
yy = R[0] + R[1]*xx
plt.plot (xx,yy,'r',x,y,'b*')
print('si x=5 : y=',R[0] + R[1]*5.0 )
print('si y=2 : x=', (2.0-R[0])/R[1])

Parametros de y = a + bx
a = -1.2600000000000002
b = 0.79
r = 0.9862295068717125
si x=5 : y= 2.69
si y=2 : x= 4.12658227848