Canguro

Varianza

Pulsa F9 para tomar nuevas muestras y calcular 
su recta de regresión. Si repites la operación 
muchas veces, verás apareces unas bandas.

s = 0.2 (slider from -5 to 5, step 0.05)
n = 28 (slider from 2 to 50, step 1)
auxnorm4 = Sequence(RandomNormal[0, s], i, 1, n)
valX_1 = Sequence(RandomUniform[2, 20], i, 1, n)
auxnorm1 = Sequence(RandomNormal[0, s], i, 1, n)
auxnorm2 = Sequence(RandomNormal[0, s], i, 1, n)
b1 = -0.15 (slider from -5 to 5, step 0.05)
b0 = 3.2 (slider from -5 to 5, step 0.05)
f(x) = (b1 * x) + b0
valY_4: f(valX_1) + auxnorm4
Puntos_4 = Sequence((Element[valX_1, i], Element[valY_4, i]), i, 1, n)
valY_2: f(valX_1) + auxnorm2
Puntos_2 = Sequence((Element[valX_1, i], Element[valY_2, i]), i, 1, n)
valY_1: f(valX_1) + auxnorm1
Puntos_1 = Sequence((Element[valX_1, i], Element[valY_1, i]), i, 1, n)
MiLista = Union(Union[Puntos_1, Puntos_2], Union[Puntos_2, Puntos_4])
l = FitLineY(MiLista)
valX_2 = Sequence(RandomUniform[2, 20], i, 1, n)
Ybar = Mean(valY_1)
MediaY: (0, Ybar)
valXejeX = Sequence((Element[valX_1, i], 0), i, 1, n)
valYejeY = Sequence((0, Element[valY_1, i]), i, 1, n)
vect1 = Sequence(Vector[Element[valXejeX, i], Element[Puntos_1, i]], i, 1, n)
vect2 = Sequence(Vector[Element[Puntos_1, i], Element[valYejeY, i]], i, 1, n)
VarianzaY = Variance(valY_1)
VarianzaX = Variance(valX_1)
texto1: "Varianza Y = " + VarianzaY + ""
texto2: "Varianza X = " + VarianzaX + ""
texto3: "Media Y= " + Ybar + ""
VarianzaX_1 = Variance(valX_2)
valX_3 = Sequence(RandomUniform[2, 20], i, 1, n)
VarianzaX_2 = Variance(valX_3)
valX_4 = Sequence(RandomUniform[2, 20], i, 1, n)
VarianzaX_3 = Variance(valX_4)
auxnorm3 = Sequence(RandomNormal[0, s], i, 1, n)
valY_3: f(valX_1) + auxnorm3
Puntos_3 = Sequence((Element[valX_1, i], Element[valY_3, i]), i, 1, n)
a = Variance(valY_1)
b: valY_1(1)
A2 = 1
B2 = 0.0112866811017184
B3 = 0.0154639649891991
B4 = 0.0178373848120811
B5 = 8.56793087089304E-4
B6 = 0.0184799867792727
B7 = 0.0801644010172123
B8 = 9.84244773114541E-4
B9 = 0.0431701869082071
A3: A2 + 1
A4: A3 + 1
A5: A4 + 1
A6: A5 + 1
A7: A6 + 1
A8: A7 + 1
fX_1: l(valX_1)
A9: A8 + 1
PuntosRecta = Sequence((Element[valX_1, i], Element[fX_1, i]), i, 1, n)