IPB

Welcome Guest ( Log In | Register )

3 Pages V   1 2 3 >  
Reply to this topicStart new topic
> Matrix math, Some help on stochatics needed
Sengir
post Dec 2 2012, 09:22 PM
Post #1


Great Dragon
*********

Group: Dumpshocked
Posts: 5,082
Joined: 3-October 09
From: Kohle, Stahl und Bier
Member No.: 17,709



I'm currently trying to calculate the probabilities of successfully hacking a node on the fly, in other words beating the Firewall threshold AND not raising an alarm.

But with the "I roll once, node rolls once" mechanic things get a little more complicated than a simple threshold roll (or maybe I'm too stupid to find an easy formula), so here's the best I came up with:

FW = Node's Firewall
ST = Hacker's Stealth


P(succeeding on the n-th roll) = P(hacker accumulated >=FW hits on the n-th roll) * P(node accumulated <ST hits on the n-th roll) * P(hacker accumulated <FW hits on the n-1-th roll)

P(having accumulated >=X hits on the n-th roll) is trivial, just sum up the dice rolled on tests 1 to n and look at the CDF. Total chance of the hacker succeeding is the sum for n=1 to n=(attacker's DP), assuming you use the "-1 dice on each successive test" rule.

------

Am I getting somewhere, or should I just go back to reading probability theory for dummies?
Go to the top of the page
 
+Quote Post
NiL_FisK_Urd
post Dec 3 2012, 08:52 AM
Post #2


Moving Target
**

Group: Members
Posts: 881
Joined: 13-November 11
From: Vienna, Austria
Member No.: 43,494



In excel you calculate it using the "BINOMDIST" function, eg. to get 5 or more Hits with 4 dice on turn #1 etc.

=1-BINOMDIST(4;TURN*4;1/3;1) [Calculate 100% minus the chance to get 0-4 hits]

BINOMDIST(X;Y;Z;M)
X = Number of Hits needed -1
Y = Dice rolled (TURN*DICEPOOL or if you use degrading dicepools the sum of all dice on turn #)
Z = Chance to get a hit with one die (1/3)
M = Not Cumulated/Cumulated (0/1) -> set to 1

How to calculate both things in one is not that easy ...
Go to the top of the page
 
+Quote Post
_Pax._
post Dec 3 2012, 01:37 PM
Post #3


Neophyte Runner
*****

Group: Validating
Posts: 2,492
Joined: 19-April 12
Member No.: 51,818



QUOTE (Sengir @ Dec 2 2012, 04:22 PM) *
FW = Node's Firewall
ST = Hacker's Stealth

Don't forget that the Node gets FW+Analyze for it's die pool to detect the hacker.
Go to the top of the page
 
+Quote Post
Iduno
post Dec 3 2012, 03:34 PM
Post #4


Moving Target
**

Group: Dumpshocked
Posts: 586
Joined: 27-January 07
From: United States
Member No.: 10,812



If you're using excel, couldn't you calculate the chances of the player getting in each round in one column, and the chances of getting caught in a second column?

I think the chance of getting in without getting caught would be something like (chance of getting in)*(1 - chance of getting caught), but I signed up for statistics on 2 hours of sleep and ended up in statics.
Go to the top of the page
 
+Quote Post
Sengir
post Dec 3 2012, 04:07 PM
Post #5


Great Dragon
*********

Group: Dumpshocked
Posts: 5,082
Joined: 3-October 09
From: Kohle, Stahl und Bier
Member No.: 17,709



QUOTE (Iduno @ Dec 3 2012, 04:34 PM) *
If you're using excel, couldn't you calculate the chances of the player getting in each round in one column, and the chances of getting caught in a second column?

I got access to a Matlab license, so stuff like "sum from 1 to n" is relatively easy. The question is just whether I'm conceptually on the right track...

QUOTE
I think the chance of getting in without getting caught would be something like (chance of getting in)*(1 - chance of getting caught), but I signed up for statistics on 2 hours of sleep and ended up in statics.

Problem is that the chance of getting caught depends on how many attempts you need to get in, hence the whole act of breaking it down into what happens on the n-th roll


For those interested, here is my ML code so far (nothing fancy, hence it should run on free alternatives like FreeMat or Octave)
CODE
function probability=matrix_stochastics(dicepool_att,firewall,dicepool_def,stealth)

    probability = 0;

    for i = 1:dicepool_att
        
        temp=extendedtest(dicepool_att, firewall, i)*(1-extendedtest(dicepool_def, stealth, i))...
            * (1-extendedtest(dicepool_att, firewall, i-1));
        %numbers go too small?
        if ~isnan(temp)
            probability = probability + temp;
        else
            break;
        end
            
    end

end


function probability=extendedtest(dicepool, threshold, max_attempts)

    if max_attempts > 0
        total_dice = sum(dicepool-max_attempts+1 : dicepool);

        probability = (1-binocdf(threshold-1,total_dice,1/3));
    else
        probability = 0;
    end
    
end
Go to the top of the page
 
+Quote Post
Iduno
post Dec 3 2012, 04:56 PM
Post #6


Moving Target
**

Group: Dumpshocked
Posts: 586
Joined: 27-January 07
From: United States
Member No.: 10,812



QUOTE (Sengir @ Dec 3 2012, 12:07 PM) *
I got access to a Matlab license, so stuff like "sum from 1 to n" is relatively easy. The question is just whether I'm conceptually on the right track...


Problem is that the chance of getting caught depends on how many attempts you need to get in, hence the whole act of breaking it down into what happens on the n-th roll


Ah Matlab, so using a separate row for each round won't work so well. I did have a math professor trying to teach us how to use it, but he was the only one with a copy. Are the free Matlab alternatives any good, or are they as hopelessly gimped as excel alternatives/excel home version (they took out the data analysis tools out of excel home - like taking punctuation out of word)?
Go to the top of the page
 
+Quote Post
Murray
post Dec 4 2012, 08:12 AM
Post #7


Target
*

Group: Members
Posts: 6
Joined: 29-November 12
Member No.: 64,892



QUOTE (Iduno @ Dec 3 2012, 05:56 PM) *
Ah Matlab, so using a separate row for each round won't work so well. I did have a math professor trying to teach us how to use it, but he was the only one with a copy. Are the free Matlab alternatives any good, or are they as hopelessly gimped as excel alternatives/excel home version (they took out the data analysis tools out of excel home - like taking punctuation out of word)?


You can use GNU Octave (Heres the sorceforge site: http://octave.sourceforge.net/ ). It's basically a Matlab clone.

And to the authors problem: Do you need just a result? Or do you need an analytical formula? If you only need a result just simulate it and use the "law of great numbers".
Go to the top of the page
 
+Quote Post
Sengir
post Dec 4 2012, 04:36 PM
Post #8


Great Dragon
*********

Group: Dumpshocked
Posts: 5,082
Joined: 3-October 09
From: Kohle, Stahl und Bier
Member No.: 17,709



QUOTE (Murray @ Dec 4 2012, 09:12 AM) *
You can use GNU Octave (Heres the sorceforge site: http://octave.sourceforge.net/ ). It's basically a Matlab clone.

I can only offer second-hand opinions, but those agree that Octave does a good job.

QUOTE
And to the authors problem: Do you need just a result? Or do you need an analytical formula? If you only need a result just simulate it and use the "law of great numbers".

I want to plot the chances of hacking something OTF depending on attacker's and defender's pool size, Firewall, and Stealth ratings (well, not all four in one plot (IMG:style_emoticons/default/wink.gif) ). So simulating a sufficient number of trials would probably not be very efficient, plus I know even less about Simulink than Matlab. That's also the reason why I don't simply test my formula in a simulation, the correctness of the simulation itself would be rather questionable...
Go to the top of the page
 
+Quote Post
Lionhearted
post Dec 4 2012, 04:46 PM
Post #9


Shooting Target
****

Group: Members
Posts: 1,930
Joined: 9-April 05
From: Scandinavian Union
Member No.: 7,310



Why are you doing this exactly? Seems like an awful lot of work to do just for the sake of it... Asking out of genuine curiosity.
Go to the top of the page
 
+Quote Post
_Pax._
post Dec 4 2012, 05:23 PM
Post #10


Neophyte Runner
*****

Group: Validating
Posts: 2,492
Joined: 19-April 12
Member No.: 51,818



Some people like math, for the sake of math itself. (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
 
+Quote Post
Sengir
post Dec 4 2012, 05:26 PM
Post #11


Great Dragon
*********

Group: Dumpshocked
Posts: 5,082
Joined: 3-October 09
From: Kohle, Stahl und Bier
Member No.: 17,709



QUOTE (Lionhearted @ Dec 4 2012, 05:46 PM) *
Why are you doing this exactly? Seems like an awful lot of work to do just for the sake of it... Asking out of genuine curiosity.

Originally just as an exercise to get started with Matlab, now mostly because
a) I simply want to figure it out
b) there's an idea in my head how R. 2 commlinks would no longer be open books without making that R. 4 camera impossible to hack, and I'm not making a gazillion dice rolls to see if it works (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
 
+Quote Post
Halinn
post Dec 4 2012, 05:30 PM
Post #12


Running Target
***

Group: Members
Posts: 1,018
Joined: 3-July 10
Member No.: 18,786



QUOTE (Lionhearted @ Dec 4 2012, 05:46 PM) *
Why are you doing this exactly? Seems like an awful lot of work to do just for the sake of it... Asking out of genuine curiosity.

Knowing the chances of your hacker getting caught is always nice to know.
Go to the top of the page
 
+Quote Post
Draco18s
post Dec 4 2012, 05:58 PM
Post #13


Immortal Elf
**********

Group: Members
Posts: 10,289
Joined: 2-October 08
Member No.: 16,392



QUOTE (_Pax._ @ Dec 4 2012, 01:23 PM) *
Some people like math, for the sake of math itself. (IMG:style_emoticons/default/smile.gif)


Have I mentioned on the forums that I calculated the odds that a character I have in this one game will end up screwing a direct decedent of his?
That is, if he were to have sex, the odds that it would be incest (although it would be very distance incest; equivalent to the fact that you and your significant other are ~200th cousins).

Turns out, it's pretty much guaranteed, due to the number of generations that separate him from his initial offspring point from his current position in the timestream.*
(The % of shared DNA is something like 1 part in 10,000 though).

I wasn't able to model population group separation (e.g. non-decedents isolating themselves), but it's largely irrelevant, as if there was even just one decedent in the original group they didn't know about, or anyone from another group migrating in, the pool would be permanently polluted.

Math is fun.

*55 generations, give or take. After 15, the entire world population would be related (based on a number 100 times bigger than the GM gave me for starting population size). GM's guess was "about two-thirds" which turned out to be low.
Go to the top of the page
 
+Quote Post
Lionhearted
post Dec 4 2012, 06:09 PM
Post #14


Shooting Target
****

Group: Members
Posts: 1,930
Joined: 9-April 05
From: Scandinavian Union
Member No.: 7,310



QUOTE (_Pax._ @ Dec 4 2012, 06:23 PM) *
Some people like math, for the sake of math itself. (IMG:style_emoticons/default/smile.gif)

Math is the reason I don't get a science degree, I struggled to get through math in school and I would need to read two more courses to qualify to the basic year of natural science education... I enjoy it when it clicks, but Im just not wired to deal well with numbers...
Go to the top of the page
 
+Quote Post
Tanegar
post Dec 4 2012, 06:17 PM
Post #15


Runner
******

Group: Members
Posts: 2,654
Joined: 29-October 06
Member No.: 9,731



QUOTE (Iduno @ Dec 3 2012, 10:34 AM) *
I signed up for statistics on 2 hours of sleep and ended up in statics.

What is a statics class?
Go to the top of the page
 
+Quote Post
NiL_FisK_Urd
post Dec 4 2012, 07:10 PM
Post #16


Moving Target
**

Group: Members
Posts: 881
Joined: 13-November 11
From: Vienna, Austria
Member No.: 43,494



QUOTE (Lionhearted @ Dec 4 2012, 07:09 PM) *
Math is the reason I don't get a science degree, I struggled to get through math in school and I would need to read two more courses to qualify to the basic year of natural science education... I enjoy it when it clicks, but Im just not wired to deal well with numbers...

When you deal with numbers, it is not called math - it is calculating.
Go to the top of the page
 
+Quote Post
Lionhearted
post Dec 4 2012, 07:29 PM
Post #17


Shooting Target
****

Group: Members
Posts: 1,930
Joined: 9-April 05
From: Scandinavian Union
Member No.: 7,310



QUOTE (NiL_FisK_Urd @ Dec 4 2012, 08:10 PM) *
When you deal with numbers, it is not called math - it is calculating.

You do calculating in math, same difference?
Go to the top of the page
 
+Quote Post
Halinn
post Dec 4 2012, 07:51 PM
Post #18


Running Target
***

Group: Members
Posts: 1,018
Joined: 3-July 10
Member No.: 18,786



QUOTE (Draco18s @ Dec 4 2012, 06:58 PM) *
Have I mentioned on the forums that I calculated the odds that a character I have in this one game will end up screwing a direct decedent of his?
That is, if he were to have sex, the odds that it would be incest (although it would be very distance incest; equivalent to the fact that you and your significant other are ~200th cousins).

Turns out, it's pretty much guaranteed, due to the number of generations that separate him from his initial offspring point from his current position in the timestream.*
(The % of shared DNA is something like 1 part in 10,000 though).

I wasn't able to model population group separation (e.g. non-decedents isolating themselves), but it's largely irrelevant, as if there was even just one decedent in the original group they didn't know about, or anyone from another group migrating in, the pool would be permanently polluted.

Math is fun.

*55 generations, give or take. After 15, the entire world population would be related (based on a number 100 times bigger than the GM gave me for starting population size). GM's guess was "about two-thirds" which turned out to be low.

For comparison, Genghis Khan is the predecessor of about 1 in 200 men, and he is from 30 generations ago. Unless the starting population for that was really low, no way are you related to everybody after 15.
Go to the top of the page
 
+Quote Post
Draco18s
post Dec 4 2012, 08:09 PM
Post #19


Immortal Elf
**********

Group: Members
Posts: 10,289
Joined: 2-October 08
Member No.: 16,392



QUOTE (Halinn @ Dec 4 2012, 03:51 PM) *
For comparison, Genghis Khan is the predecessor of about 1 in 200 men, and he is from 30 generations ago. Unless the starting population for that was really low, no way are you related to everybody after 15.


It was really low. (IMG:style_emoticons/default/wink.gif)

The GM stated the initial population size of 100, 3 of them mine. But I know that that is unsustainably low (for humans, 250 is the absolute minimum in terms of genetic diversity). I think my largest model peaked at 100,000 initial individuals (3 of them mine). Above that my computer ran out of memory before hitting the 100% saturation threshold.

The higher the initial population, the longer it takes, but even at 100,000, it was taking an average of 14 to 16 generations (at 100 it was fully saturated in something like 8 to 10). This is, of course, assuming completely random mate selection (ignoring direct siblings), which is not true in the real world.

Edit:
Located the simulator.
3 in 100 finishes at 15 generations.
3 in 10,000 finishes at 16 (these take too long to run multiple times, it was at 96% after 15 and a final population size of 880,000)
3 in 100,000 finishes.....this may take a while. (IMG:style_emoticons/default/nyahnyah.gif) Edit 2: Ah, 100k is the one that crashes.
Go to the top of the page
 
+Quote Post
Halinn
post Dec 4 2012, 08:52 PM
Post #20


Running Target
***

Group: Members
Posts: 1,018
Joined: 3-July 10
Member No.: 18,786



Also, now that I look at my source again, that "1 in 200" is only for direct male descendants, which obviously lowers the number by a lot.
Go to the top of the page
 
+Quote Post
Draco18s
post Dec 4 2012, 09:11 PM
Post #21


Immortal Elf
**********

Group: Members
Posts: 10,289
Joined: 2-October 08
Member No.: 16,392



QUOTE (Halinn @ Dec 4 2012, 04:52 PM) *
Also, now that I look at my source again, that "1 in 200" is only for direct male descendants, which obviously lowers the number by a lot.


That it does, heh. I could have modeled something like that, but I didn't. Mainly because my character is male, and he'd be knocking up the girls. (IMG:style_emoticons/default/nyahnyah.gif)
(And there's a reason why he's called "The Defiler." ;D )
Go to the top of the page
 
+Quote Post
Lionhearted
post Dec 4 2012, 09:17 PM
Post #22


Shooting Target
****

Group: Members
Posts: 1,930
Joined: 9-April 05
From: Scandinavian Union
Member No.: 7,310



QUOTE (Halinn @ Dec 4 2012, 09:52 PM) *
Also, now that I look at my source again, that "1 in 200" is only for direct male descendants, which obviously lowers the number by a lot.

Believe that has something to do with genetic markers that are only passed down from male to male, similarly you can do the same for women to find the last common ancestor.
Go to the top of the page
 
+Quote Post
Halinn
post Dec 4 2012, 09:31 PM
Post #23


Running Target
***

Group: Members
Posts: 1,018
Joined: 3-July 10
Member No.: 18,786



QUOTE (Draco18s @ Dec 4 2012, 10:11 PM) *
That it does, heh. I could have modeled something like that, but I didn't. Mainly because my character is male, and he'd be knocking up the girls. (IMG:style_emoticons/default/nyahnyah.gif)
(And there's a reason why he's called "The Defiler." ;D )

That'd actually be a reason for modeling it. Check how many of your offspring were male, then how many of those males were male and so on.
Go to the top of the page
 
+Quote Post
Draco18s
post Dec 4 2012, 09:35 PM
Post #24


Immortal Elf
**********

Group: Members
Posts: 10,289
Joined: 2-October 08
Member No.: 16,392



QUOTE (Halinn @ Dec 4 2012, 05:31 PM) *
That'd actually be a reason for modeling it. Check how many of your offspring were male, then how many of those males were male and so on.


Oh, I modeled gender I just didn't model direct dependency (male -> male separately from female -> male).
Go to the top of the page
 
+Quote Post
Ryu
post Dec 4 2012, 11:00 PM
Post #25


Awakened Asset
********

Group: Members
Posts: 4,464
Joined: 9-April 05
From: AGS, North German League
Member No.: 7,309



QUOTE (Sengir @ Dec 3 2012, 05:07 PM) *
I got access to a Matlab license, so stuff like "sum from 1 to n" is relatively easy. The question is just whether I'm conceptually on the right track...

Canīt help you with Mathlab (dabbled for a while, but a decade ago).

P(succeeding on the n-th roll) = P(hacker accumulated >=FW hits on the n-th roll) * P(node accumulated <ST hits on the n-th roll) * P(hacker accumulated <FW hits on the n-1-th roll)

Hacking on the Fly is an extended opposed test. Under your conditions:

1st turn
P(attacker win (1 turn)*(1- P(defender win (1 turn))

2nd turn
[1-P(attacker win (1 turn)*(1- P(defender win (1 turn))] * P(attacker win (2 turns)*(1- P(defender win (2 turns))

And so on. Should be over after 4 turns in most situations, but your math will likely not care for total turns (IMG:style_emoticons/default/wink.gif)

For a given players stats, a matrix of odds (stealth vs target dp) could be VERY cool: Firewall 3-8, target dp 6-16. Please? *ducks*

Go to the top of the page
 
+Quote Post

3 Pages V   1 2 3 >
Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 27th April 2024 - 06:44 AM

Topps, Inc has sole ownership of the names, logo, artwork, marks, photographs, sounds, audio, video and/or any proprietary material used in connection with the game Shadowrun. Topps, Inc has granted permission to the Dumpshock Forums to use such names, logos, artwork, marks and/or any proprietary materials for promotional and informational purposes on its website but does not endorse, and is not affiliated with the Dumpshock Forums in any official capacity whatsoever.