Open Side Menu Go to the Top
Register
lottery probability lottery probability

12-29-2012 , 06:41 PM
If 5 numbers are drawn out of 90, a particular number should occur 1 time in 18 on average. The probability that a particular number doesn't come up in 70 is (85/90)^70 = 1.8%. The probability that SOME number doesn't come up in the next 70 is around 72%. That is approximately 1- (1-0.018)^70.
lottery probability Quote
12-29-2012 , 06:57 PM
Right. This is what shows us the math. But we can not overlook what shows us the observation of thousands statististica extractions past.
What I have written above is derived from a statistical method. Interested me to continue?
lottery probability Quote
12-29-2012 , 07:12 PM
What is the probability that their observation would occur by chance? I still don't understand the observation that was made.
lottery probability Quote
12-29-2012 , 07:38 PM
All right. The statistical observation refers to the method of forecasting. For each draw my software tells you to bring into play a few numbers. I applied this from 1950 to today
lottery probability Quote
12-29-2012 , 07:40 PM
I think you're saying that the wheel is unbalanced so some numbers occur more than others. That happens sometimes with roulette wheels. That's why you don't want to play certain consecutive numbers. I think you're saying that as soon as they suspect some number is being delayed, they look at the next 230 extractions, and they look at the maximum delay of any number. Are you saying that maximum is 70 on average? Or a particular number they suspect is delayed by 70? It should be easy to determine if the observation is statistically significant once I understand what the observation was.
lottery probability Quote
12-29-2012 , 08:05 PM
No Bruce. I was not clear.
example
In Cagliari extract from one container 5 numbers out of 90;
In Bari extract from one container 5 numbers out of 90;
In Florence extract from one container 5 numbers out of 90;
In Genoa extract from one container 5 numbers out of 90;
In Milan pull out of a container 5 numbers out of 90;
In Naples extract from one container 5 numbers out of 90;
In Rome extract from one container 5 numbers out of 90;
In Palermo extract from one container 5 numbers out of 90;
In Turin extract from one container 5 numbers out of 90;
In Venice extract from one container 5 numbers out of 90.
lottery probability Quote
12-29-2012 , 08:10 PM
Now, for each of the ten cities (wheels), there will be a number between 90 which will be later to leave. Statistically, in the past, the maximum delay was for a city of 230 extractions.
lottery probability Quote
12-29-2012 , 08:14 PM
The 70 delay refers to the competition among the ten cities. That is, when the delay of a city becomes the largest of the ten, begins a new count
lottery probability Quote
12-29-2012 , 08:18 PM
The consecutive filter is something else. Be applied to money management which is another software and can be effectively applied to roulette
lottery probability Quote
12-29-2012 , 08:23 PM
Something like this?

Code:
sims = 0
min_count = 0
while (1) {
  numbers = rep(0,90)
  extr = 0
  while(extr <= 230) {
    draw = sample(1:90,5,F)
    for (i in 1:5) {numbers[draw[i]] = numbers[draw[i]] + 1}
    extr = extr + 1
  }
  min_count = min_count + min(numbers)
  sims = sims + 1
}

m = min_count/sims
m
230/m
> m
[1] 5.127778
> 230/m
[1] 44.85374


For 230 extractions, the least frequent number occurs every 44.8 on average.
lottery probability Quote
12-29-2012 , 08:38 PM
Are you saying something is mechanically wrong with the wheels so they don't produce random numbers? Why do you think the numbers are not completely random? You can always find rare patterns in past data. It doesn't mean anything unless you know how many patterns were looked for during data mining to find the patterns, or unless you verified them on a separate set of data, not the ones used to find the patterns. Then you have to compute the probability of that occurring by chance.
lottery probability Quote
12-29-2012 , 08:41 PM
Ahahahaha, you're a big Bruce!!! Immediately translated into code
No it is not what I meant.
I have created thousands of archivies fictitious matched to the real
Can I ask how old you are?
lottery probability Quote
12-29-2012 , 09:01 PM
Bruce is really nice talking with you, but in Italy the time is 2.00 and I'm a bit tired. Thank you for all
lottery probability Quote
12-29-2012 , 09:16 PM
Quote:
Originally Posted by Mirapep
All right. The statistical observation refers to the method of forecasting. For each draw my software tells you to bring into play a few numbers. I applied this from 1950 to today
If the pattern was discovered from 1950 to today, you have to test it in the future. Or if the pattern was discovered from say 1950 to 2000, then you test it from 2000 to 2012. If someone just tells you about a pattern they discovered, it's no good to test it on the same years they discovered it. Anybody can find patterns in the past. You have to show that they are statistically significant by testing it on independent data. There are standard methods for doing this. Sometimes the patterns are significant, but I don't see any reason to think that lottery numbers should have any patterns over 60 years.


