Error "5" en tiempo de ejecución
Publicado por JuanCa (4 intervenciones) el 15/08/2019 23:53:20
Buenas, el siguiente código (corto) en Visual Basic (Excel) es la implementación en doble ciclos para imprimir 1000 (experimentos) intervalos de confianza (con 22 observaciones cada experimento) Sin embargo, no logro compilar por un error '5' en el tiempo de ejecución. Agradezco, si logran hallar con el fallo en el código.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Sub IntervaloConfianza()
Dim i As Single
Dim m As Integer
Dim t As Integer
Dim theta As Double
Dim z As Double
Dim fila As Integer
t = 0
fila = 2
z = Application.WorksheetFunction.NormSInv(0.05)
Cells(1, 1) = "Int. Izquierdo"
Cells(1, 2) = "Int. Derecho"
Do While fila <= 1001
m = 1
Do While m <= 22
i = Rnd()
If i <= 0.7 Then
t = t + 1
End If
m = m + 1
Loop
theta = t / 2
Cells(fila, 1) = theta + z * Math.Sqr((theta * (1 - theta)) / 22)
Cells(fila, 2) = theta - z * Math.Sqr((theta * (1 - theta)) / 22)
fila = fila + 1
Loop
End Sub
Valora esta pregunta


0