Styling Science: Part Are you really still keeping count? Permutations via Sventon the Swedish Giant

Ikea_multistory_Leeds

God morgon … dis is Sventon the Swedish (not Russian!!!) giant and you may remember me from Irene’s sorry attempt at a fairy tale … bork, bork, bork!  Vell,l, I am back to talk to you about the (okay, it’s not dat) serious subject of vone type of  permutation vere ve can rearrange the a combination of outcomes many times and den determine the most frequent combination.  So, say, my kingdom’s sorceress/biostatistician/doctor/lawyer/EMT carriage driver, Irene, had no magic potion, and I had to determine my bride based on vone thousand simulations of pemutations in order to choose vone of the princesses, Aggie, Elaine (the E is silent), and Gina.  And say I vanted to have a fellow Swedish (not Russian!!!) giant as my best man at the vedding.  So I go to google (veally, Dictionary Lady, you may vant to try it some time) and type in ‘Swedish giant’ and come up with Alex Skarsgard, Dolph Lundgren,  and IKEA.  And lastly, I vant to get married in a magical and mystical place … like upstate New York.  So I include, the three magical and mystical upstate New York cities of Buffalo, Albany, and Rochestor.  And now ve can vun the simulation with the R code below that can be vun in R 2.9.2 or higher.  (Side note:  the kingdom’s sorceress/biostatistician/doctor/lawyer/EMT carriage driver, Irene’s dissertation advisor must be very proud that she has put her programming skills to such good use).

max.table=function(x){tx=table(x)
names(tx)[as.numeric(tx)==max(as.numeric(tx))]}

bride=c(‘Aggie’, ‘(E)laine’,’Gina’)

best.man=c(‘Alex Skarsgard’, ‘Dolph Lundgren’, ‘IKEA’)

place=c(‘Buffalo’, ‘Albany’, Rochester’)

permut.mat=matrix(c(sample(bride,1000,replace=T),sample(best.man,1000,replace=T), sample(place,1000,replace=T)),1000,3)

apply(permut.table,2,max.table)

Now, the first time, I ran dis algorith dere, I got Elaine (the E is silent), Dolph Lundgren, and Albany.  It was okay, I guess, but Elaine (the E is silent) still needs to vork on her esteem issues and Dolph’s vork in the Expendables vas not his best.  So I try another vun and got Aggie, Alex Skarsgard, and Rochester.  But I ain’t messin’ with no guld grävare and no offense to Alex but I just don’t see him as my best man.  Also, vhenever I am about to meet him, my kingdom’s sorceress/biostatistician/doctor/lawyer/EMT carriage driver, Irene slips me her number in hopes dat I slip him dat number in hopes dat he slips his True Blood costar dat number but I don’t vant to be in dat uncomfortable position again.  So I vun the algorithm a third time and got Gina, IKEA, and Buffalo.  Now, I am happy as the vun came out with my true love and I always vanted a major furniture store chain to stand beside me at my vedding!! And I hear dat Buffalo is de most magical and mystical place of all dere magical and mystical places in upstate New York!!!  And since ve used no potion dere, Gina vill be avake (I hope!) long enough to say “I do.”  Bork, bork, bork, ohoho, bork, bork, bork!!!

Now, my kingdom’s sorceress/biostatistician/doctor/lawyer/EMT carriage driver, Irene also vanted to modify the permutation algorithm and apply it to her fantasy cast selections for her book.  But I had to stop her and remind her dat dat was not such a good idea as she became too obsessed last time and landed in the kingdom’s psych vard as her friend Merika warned.  And dat was no good because the kingdom’s psychiatrist could not see her as the kingdom’s psychiatrist, who is also de kingdom’s sorceress/biostatistician/doctor/lawyer/EMT carriage driver, Irene, vas in the phych vard at the same time.  See vad I did dere?  Anywho, until next time, vhen ve shall cover another interesting and (not dat) serious magical and mystical area in science/statistics!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s