Quote:
I have created thousands of archivies fictitious matched to the real
You can always find things that occur in real data that occur very rarely in fictitious data if you are looking for them. You can also find things that appear in one set of fictitious data that occur very rarely in other fictitious data. Our brains are very good at finding patterns. So good, that it finds them even in data that is completely random. That's why people believe in superstitions.

Enter this command in R repeatedly:

plot(cumsum(runif(1000,-1,1)))

Each time it will generate a different random walk, like the stock market or poker results. You'll see lots of patterns and trends, but it's random.

Last edited by BruceZ; 12-29-2012 at 11:40 PM.
lottery probability Quote
12-30-2012 , 03:42 AM
Agree in everything that you highlighted. I know what has occurred in the past, I have verified that the method is good but, quite rightly, I do not know if it will be just as good in the future and the mathematics I recommend caution. So the method should be helped by a game plan. For example, I have observed to be winning an average of 8 times out of 20 trials. So prudence imposed on money management 5 of 20. But you get nil profit. However, I have observed that on average are winning more than two consecutive terms. So, as a precaution imposed consecutive filter with a maximum of 4 consecutive winners. In this way, I delete all the combinations of bets statistically unfit and get a positive profit
lottery probability Quote
12-30-2012 , 04:44 AM
I vectorized the R code, and it's faster than **** now. I can do (100,50,5) in under 2 seconds! That may be as fast as compiled speed. So we went from 69 years, to 40 seconds, to under 2 seconds. I got rid of for loops which are very slow in R. I moved beyond vectorizing, and I matricized. I replaced 2 nested for loops with 2 matrix indices. It took me a very long time to figure out how to do it. I learned a lot from this exercise. This is how R is really supposed to be programmed. See the last routine "recurse".

Code:
pconsec = function(n,k,r,...) {nconsec(n,k,r,...) / choose(n,k)}

nconsec = function(n,k,r,table) {
  if (n == k) {
    s = 1 } 
  else if (k < 2*r) {
    s = choose(n-r,k-r) + (n-r)*choose(n-r-1,k-r)} 
  else {
    ctable = make_ctable(n,k,r)
    if (missing(table)) {table = make_table(n,k,r,ctable)}
    s = recurse(n,k,r,ctable,table)
  }
  s
}
  

make_ctable = function(n,k,r) {
  ctable = matrix(rep(0,(n-r+1)*(k-r+1)),nrow=(n-r+1))
  ctable = choose(row(ctable)-1,col(ctable)-1)
  ctable
}


make_table = function(n,k,r,ctable) {
  table = matrix(rep(0,(n-r-1)*(k-r)),nrow=(n-r-1))
  for (x in r:(n-r-1)) {
    for (y in r:min(x,(k-r))) {table[x,y] = ifelse(x==y,1,recurse(x,y,r,ctable,table))} }
  table
}


make_tables = function(n,k,r) {
  ctable = make_ctable(n,k,r)
  make_table(n,k,r,ctable)
}


recurse = function(n,k,r,ctable,table) {
  s = ctable[n-r+1,k-r+1] + (n-r)*ctable[n-r,k-r+1]
  if (k >= 2*r) {
    i = rep(0:(k-2*r),each=(n-k))
    m1 = matrix(c(rep(r:(n-k+r-1),k-2*r+1)+i,r+i),ncol=2)
    m2 = matrix(c(rep((n-2*r):(k-2*r+1),k-2*r+1)-i,k-2*r+1-i),ncol=2)
    s = s - sum(table[m1]*ctable[m2])
  }
  s
}

Last edited by BruceZ; 12-30-2012 at 05:00 AM.
lottery probability Quote
12-30-2012 , 04:59 AM
Very, very fast!!!!!!!!
in vb6?
lottery probability Quote
12-30-2012 , 05:04 AM
Quote:
Originally Posted by Mirapep
Very, very fast!!!!!!!!
in vb6?
I haven't gotten the VB code to work yet. Maybe you know why. I don't think I'm passing the 2-d arrays to functions correctly. make_ctable isn't working. Even when I call it directly it doesn't work when I try to write to ctable array. I don't use VB much. I'll figure it out eventually. I'm going to try it in C++ to compare speed.
lottery probability Quote
12-30-2012 , 05:11 AM
I think I read somewhere that in the R matrix columns rows are reversed from vb6
lottery probability Quote
12-30-2012 , 11:51 AM
OK, VB code works. It is even faster than R. (100,50,5) in 1 second. Yours could easily be 10 times faster compiled.

I had to use variant types for the arrays, otherwise it wouldn't work with Excel. You may be able to make them Long types, and that may be faster, I don't know. Also, I included the 4th parameter so that you could optionally provide your own table and only make it 1 time for the same r and large n and k using make_table_once. I couldn't make it a default parameter in Excel, but you probably can in VB6. Right now you have to make it 0, like nconsec(100,50,5,0) and it will make the table for you. Later in your program, you could call make_table_once, and that will return a table that you can put in for the 4th parameter.

Code:
Function pconsec(n As Long, k As Long, r As Long, t As Variant)
    pconsec = nconsec(n, k, r, t) / Application.Combin(n, k)
End Function


Function nconsec(n As Long, k As Long, r As Long, t As Variant)

    Dim ctable() As Variant
    Dim table() As Variant
    
    With WorksheetFunction
    
    If (n = k) Then
        nconsec = 1
    ElseIf (k < 2 * r) Then
        nconsec = .Combin(n - r, k - r) + (n - r) * .Combin(n - r - 1, k - r)
    Else
        ctable = make_ctable(n, k, r)
        If (t = 0) Then table = make_table(n, k, r, ctable) Else table = t
        nconsec = recurse(n, k, r, ctable, table)
    End If
  
    End With

End Function

 
Function make_ctable(n As Long, k As Long, r As Long)
  
  ReDim ctable(0 To n - r, 0 To k - r)
  Dim i As Long
  Dim j As Long
  
  With WorksheetFunction
  
    For i = 0 To n - r
        For j = 0 To k - r
            ctable(i, j) = Application.Combin(i, j)
        Next j
    Next i
  
  make_ctable = ctable
  
  End With

End Function


Function make_table(n As Long, k As Long, r As Long, ctable() As Variant)

    ReDim table(1 To n - r - 1, 1 To k - r)
    Dim x As Long
    Dim y As Long
    
    With WorksheetFunction
    
    For x = r To n - r - 1
        For y = r To .Min(x, k - r)
            If x = y Then
                table(x, y) = 1
            Else
                table(x, y) = recurse(x, y, r, ctable, table)
            End If
        Next y
    Next x
    
    End With
    
    make_table = table

End Function


Function make_table_once(n As Long, k As Long, r As Long)
    Dim ctable()  As Variant
    Dim table()   As Variant
    
    ctable = make_ctable(n, k, r)
    make_table_once = make_table(n, k, r, ctable)
    
End Function


Function recurse(n As Long, k As Long, r As Long, ctable() As Variant, table() As Variant)

    Dim i   As Long
    Dim m   As Long

    recurse = ctable(n - r, k - r) + (n - r) * ctable(n - r - 1, k - r)
    For i = 0 To k - 2 * r
        For m = r + i To n - k + r + i - 1
            recurse = recurse - table(m, r + i) * ctable(n - r - m - 1, k - 2 * r - i)
        Next m
    Next i

End Function

Last edited by BruceZ; 12-30-2012 at 12:55 PM.
lottery probability Quote
12-30-2012 , 12:51 PM
I just updated make_table_once function since I changed its name, so I had to change the return variable name too.
lottery probability Quote
12-30-2012 , 12:57 PM
Which version of Excel do you have? I have 2007 and continues to give me # VALUE. To prove this in vb6 I must first understand how to do. Min (). I would not make a connection with the functions excel. If you are new to C + +, definitely a dll to call in vb6 would be even faster
lottery probability Quote
12-30-2012 , 01:01 PM
Quote:
Originally Posted by Mirapep
Which version of Excel do you have? I have 2007 and continues to give me # VALUE. To prove this in vb6 I must first understand how to do. Min (). I would not make a connection with the functions excel. If you are new to C + +, definitely a dll to call in vb6 would be even faster
2002. The min function just returns the smaller of the 2 values. I'm sure you have it in VB, but it is also easy to just code it with an IF-ELSE.
lottery probability Quote
12-30-2012 , 01:11 PM
If you still have trouble after you fix Min, you might try declaring the arrays Long instead of variant. Mine seemed to work differently from what is described here. It would also be faster because I think variants are not as efficient.
lottery probability Quote
12-30-2012 , 01:20 PM
True, long variables are more efficient variant.
What does the check rating in the thread?
lottery probability Quote

      
m