161:卵の名無しさん
18/11/12 19:51:10.36 UwZfq4Lo.net
"マラソン大会の選手に1から順番に番号の書かれたゼッケンをつける。
用意されたゼッケンN枚以下の参加であった。
無作為に抽出したM人のゼッケン番号の最大値はMmaxであった。
参加人数推定値の期待値とその95%信頼区間を求めよ"
解析解は簡単。
decken <- function(M, Mmax, N,conf.level=0.95){
if(Mmax < M) return(0)
n=Mmax:N
pmf=choose(Mmax-1,M-1)/choose(n,M)
pdf=pmf/sum (pmf)
mean=sum(n*pdf)
upr=n[which(cumsum(pdf)>conf.level)[1]]
lwr=Mmax
c(lower=lwr,mean=mean,upper=upr)
}
decken(M=5,Mmax=60,N=100)
これを検証するシミュレーションプログラムを作れ、というのが課題。
162:卵の名無しさん
18/11/12 20:57:04.94 UwZfq4Lo.net
>>146
処理速度は考えないでとりあえず、シミュレーションを作ってみた。
# simulation
M=5 ; Mmax=60 ; N=100
sub <- function(M,Mmax,N){
n=sample(Mmax:N,1) # n : 参加人数n
m.max=max(sample(n,M)) # m.max : n人からM人選んだ最大番号
if(m.max==Mmax) return(n)
}
sim <- function(){
n=sub(M,Mmax,N)
while(is.null(n)){
n=sub(M,Mmax,N) # 最大番号が一致するまで繰り返す
}
return(n)
}
runner=replicate(1e4,sim())
> runner=replicate(1e4,sim())
> summary(runner) ; hist(runner,freq=F,col="lightblue")
Min. 1st Qu. Median Mean 3rd Qu. Max.
60.00 63.00 68.00 71.43 77.00 100.00
> quantile(runner,prob=c(0,0.95))
0% 95%
60 93
> cat(names(table(runner)[which.max(table(runner))]))
60
> decken(M,Mmax,N)
lower mean upper
60.0000 71.4885 93.0000
ほぼ、近似しているのでどちらも正しいか、どちらも同じ原因で間違っているかだなwww
163:卵の名無しさん
18/11/12 21:48:58.46 UwZfq4Lo.net
最大値でなく平均値が与えられたときの参加人数の推定、
"マラソン大会の選手に1から順番に番号の書かれたゼッケンをつける。
用意されたゼッケンN枚以下の参加であった。
無作為に抽出したM人のゼッケン番号の平均値はMmeanであった。
参加人数推定値の期待値とその95%信頼区間を求めよ"
とすると解析解は俺の頭では無理だな。シミュレーションの方は少し修正するだけですむ。
# simulation by round(mean)
M=5 ; Mmean=60 ; N=100
sub <- function(M,Mmean,N){
n=sample(Mmean:N,1) # n : 参加人数n
m.mean=round(mean(sample(n,M))) # m.mean : n人からM人選んだ平均値を
if(m.mean==Mmean) return(n) # roundで整数化
}
sim <- function(){
n=sub(M,Mmean,N)
while(is.null(n)){
n=sub(M,Mmean,N) # 平均値が一致するまで繰り返す
}
return(n) # 一致時の参加人数を返す
}
runner=replicate(1e4,sim())
summary(runner) ; hist(runner,freq=F,col="lightblue")
quantile(runner,prob=c(0,0.95))
cat(names(table(runner)[which.max(table(runner))])) # 最頻値
164:卵の名無しさん
18/11/12 21:53:15.51 UwZfq4Lo.net
5人の平均が60なので推定参加人数は当然、増えた。
正しいかどうかよくわからんなぁ。
meanをmedianにすれば中央値での推定ができる。
> runner=replicate(1e4,sim())
> summary(runner) ; hist(runner,freq=F,col="lightblue")
Min. 1st Qu. Median Mean 3rd Qu. Max.
64.00 86.00 92.00 90.72 96.00 100.00
> quantile(runner,prob=c(0,0.95))
0% 95%
64 100
> cat(names(table(runner)[which.max(table(runner))])) # 最頻値
100
165:卵の名無しさん
18/11/12 22:54:15.54 3/93pSbh.net
Last but not least, three laws of Do-Teihen(lowest-tier) Medical School, currently called Gachi'Ura by its graduates.
It is not the bottom medical school but its enrollee that is despicable, which deserves to be called a bona fide moron beyond redemption.
The graduates of Do-Teihen are so ashamed that none of them dare to mention their own alma mater they had gone through.
The Do-Teihen graduates are so ashamed of having bought their way into the exclusively lowest-tier medical school
that they tend to call a genuine doctor a charlatan who elucidates their imbecility.
166:卵の名無しさん
18/11/13 08:24:34.99 kjupm458.net
このスレは事務員が日がな一日妄想を垂れ流し
見物人たちがそれを見てフルボッコにするスレである
事務員 とは?
同一者の別名として、薄汚いジジイ、国試浪人、統計野郎、自称医科歯科、がある
自称医科歯科卒、実際は九州の駅弁国立出身で、卒業後は実家の東京に帰り国試浪人となり23年間経過、家庭教師バイトなどを経て現在は事務員、とされている
本人は、勤務医でたまに開業医の手伝いと内視鏡バイト、専門医なし、と主張しているが、連日連夜の異常な書き込み数の多さからは、勤務医とは考え難く、彼の職業がたとえ何であったとしても、人としてド底辺なことは間違いがない
自ら事務員であると告白したこともある
スレリンク(hosp板:108番)-109
が、事務員であることも疑わしい
実際はナマポかニートの可能性が高い
自分の主張に対して都合の悪い突込みが入ると、相手を私立医と決めつけて、さてはシリツだな、裏口バカ、というセリフでワンパターンに返すことが多い
国試問題を挙げて簡単だとほざいてますが、本番で通らなければお話になりません
いくらネットでわめいていても、医師国試の本番で通らなければお話になりません
大事なことなので2回言いました
167:卵の名無しさん
18/11/13 09:07:06.76 UTrDDuDZ.net
>>150
ちゃんと原文の日本語もつけろよ、ド底辺医大卒にもわかるように。
Last but not least, three laws of Do-Teihen(lowest-tier) Medical School, currently called Gachi'Ura by its graduates.
最後にド底辺医大の三法則を掲げましょう。
1: It is not the bottom medical school but its enrollee that is despicable, which deserves to be called a bona fide moron beyond redemption.
ド底辺シリツ医大が悪いのではない、本人の頭が悪いんだ。
2: The graduates of Do-Teihen are so ashamed that none of them dare to mention their own alma mater they had gone through.
ド底辺シリツ医大卒は恥ずかしくて、学校名を皆さま言いません。
3: The Do-Teihen graduates are so ashamed of having bought their way into the exclusively lowest-tier medical school
that they tend to call a genuine doctor a charlatan who elucidates their imbecility.
ド底辺特殊シリツ医大卒は裏口入学の負い目から裏口馬鹿を暴く人間を偽医者扱いしたがる。
168:卵の名無しさん
18/11/13 09:19:46.34 UTrDDuDZ.net
平均値を「四捨五入」するか、しないかを指定できるようにして
平均値が60であったときのサンプルの最大値の分布を示すシミュレーション
rm(list=ls())
M=5 ; m=60 ; n=100 ; round=TRUE
sub <- function(M,m,n){
s=sample(n,M)
rm=ifelse(round,round(mean(s)),mean(s))
if(rm==m) return(max(s))
}
sim= function(){
r=sub(M,m,n)
while(is.null(r)){
r=sub(M,m,n)
}
return(r)
}
round=F
re=replicate(1e3,sim())
summary(re) ; hist(re,freq=F,col="lightblue")
quantile(re,prob=c(0,0.95))
cat(names(table(re)[which.max(table(re))]),'\n')
169:卵の名無しさん
18/11/13 11:31:17.33 UTrDDuDZ.net
ド底辺シリツ医大のある学年にひとりずつ裏口入学登録証があることが判明したがその数は公表されていないとする。
ある裏口入学調査員が無作為に10枚選んで番号を記録して元に戻した。
別の裏口入学調査員が無作為に20枚選んで番号を記録してして元に戻した。
二人の調査官の記録した番号を照合すると3人分の番号が一致していた。
この情報からこの学年の裏口入学者数の95%信頼区間を求めよ。
170:卵の名無しさん
18/11/13 14:13:47.83 UTrDDuDZ.net
固有の番号の書かれたカードが何枚あり、
その枚数は1000枚以下であることはわかっているが、その数を推定したい。
調査員が無作為に10枚選んで番号を記録して元に戻した。
別の調査員が無作為に20枚選んで番号を記録した。
二人の調査員の記録した番号を照合すると3人分の番号が一致していた。
この情報からカード枚数の期待値と95%信頼区間を求めよ。
171:卵の名無しさん
18/11/13 14:58:33.48 EZEaUTrv.net
Last but not least, three laws of Do-Teihen(lowest-tier) Medical School, currently called Gachi'Ura by its graduates.
It is not the bottom medical school but its enrollee that is despicable, which deserves to be called a bona fide moron beyond redemption.
The graduates of Do-Teihen are so ashamed that none of them dare to mention their own alma mater they had gone through.
The Do-Teihen graduates are so ashamed of having bought their way into the exclusively lowest-tier medical school
that they tend to call a genuine doctor a charlatan who elucidates their imbecility.
172:卵の名無しさん
18/11/13 19:31:39.92 DHMhO4WL.net
二郎をすすりつつ裏口事務員をさわさわと触る
「お、おにいちゃん、大漁だった?」
「ああ、大漁だったよ」
「あぁぁぁあぁすごいいいぃいぃ!、、な、なにが、、ハァハァなにが捕れたの?」
焼豚を舌でやさしく舐めながら国試浪人は答えた
「…鯛とか、、、ヒラメがいっぱい捕れたよ」
セリフを聞き、オジサンはびくんびくんと身体をひきつらせた
「はっ!はぁぁぁあんっ!イ、イサキは?イサキは、と、取れたの??」
ド底辺事務員をしごく
「ああ。でかいイサキが取れたよ。今年一番の大漁だ。」
「大漁っ!!イサキぃぃ!!おにいちゃんかっこいいいいぃぃぃい ぃくううううう!」
173:卵の名無しさん
18/11/13 19:46:29.89 WZBh4CIg.net
It is common knowledge among doctors and patients that Do-Teihen(exclusively bottom-leveled medical school) graduates mean morons who bought their way to Gachi'Ura(currently called by themselves)
According to the experience of entrance exam to medical school in the era of Showa, when the sense of discrimination against
privately-founded medical schools were more intense than it is now,
all such schools but for Keio had been so compared to some specialized institution for educable mentally retarded kids that nobody but imbecile successors of physicians in private practice had applied for admission.
There had been NOT a single classmate who chose willingly against his/her common sense to go to the Do-Teihen(exclusively bottom-leveled medical school, currently also known as Gachi'Ura),
which would have cost outrageous money and its graduates are destined to be called Uraguchi morons who bought thier way into the Do-Teihen, by thier colleagues and even by thier own clients.
Although people won't call them names to their face,
certain 80-90% people of about my age have been yet scorning and sneering at Uraguchi graduates, speaking in the back of our mind,
" Uraguchi morons shall not behave like somebody."
We never speak out face to face in real life.
174:卵の名無しさん
18/11/13 20:23:20.79 DHMhO4WL.net
While touching Uryuu, touch the Uraguchi Jimuin with Sawasawa
"O, Oh, were you a big catch?"
"Oh, it was a big catch."
"Ayaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
While tender
175:ly licking the baked pig with a tongue, the country trier replied "... Sea breams, ..., a lot of flounder was caught" Listening to the dialogue, Ojisan hit the body with him busts "Ha ha ha ha! Ah, Isaki? Isaki, could you take it?" Draw base clerk "Oh, I got a big isaki, it is the biggest fishery of the year." "Big fishing !! Isaki !! Great buddies are okay!"
176:卵の名無しさん
18/11/13 22:51:51.61 UlWlhoup.net
ここは くるくるぱー アスペ 事務員が
ナゾナゾを出したり アプリ翻訳したインチキ英語で
自作自演したりするスレです
177:卵の名無しさん
18/11/13 23:30:56.92 fLfkvliu.net
>155の計算結果は最頻値と期待値が大幅に乖離するので
計算に自信が持てずシミュレーションとの合致でようやく納得。
数学板に貼ったら2時間で期待値のHaskellでの算出値のレスが来た。それで信頼区間も確信を持って計算できた。
確率密度はこんな感じなので期待値と最頻値がずれるわけだな。
URLリンク(i.imgur.com)
178:卵の名無しさん
18/11/13 23:40:50.36 fLfkvliu.net
>>160
>155の算出式書けばド底辺シリツ医大卒でも基礎学力があると示せるのに裏口馬鹿を実証してどうすんの?
Rのスクリプトすら読めない裏口バカなんだろ?
179:卵の名無しさん
18/11/14 00:11:47.97 kAqwthFw.net
Uryuu fell 23 times in the national exam
It is an amateur virgin who is also failing in marriage
To the Uraguchi of the spinning parpurin
He is getting turned on
F class clerks condenced raw kid juice
The smell of the Doteihen does not decrease
NnnnnHooOoooOoooooooo
180:卵の名無しさん
18/11/14 00:35:23.31 lTkyjX2F.net
>>161
各枚数の確率を一様分布に設定してのシミュレーション。
プログラミングより結果が出るのを待つ時間の方が長いし
PCのリソースが奪われる。
泥タブで5ch閲覧や投稿で時間潰し。
Nmin=g+s-x
sub <- function(){
n=sample(Nmin:Nmax,1)
a=sample(n,g)
b=sample(n,s)
if(sum(a %in% b)==x) return(n)
}
sim <- function(){
r=sub()
while(is.null(r)) r=sub()
return(r)
}
re=replicate(1e5,sim())
summary(re) ; hist(re,freq=F,col="lightblue",main='',xlab='N')
quantile(re,prob=c(0.025,0.95,0.975))
cat(names(table(re)[which.max(table(re))]))
HDInterval::hdi(re)
181:卵の名無しさん
18/11/14 02:35:34.04 n/IxbzB4.net
It is common knowledge among doctors and patients that Do-Teihen(exclusively bottom-leveled medical school) graduates mean morons who bought their way to Gachi'Ura(currently called by themselves)
According to the experience of entrance exam to medical school in the era of Showa, when the sense of discrimination against
privately-founded medical schools were more intense than it is now,
all such schools but for Keio had been so compared to some specialized institution for educable mentally retarded kids that nobody but imbecile successors of physicians in private practice had applied for admission.
There had been NOT a single classmate who chose willingly against his/her common sense to go to the Do-Teihen(exclusively bottom-leveled medical school, currently also known as Gachi'Ura),
which would have cost outrageous money and its graduates are destined to be called Uraguchi morons who bought thier way into the Do-Teihen, by thier colleagues and even by thier own clients.
Although people won't call them names to their face,
certain 80-90% people of about my age have been yet scorning and sneering at Uraguchi graduates, speaking in the back of our mind,
" Uraguchi morons shall not behave like somebody."
We never speak out face to face in real life.
182:卵の名無しさん
18/11/14 08:49:20.67 PJxL6X2W.net
Last but not least, three laws of Do-Teihen(lowest-tier) Medical School, currently called Gachi'Ura by its graduates.
It is not the bottom medical school but its enrollee that is despicable, which deserves to be called a bona fide moron beyond redemption.
The graduates of Do-Teihen are so ashamed that none of them dare to mention their own alma mater they had gone through.
The Do-Teihen graduates are so ashamed of having bought their way into the exclusively lowest-tier medical school
that they tend to call a genuine doctor a charlatan who elucidates their imbecility.
183:卵の名無しさん
18/11/14 20:59:26.07 lTkyjX2F.net
医師国家試験にこういうの問題を出してシリツ医大の裏口馬鹿を排除すればいいのにね。
2人が自転車に乗って走っている。その速さの比は11:8である。この2人が周囲480mの円形の池の同じ地点から同時に同方向にスタートしてまわるとき、速い人は遅い人を4分ごとに追い越す。2人の毎分の速さを求めよ
184:卵の名無しさん
18/11/14 21:03:30.39 Q+EwHwPp.net
It is common knowledge among doctors and patients that Do-Teihen(exclusively bottom-leveled medical school) graduates mean morons who bought their way to Gachi'Ura(currently called by themselves)
According to the experience of entrance exam to medical school in the era of Showa, when the sense of discrimination against
privately-founded medical schools were more intense than it is now,
all such schools but for Keio had been so compared to some specialized institution for educable mentally retarded kids that nobody but imbecile successors of physicians in private practice had applied for admission.
There had been NOT a single classmate who chose willingly against his/her common sense to go to the Do-Teihen(exclusively bottom-leveled medical school, currently also known as Gachi'Ura),
which would have cost outrageous money and its graduates are destined to be called Uraguchi morons who bought thier way into the Do-Teihen, by thier colleagues and even by thier own clients.
Although people won't call them names to their face,
certain 80-90% people of about my age have been yet scorning and sneering at Uraguchi graduates, speaking in the back of our mind,
" Uraguchi morons shall not behave like somebody."
We never speak out face to face in real life.
185:卵の名無しさん
18/11/14 21:26:14.73 zDUHf0ws.net
ド底辺事務員の今日のおかず
くいこみ戦隊ブルマちゃん
186:卵の名無しさん
18/11/15 08:47:29.19 MoyC03l0.net
Uryuu fell 23 times in the national exam
It is an amateur virgin who is also failing in marriage
To the Uraguchi of the spinning parpurin
He is getting turned on
F class clerks condenced raw kid juice
The smell of the Doteihen does not decrease
NnnnnHooOoooOoooooooo
187:卵の名無しさん
18/11/15 12:20:42.85 d0+yWFff.net
draft
188: pmf2hdi <- function(pmf,conf.level=0.95){ # unimodal pdf=pmf/sum(pdf) spdf=sort(pdf,decreasing=TRUE) cdf=cumsum(spdf) threshold=spdf[which(cdf>=conf.level)[1]] idx=which(pdf>=threshold) list(hdi=range(idx),confidence_level=sum(pdf[idx])) }
189:卵の名無しさん
18/11/15 14:10:09.98 0BjfilY2.net
実際こんな職員が病院にいたら大変だね
以前に病院のパソコンにスマホつないで充電したり動画を見たりしている職員がいたが
この事務員も同レベルのカスなんだろうな
190:卵の名無しさん
18/11/15 18:50:09.51 u639IIxL.net
ABC
ACB
BAC
BCA
+CAB
--------
3123
A,B,Cは?
Haskell
[(a,b,c)|a<-[1..9],b<-[1..9],c<-[1..9], (a+a+b+b+c)*100+(b+c+a+c+a)*10+(c+b+c+a+b)==3123]
C
#include <stdio.h>
int a,b,c;
int main() {
for(a=1;a<10;a++){
for(b=1;b<10;b++){
for(c=1;c<10;c++){
if((A+A+B+B+C)*100+(B+C+A+C+A)*10+(C+B+C+A+B)==3123){
printf("%d %d %d\n",a,b,c);
}
}
}
}
return 0;
}
191:卵の名無しさん
18/11/15 18:50:25.10 u639IIxL.net
Python
n = range(1,10)
for A in n:
for B in n:
for C in n:
if (A+A+B+B+C)*100+(B+C+A+C+A)*10+(C+B+C+A+B)==3123:
print( [A,B,C] )
R
n=1:9
N=c(100,10,1)
for(A in n){
for(B in n){
for(C in n){
if (sum((c(A,B,C)+c(A,C,B)+c(B,A,C)+c(B,C,A)+c(C,A,B))*N) == 3123)
print(c(A,B,C))
}
}
}
192:卵の名無しさん
18/11/15 18:52:29.96 u639IIxL.net
>>172
残念ながら、事務員じゃないのね。
こういうの書いているの俺な。
内視鏡検査について Part.2 [無断転載禁止](c)2ch.net
スレリンク(hosp板:875番)
875 名前:卵の名無しさん[sage] 投稿日:2018/11/14(水) 20:29:50.55 ID:lTkyjX2F
>>874
俺は肝弯より脾損傷の方がやだね。
開腹手術での受動時の経験と透視でのファイバーの動きを見る機会があるとこんなに可動性あったっけとか思う。
幸い脾損傷の経験はないけど、検査後に左肩への放散痛があったら疑わなくてはと思っている。
193:卵の名無しさん
18/11/15 18:56:08.04 u639IIxL.net
手技の議論だけじゃなくて、こういう計算もできる。
せっかく、一般解がだせるようにプログラムまで組んだやったんだがなぁ。
【現役医師】専門医資格取得について、どうお考えですか? 第2章
スレリンク(hosp板:69番)
69 名前:卵の名無しさん[sage] 投稿日:2018/10/23(火) 07:30:15.27 ID:RnIgsz+6
前スレで誰も正解出せなかった、
door to balloon timeが短縮するのに必要な計算問題を
解ける専門医いる?
(数値を変えても計算できるプログラムは前スレ参照、
プログラムを読めた専門医はいなかったらしくそれへのレスなし)
診療所から病院に患者を救急搬送する。
病院から医師搭乗の救急車が診療所に向かっており10時到着予定と連絡が入った。
患者の病態が悪化したら、診療所の普通車で病院に向かい救急車と出会ったら
救急車に患者を移して搬送し病院到着を急ぐという計画を立てた。
普通車から救急車への患者の乗り換えで10分余分に時間がかかる。
道路事情から救急車は病院から診療所への道は
平均時速60kmで、逆方向は
194:平均時速45kmで定速走行する。診療所の普通車は信号待ちもあり平均時速30kmで定速走行する。 何時以降の病態悪化は診療所の車を使わずに救急車の到着を待つ方が病院に早く着くか?
195:卵の名無しさん
18/11/15 19:08:50.01 u639IIxL.net
>>174
配列の要素ごとの演算をしてくれるRが使い勝手がいいなぁ。
シミュレーターとして使うのは遅いけど。
196:卵の名無しさん
18/11/15 19:10:14.30 u639IIxL.net
>>172
カスとは
>167の答も出せない
おまえのことだよ。
197:卵の名無しさん
18/11/15 19:26:12.08 0BjfilY2.net
医師なら事務員というワードには反応しないよねW
198:卵の名無しさん
18/11/15 19:33:47.58 LT687Ilf.net
>>179
ド底辺シリツというのに反応する椰子はw
199:卵の名無しさん
18/11/15 19:37:22.84 LT687Ilf.net
>>179
URLリンク(egg.2ch.net)
とそれへのレスみて事務員だと思うならお前の頭は相当悪いぞ。
あぁ、ド底辺シリツ医大卒の裏口バカだよなぁ?
>167に即答してみ。裏口入学じゃなきゃできるだろ。
200:卵の名無しさん
18/11/15 20:01:27.27 u639IIxL.net
>>174
R固有の関数を使うと for loop なしで できないこともない。
> m = expand.grid(1:9,1:9,1:9)
> f = function(A,B,C) sum((c(A,B,C)+c(A,C,B)+c(B,A,C)+c(B,C,A)+c(C,A,B))*c(100,10,1)) == 3123
> m[mapply(f,m[,1],m[,2],m[,3]),]
Var1 Var2 Var3
624 3 7 8
201:卵の名無しさん
18/11/15 20:14:47.02 0BjfilY2.net
今日も事務員は発狂中
他のスレでは既読スルーされてて
誰も反応なんかしていないよねW
とか書くと
また自作自演しまくるんだろうなー
202:卵の名無しさん
18/11/15 20:33:45.90 LT687Ilf.net
>>183
あらら、>167に即答できないって相当頭が悪いぞ。
裏口入学??
203:卵の名無しさん
18/11/15 20:36:16.18 LT687Ilf.net
専門医スレで誰も正当できなかった>176の方に答えてくれてもいいぞ、国立卒ならこれくらいの四則演算はできるだろ?
204:卵の名無しさん
18/11/15 20:58:27.02 ziKbMPPq.net
Last but not least, three laws of Do-Teihen(lowest-tier) Medical School, currently called Gachi'Ura by its graduates.
It is not the bottom medical school but its enrollee that is despicable, which deserves to be called a bona fide moron beyond redemption.
The graduates of Do-Teihen are so ashamed that none of them dare to mention their own alma mater they had gone through.
The Do-Teihen graduates are so ashamed of having bought their way into the exclusively lowest-tier medical school
that they tend to call a genuine doctor a charlatan who elucidates their imbecility.
205:卵の名無しさん
18/11/15 22:03:57.30 u639IIxL.net
DRAFT
非対称分布をする離散量の95%Highest Density Intervalを算出する。
pmf2hdi <- function(pmf,conf.level=0.95){ # pmf 2 higest density interval indices
pdf=pmf/sum(pmf) # sum(pdf)==1
hist(pdf,breaks = length(pdf),ann=FALSE)
spdf=sort(pdf,decreasing=TRUE) # sort pdf from highest
cdf=cumsum(spdf) # culmutive probability
threshold=spdf[which(cdf>=conf.level)[1]]
# which(cdf>conf.level)[1] : cdf.index of 1st value when cdf > 0.95
# threshold : its corresponding spdf value
index=which(pdf>=threshold) # pdf.index whose value > threshold
clevel=sum(pdf[index]) # actual conf.level, a little bit greater than 0.95
n.index=length(index)
if(n.index==index[n.index]-index[1]+1){ # check if unimodal by its length
interval=c(index[1],index[n.index])
print(c(lower=pmf[index[1]],upper=pmf[index[n.index]])) # lower and upper when unimodal
}else{interval=index
}
list(indices=interval,actual.CI=clevel)
}
206:卵の名無しさん
18/11/15 22:05:46.83 u639IIxL.net
>>186
which deserves to be called a bona fide moron は何故、whoでなくて文法破格のwhichが用いられているか、その理由を述べてみ!
207:卵の名無しさん
18/11/15 22:20:49.26 u639IIxL.net
>>187
一応完成
pmf2hdi <- function(pmf,conf.level=0.95){ # pmf 2 higest density interval indices
pdf=pmf/sum(pmf) # sum(pdf)==1
hist(pdf,breaks=length(pdf),ann=FALSE)
spdf=sort(pdf,decreasing=TRUE) # sort pdf from highest
cdf=cumsum(spdf) # culmutive probability
threshold=spdf[which(cdf>=conf.level)[1]]
# which(cdf>conf.level)[1] : cdf.index of 1st value when cdf > 0.95
# threshold : its corresponding spdf value
index=which(pdf>=threshold) # pdf.index whose value > threshold
clevel=sum(pdf[index]) # actual conf.level, a little bit greater than 0.95
n.index=length(index)
if(n.index==index[n.index]-index[1]+1){ # check if unimodal by its length
interval=c(index[1],index[n.index]) # if unimodal print lower and upper limit
print(c(lower=pmf[index[1]],upper=pmf[index[n.index]]))
}else{interval=index
}
list(indices=interval,actual.CI=clevel)
}
pmf2hdi(dgamma(seq(0,1,length=201),2,3))
pmf2hdi(rhyper(500,m=56,n=70, k=45))
208:卵の名無しさん
18/11/15 22:51:18.47 u639IIxL.net
(1)
池の鯉を網で56匹すくいました。
すくった56匹に目印をつけ、池にもどしました。
次の日に鯉45匹をすくったところ、3
209:6匹に目印がついていました。 池の鯉はおよそ何匹ですか。 (2) 固有の番号の書かれたカードが何枚あり、 その枚数は1000枚以下であることはわかっているが、その数を推定したい。 調査員が無作為に10枚選んで番号を記録して元に戻した。 別の調査員が無作為に20枚選んで番号を記録した。 二人の調査員の記録した番号を照合すると3枚の番号が一致していた。 この情報からカード枚数の最頻値、期待値とその95%信頼区間を求めよ。 (1)の方は鯉の数の上限を10000匹にして期待値を求めても71程度でほとんど変動しないが (2)の方は著しく変動する、合致枚数を8枚にすると殆ど変動しない。 再捕獲法での個体数推定の限界だな。
210:卵の名無しさん
18/11/15 23:19:30.11 u639IIxL.net
池の鯉を網で56匹すくいました。
すくった56匹に目印をつけ、池にもどしました。
次の日に鯉45匹をすくったところ、36匹に目印がついていました。
池の鯉はおよそ何匹ですか。
56*45/36=70で求まる70匹のとき36匹の目印が見つかる確率は?
137149850039891/562949953421312
0.2436270741410791
69匹のときの36匹の目印が見つかる確率も
137149850039891/562949953421312
0.2436270741410791
およそ何匹ですか、の記載は実に奥深い
pythonで確かめてみた。Rだと分数表示が無理:(
import math
from fractions import Fraction
def choose(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def dhyper(x,g,b,s):
return choose(g,x)*choose(b,s-x) / choose(g+b,s)
f69 = dhyper(36,56,69-56,45)
print (Fraction(f69))
print(f69)
f70 = dhyper(36,56,70-56,45)
print (Fraction(f70))
print (f70)
211:卵の名無しさん
18/11/15 23:24:03.77 u639IIxL.net
>>191
これでモード値が2個算出されたので気づいた。
g=56 ; s=45 ; x=36
N2p= function(N){
if(N < g + s - x) return(0)
b = N-g
dhyper(x,g,b,s) # choose(g,x)*choose(b,s-x)/choose(g+b,s)
}
pmf=Vectorize(N2p)
koi <- function(Nmax){
N=1:Nmax
y=pmf(N)
z=y/sum(y)
par(mfrow=c(2,1))
plot(N,z,type='h',col='gray',ylab='density',bty='l')
mode=N[y==max(y)]
mean=sum(N*z)
hdi = pmf2hdi(y,Print=FALSE)$indices
zc=cumsum(z)
median=which.max((zc>0.5))
abline(v=c(mode,median,mean),lty=c(1,2,3))
legend('topright',bty='n',legend=c('mode','median','mean'),lty=1:3)
plot(N,zc,type='l',col='gray',ylab='cdf',bty='l')
abline(h=0.5,lty=3)
qtl = c(min(which(zc>0.025)) , min(which(zc>0.975)))
list(mode=mode, median=median, mean=mean,CI.hdi=hdi,CI.Qqtl=qtl)
}
212:卵の名無しさん
18/11/15 23:36:45.82 aG6lkqvZ.net
>>183
鉄則を思い出しましょう
算数事務員はド底辺の裏口バカだから
対話するだけムダである
213:卵の名無しさん
18/11/15 23:40:32.65 u639IIxL.net
pythonにも超幾何分布のモジュールがあった。
from scipy.stats import hypergeom
import matplotlib.pyplot as plt
# hypergeom.pmf(x,g+b,g,s)
print(hypergeom.pmf(36, 70, 56, 45))
print(hypergeom.pmf(36, 69, 56, 45))
214:卵の名無しさん
18/11/15 23:43:20.76 u639IIxL.net
>>193
そんなの書く暇があれば、これくらい即答できるはずなのに。
2人が自転車に乗って走っている。その速さの比は11:8である。
この2人が周囲480mの円形の池の同じ地点から同時に同方向にスタートしてまわるとき、速い人は遅い人を4分ごとに追い越す。
2人の毎分の速さを求めよ
即答できないって、馬鹿なんだね。
215:卵の名無しさん
18/11/15 23:43:55.25 u639IIxL.net
専門医スレで誰も正当できなかった>176の方に答えてくれてもいいぞ、国立卒ならこれくらいの四則演算はできるだろ?
216:卵の名無しさん
18/11/15 23:55:08.72 kjgKXvFf.net
正当 WWW
発狂バカが やりがちの 漢字誤変換 WWW
217:卵の名無しさん
18/11/16 00:19:20.47 CpQxI30j.net
>>197
そういう指摘する暇があれば即答すればいいのに
やっぱり馬鹿なのね。
218:卵の名無しさん
18/11/16 14:34:20.45 OhMUxuM/.net
覆面算の □/□ * □/□ = □□/□
f0 分母に1を許さない
f1 分母に1がきてもよい
r0 = [[a,b,c,d,e,f,g]|a<-[1..9],b<-[2..9],c<-[(a+1)..9],d<-[2..9],e<-[1..9],f<-[1..9],g<-[2..9],(a/b)*(c/d)==(10*e+f)/g,a/=b,a/=c,a/=d,a/=e,a/=f,a/=g,b/=c,b/=d,b/=e,b/=f,b/=g,c/=d,c/=e,c/=f,c/=g,d/=e,d/=f,d/=g,e/=f,e/=g,f/=g]
r1 = [[a,b,c,d,e,f,g]|a<-[1..9],b<-[1..9],c<-[(a+1)..9],d<-[1..9],e<-[1..9],f<-[1..9],g<-[2..9],(a/b)*(c/d)==(10*e+f)/g,a/=b,a/=c,a/=d,a/=e,a/=f,a/=g,b/=c,b/=d,b/=e,b/=f,b/=g,c/=d,c/=e,c/=f,c/=g,d/=e,d/=f,d/=g,e/=f,e/=g,f/=g]
f x = map floor x
f0 = do
putStrLn "One is NOT permitted as denominator"
print $ map f r0
f1 = do
putStrLn "permissive of 1 as denominator"
print $ map f r1
main = do
f0
f1
219:卵の名無しさん
18/11/16 14:49:13.79 OhMUxuM/.net
タイムアウトせずにon lineでも動かせた。
URLリンク(tpcg.io)
220:卵の名無しさん
18/11/16 15:29:32.07 OhMUxuM/.net
これは最大値・最小値を求めてから組み合わせを出すことになるから時間がかかるなぁ。
-- max , min of □/□(□-□) - □(□-□)
f x = map floor x
-- permissive of as one as denominator
r1 = [(a/b)*(c-d)-e*(f-g)|a<-[-5..5],b<- [-5..(-1)]++[1..5],c<-[-5..5],d<-[-5..5],e<-[-5..5],f<-[-5..5],g<-[-5..5]
,a/=b,a/=c,a/=d,a/=e,a/=f,a/=g,b/=c,b/=d,b/=e,b/=f,b/=g,c/=d,c/=e,c/=f,c/=g,d/=e,d/=f,d/=g,e/=f,e/=g,f/=g]
r1max = maximum r1
r1min = minimum r1
ans1 x = [[a,b,c,d,e,f,g]|a<-[-5..5],b<-[-5..(-1)]++[1..5],c<-[-5..5],d<-[-5..5],e<-[-5..5],f<-[-5..5],g<-[-5..5],
a/=b,a/=c,a/=d,a/=e,a/=f,a/=g,b/=c,b/=d,b/=e,b/=f,b/=g,c/=d,c/=e,c/=f,c/=g,d/=e,d/=f,d/=g,e/=f,e/=g,f/=g,a/b*(c-d)-e*(f-g)== x]
-- no permission of one as denominator
r0 = [(a/b)*(c-d)-e*(f-g)|a<-[-5..5],b<- [-5..(-2)]++[2..5],c<-[-5..5],d<-[-5..5],e<-[-5..5],f<-[-5..5],g<-[-5..5],
a/=b,a/=c,a/=d,a/=e,a/=f,a/=g,b/=c,b/=d,b/=e,b/=f,b/=g,c/=d,c/=e,c/=f,c/=g,d/=e,d/=f,d/=g,e/=f,e/=g,f/=g]
r0max = maximum r0
r0min = minimum r0
ans0 x = [[a,b,c,d,e,f,g]|a<-[-5..5],b<-[-5..(-2)]++[2..5],c<-[-5..5],d<-[-5..5],e<-[-5..5],f<-[-5..5],g<-[-5..5],a/=b
,a/=c,a/=d,a/=e,a/=f,a/=g,b/=c,b/=d,b/=e,b/=f,b/=g,c/=d,c/=e,c/=f,c/=g,d/=e,d/=f,d/=g,e/=f,e/=g,f/=g,a/b*(c-d)-e*(f-g)== x]
{- To caluculate input and let it run for minutes:
map f (ans1 r1max)
map f (ans0 r0min)
-}
221:卵の名無しさん
18/11/16 16:11:47.91 OhMUxuM/.net
バックグラウンで放置してたら計算してくれていた。
Prelude> map f (ans1 r1max)
[[-5,-1,3,-4,5,-3,4],[-5,-1,3,-3,5,-4,4],[-5,-1,4,-4,5,-3,3],[-5,-1,4,-3,5,-4,3],[-5,1,-4,3,5,-3,4],[-5,1,-4,4,5,-3,3],[-5,1,-3,3,5,-4,4],[-5,1,-3,4,5,-4,3]
,[5,-1,-4,3,-5,4,-3],[5,-1,-4,4,-5,3,-3],[5,-1,-3,3,-5,4,-4],[5,-1,-3,4,-5,3,-4],[5,1,3,-4,-5,4,-3],[5,1,3,-3,-5,4,-4],[5,1,4,-4,-5,3,-3],[5,1,4,-3,-5,3,-4]]
222:卵の名無しさん
18/11/16 18:23:07.05 CpQxI30j.net
>>191
数学板にこの問題とpythonのコードを貼ったら
ちゃんとコード内の関数を読んでレスがきた。
このスレだと漢字の誤変換を指摘するしかできないアホしかいない。
誤変換の指摘を書く暇があれば、これくらい即答できるはずなのに。それもできない馬鹿なのか?裏口入学かな?
2人が自転車に乗って走っている。その速さの比は11:8である。
この2人が周囲480mの円形の池の同じ地点から同時に同方向にスタートしてまわるとき、速い人は遅い人を4分ごとに追い越す。
2人の毎分の速さを求めよ
223:卵の名無しさん
18/11/16 19:16:23.53 lLHsnLDJ.net
It is common knowledge among doctors and patients that Do-Teihen(exclusively bottom-leveled medical school) graduates mean morons who bought their way to Gachi'Ura(currently called by themselves)
According to the experience of entrance exam to medical school in the era of Showa, when the sense of discrimination against
privately-founded medical schools were more intense than it is now,
all such schools but for Keio had been so compared to some specialized institution for educable mentally retarded kids that nobody but imbecile successors of physicians in private practice had applied for admission.
There had been NOT a single classmate who chose willingly against his/her common sense to go to the Do-Teihen(exclusively bottom-leveled medical school, currently also known as Gachi'Ura),
which would have cost outrageous money and its graduates are destined to be called Uraguchi morons who bought thier way into the Do-Teihen, by thier colleagues and even by thier own clients.
Although people won't call them names to their face,
certain 80-90% people of about my age have been yet scorning and sneering at Uraguchi graduates, speaking in the back of our mind,
" Uraguchi morons shall not behave like somebody."
We never speak out face to face in real life.
224:卵の名無しさん
18/11/16 20:56:38.81 CpQxI30j.net
>>203
池の鯉を網で56匹すくいました。
すくった56匹に目印をつけ、池にもどしました。
次の日に鯉45匹をすくったところ、36匹に目印がついていました。
池の鯉はおよそ何匹ですか。
魚の総数を上限1万匹とし、その確率分布は一様分布を仮定。
再捕獲した45匹中何匹に目印がついているかで推測される95%信頼区間(Highest Density Interval)をグラフにしてみた。
URLリンク(i.imgur.com)
Rのコードはここに置いた(通知を変えて実行できる)
URLリンク(tpcg.io)
225:卵の名無しさん
18/11/16 22:01:15.87 7kS528uk.net
Uryuu fell 23 times in the national exam
It is an amateur virgin who is also failing in marriage
To the Uraguchi of the spinning parpurin
He is getting turned on
F class clerks condenced raw kid juice
The smell of the Doteihen does not decrease
NnnnnHooOoooOoooooooo
226:卵の名無しさん
18/11/16 22:37:20.95 STS/8KrX.net
僕らの おち○ぽ
227:卵の名無しさん
18/11/17 09:18:23.91 Xiv5Sp0o.net
Prudence, indeed, will dictate that "uraguchi" long established cannot be changed for light and transient causes;
and accordingly all experience has shown, that BMS are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms from which they can pursue profit.
But when a long train of misbehavior and misconduct , showing invariably the same Imbecility evinces a design to reveal themselves as absolute Bona Fide Moron ,
it is their right, it is their duty, to expel such "uraguchi", and to provide new guards for their future security.
228:卵の名無しさん
18/11/17 10:15:28.71 Vs5/CoAG.net
>>205
池の鯉の総数と調査します。
五郎君が名前に因んで56匹�
229:゚まえて目印をつけ、池にもどしました。 次の日に三郎君が自分の名前に因んで36匹の目印のついた鯉を捕まえることにしました。 鯉45匹めで予定の36匹が捕まりました。 池の鯉はおよそ何匹ですか。 負の二項分布で計算するとこっちはモード値が70の1個なんだなぁ。
230:卵の名無しさん
18/11/17 10:26:00.26 Vs5/CoAG.net
>>209
このときの推測数の信頼区間の算出が次の課題だな。
3匹目印鯉捕獲目標が45匹目で達成されたときと比較したい。
231:卵の名無しさん
18/11/17 10:51:31.94 Vs5/CoAG.net
>>210
DRAFT
232:卵の名無しさん
18/11/17 10:51:40.44 Vs5/CoAG.net
marked.fish2 <- function(.x,Nmax=1000, Print=FALSE){
# marked fish # to 95%CI
N2p= function(N,g=56,s=45,x=.x){ # N:total number of fish
if(N < g + s - x) return(0)
dnbinom(s-x,x,g/N) # choose(s-1,x-s)*(1-p)^(s-x)*p^x
}
pmf=Vectorize(N2p)
N=1:Nmax
y=pmf(N)
z=y/sum(y)
mode=mean(N[y==max(y)]) # can be multiple
mean=sum(N*z)
# hdi = pmf2hdi(y,Print=FALSE)$indices
hdi=NA
zc=cumsum(z)
median=which.max((zc>0.5))
if(Print){
par(mfrow=c(2,1))
plot(N,z,type='h',col='gray',ylab='density',bty='l')
abline(v=c(mode,median,mean),lty=c(1,2,3))
legend('topright',bty='n',legend=c('mode','median','mean'),lty=1:3)
plot(N,zc,type='l',col='gray',ylab='cdf',bty='l')
abline(h=0.5,lty=3)}
qtl = c(min(which(zc>0.025)) , min(which(zc>0.975)))
list(mode=mode, median=median, mean=mean,CI.hdi=hdi,CI.Qqtl=qtl)
}
marked.fish2(3)
marked.fish2(36)
233:卵の名無しさん
18/11/17 12:29:55.67 MdaDRZ5p.net
非対称分布の信頼区間算出にパッケージないのかな?
pmf2hdi <- function(pmf,conf.level=0.95,Print=TRUE){ # pmf 2 higest density interval indices
pdf=pmf/sum(pmf) # sum(pdf)==1
if(Print) hist(pdf,breaks=length(pdf),ann=FALSE)
spdf=sort(pdf,decreasing=TRUE) # sort pdf from highest
cdf=cumsum(spdf) # culmutive probability
threshold=spdf[which(cdf>=conf.level)[1]]
# which(cdf>conf.level)[1] : cdf.index of 1st value when cdf > 0.95
# threshold : its corresponding spdf value
index=which(pdf>=threshold) # pdf.index whose value > threshold
clevel=sum(pdf[index]) # actual conf.level, a little bit greater than 0.95
n.index=length(index)
if(n.index==index[n.index]-index[1]+1){ # check if unimodal by its length
interval=c(index[1],index[n.index]) # if unimodal print lower and upper limit
print(c(lower=pmf[index[1]],upper=pmf[index[n.index]]))
}else{interval=index
}
list(indices=interval,actual.CI=clevel)
}
234:卵の名無しさん
18/11/17 13:55:53.88 ZSsSLaRh.net
>>210
> marked.fish(3)
lower upper
0.009921656 0.009682298
$`mode`
[1] 839
$median
[1] 1430
$mean
[1] 1963.967
$CI.hdi
[1] 295 5445
$CI.Qqtl
[1] 473 6825
235:卵の名無しさん
18/11/17 13:56:56.74 ZSsSLaRh.net
> marked.fish2(3)
lower upper
0.0006438142 0.0006421482
$`mode`
[1] 840
$median
[1] 1445
$mean
[1] 1985.835
$CI.hdi
[1] 280 5525
$CI.Qqtl
[1] 463 6902
負の二項分布でも超幾何分布のときとさほど変わらないなぁ
236:卵の名無しさん
18/11/17 14:05:11.77 oN/r/5pI.net
さて来週の3本は
よくもこんな〇〇〇〇レコードを
これから毎日スレ上げしようぜ
んほおぉぉぉおぉぉ
でお送りしま~す、んっわっほっぅ
237:純粋大和
18/11/17 14:17:58.42 bEfId4t4.net
どうせ助からない(死ぬ奴)の集まりかよ 笑
238:卵の名無しさん
18/11/17 17:37:00.95 ZSsSLaRh.net
数学板のこれ面白かった。情報量とか調べながら解答してきた。
789 名前:132人目の素数さん[] 投稿日:2018/11/17(土) 01:54:23.54 ID:SOe/0VMF
情報理論の問題です。(1)は解けるのですが、(2)でつまずいています...
<問題>
50人の生徒からなるクラスがある。
そのうち30人は男子、20人は女子であり、男子のうち18人、女子のうち2人は眼鏡をかけている仮定とする。
(1)男女の別、眼鏡の有無のそれぞれが持つ平均自己相互量を求めよ。
(2)男女の性別が判っているという条件のもとで、眼鏡の有無が持つ条件付き自己情報量を求めよ。
答えは、
(1)H(X) = 0.97ビット, H(Y) = 0.97ビット
(2)H(Y|X) = 0.77ビット
となっております。
得意な方がいましたら、(2)の答えを出すまでの計算過程を教えていただきたいです。
よろしくお願い致します。
239:卵の名無しさん
18/11/17 17:38:33.02 ZSsSLaRh.net
数時間潰しての結果がこれ、わずか2行w
Prelude> let entropy x = sum $ map (\i -> -i*(logBase 2 i)) ( map(/sum(x)) x )
Prelude> 30/50 * entropy [18, 12] + 20/50 * entropy [2, 18]
0.7701685941085136
240:卵の名無しさん
18/11/17 18:43:39.12 ZSsSLaRh.net
>>219
再利用できるように関数化しておいた。
{-
<問題>
120(n)人の生徒からなるクラスがある。
そのうち90(m)人は男子、30(f)人は女子であり、男子のうち80(um)人、女子のうち10(uf)人は裏口入学であると仮定とする。
(1)男女の別、裏口の有無のそれぞれが持つ平均自己相互量をビット値で求めよ。
(2)男女の性別が判っているという条件のもとで、裏口の有無が持つ条件付き自己情報量(ビット値)を求めよ。
-}
entropy x = sum $ map (\i -> -i*(logBase 2 i)) ( map(/sum(x)) x )
entr_ura_gender n m f um uf = do
m/n*entropy[um,m-um] + f/n*entropy[uf,f-uf]
241:卵の名無しさん
18/11/17 19:20:41.23 XNk+eTpQ.net
Prudence, indeed, will dictate that "uraguchi" long established cannot be changed for light and transient causes;
and accordingly all experience has shown, that BMS are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms from which they can pursue profit.
But when a long train of misbehavior and misconduct , showing invariably the same Imbecility evinces a design to reveal themselves as absolute Bona Fide Moron ,
it is their right, it is their duty, to expel such "uraguchi", and to provide new guards for their future security.
242:卵の名無しさん
18/11/17 20:12:01.95 ZSsSLaRh.net
# URLリンク(logics-of-blue.com)
"予想がつかない→不確実性(情報エントロピー)が大きい→平均情報量も大きい"
entropy <- function(x){ # 情報エントロピー(平均情報量)
x=x/sum(x)
sum(x*(-log2(x)))
}
"各々の確率分布の情報量の差分の期待値をとります
確率分布が異なっていれば、情報量があるとみなすのが
カルバック・ライブラーの情報量です。"
KLd <- function(P,Q){ # Kullback?Leibler divergence, relative entropy,Information gain
n=length(P)
if(n!=length(Q)) return(NULL)
P=P/sum(P)
Q=Q/sum(Q)
sum(Q*(log2(Q)-log2(P)))
}
# 相互情報量は不確実性(情報エントロピー)の減少量とみなすことができます
243:卵の名無しさん
18/11/17 21:45:47.30 ZSsSLaRh.net
KLd <- function(P,Q){ # Kullback-Leibler divergence, relative entropy,Information gain
n=length(P)
if(n!=length(Q)) return(NULL)
P=P/sum(P)
Q=Q/sum(Q)
sum(P*log(P)/log(Q)) # P relative to Q
}
kld p q = do -- Kullback-Leibler divergence
-- if length p /= length q
-- then return ()
-- else do
let pp = map (/sum(p)) p
qq = map (/sum(q)) q
in sum $ zipWith (\x y -> x * (log x)/(log y)) pp qq
244:卵の名無しさん
18/11/17 21:50:36.68 ZSsSLaRh.net
Prelude> p = [80,10]
Prelude> q = [10,20]
Prelude> let pp = map (/sum(p)) p
Prelude> let qq = map (/sum(q)) q
Prelude> sum $ zipWith (\x y -> x * (log x)/(log y)) pp qq
0.6974120552208812
KLd <- function(P,Q){ # Kullback-Leibler divergence, relative entropy,Information gain
n=length(P)
if(n!=length(Q)) return(NULL)
P=P/sum(P)
Q=Q/sum(Q)
sum(P*log(P)/log(Q)) # P relative to Q
}
> KLd(c(80,10),c(10,20))
[1] 0.6974121
245:卵の名無しさん
18/11/17 23:42:40.77 7FfFKHDd.net
It is common knowledge among doctors and patients that Do-Teihen(exclusively bottom-leveled medical school) graduates mean morons who bought their way to Gachi'Ura(currently called by themselves)
According to the experience of entrance exam to medical school in the era of Showa, when the sense of discrimination against
privately-founded medical schools were more intense than it is now,
all such schools but for Keio had been so compared to some specialized institution for educable mentally retarded kids that nobody but imbecile successors of physicians in private practice had applied for admission.
There had been NOT a single classmate who chose willingly against his/her common sense to go to the Do-Teihen(exclusively bottom-leveled medical school, currently also known as Gachi'Ura),
which would have cost outrageous money and its graduates are destined to be called Uraguchi morons who bought thier way into the Do-Teihen, by thier colleagues and even by thier own clients.
Although people won't call them names to their face,
certain 80-90% people of about my age have been yet scorning and sneering at Uraguchi graduates, speaking in the back of our mind,
" Uraguchi morons shall not behave like somebody."
We never speak out face to face in real life.
246:卵の名無しさん
18/11/18 06:08:27.82 YaOZKwLp.net
事務員で遊ぶのも飽きてきたし
そろそろコミケの原稿を書き始めなきゃなぁ
247:卵の名無しさん
18/11/18 06:55:57.87 deJ1Cp/X.net
中学入試を難問化した問題で遊んでみる。
池の鯉を網で56匹すくいました。
すくった56匹に目印をつけ、池にもどしました。
次の日に鯉45匹をすくったところ、36匹に目印がついていました。
(1)池の鯉の鯉の数の最尤値を述べよ(2つある)。
(2)最尤値が2つあるのは何匹の目印鯉が捕獲されたときか述べよ。
248:卵の名無しさん
18/11/18 08:16:59.52 afl5ZxKK.net
It is common knowledge among doctors and patients that Do-Teihen(exclusively bottom-leveled medical school) graduates mean morons who bought their way to Gachi'Ura(currently called by themselves)
According to the experience of entrance exam to medical school in the era of Showa, when the sense of discrimination against
privately-founded medical schools were more intense than it is now,
all such schools but for Keio had been so compared to some specialized institution for educable mentally retarded kids that nobody but imbecile successors of physicians in private practice had applied for admission.
There had been NOT a single classmate who chose willingly against his/her common sense to go to the Do-Teihen(exclusively bottom-leveled medical school, currently also known as Gachi'Ura),
which would have cost outrageous money and its graduates are destined to be called Uraguchi morons who bought thier way into the Do-Teihen, by thier colleagues and even by thier own clients.
Although people won't call them names to their face,
certain 80-90% people of about my age have been yet scorning and sneering at Uraguchi graduates, speaking in the back of our mind,
" Uraguchi morons shall not behave like somebody."
We never speak out face to face in real life.
249:卵の名無しさん
18/11/18 10:01:00.69 deJ1Cp/X.net
>>223
kld p q = do -- Kullback-Leibler divergence
if length p /= length q
then error "Not equal length"
else do
let pp = map (/sum(p)) p
qq = map (/sum(q)) q
in sum $ zipWith (\x y -> x * (log x)/(log y)) pp qq
main = do
print $ kld [1,1] [1,3]
print $ kld [1,1] [1,2,3]
250:卵の名無しさん
18/11/18 11:18:38.60 uPZ4H5RS.net
>>227
pmf2hdi <- function(pmf,conf.level=0.95,Print=TRUE){ # pmf 2 higest density interval indices
pdf=pmf/sum(pmf) # sum(pdf)==1
if(Print) hist(pdf,breaks=length(pdf),ann=FALSE)
spdf=sort(pdf,decreasing=TRUE) # sort pdf from highest
cdf=cumsum(spdf) # culmutive probability
threshold=spdf[which(cdf>=conf.level)[1]]
# which(cdf>conf.level)[1] : cdf.index of 1st value when cdf > 0.95
# threshold : its corresponding spdf value
index=which(pdf>=threshold) # pdf.index whose value > threshold
clevel=sum(pdf[index]) # actual conf.level, a little bit greater than 0.95
n.index=length(index)
if(n.index==index[n.index]-index[1]+1){ # check if unimodal by its length
interval=c(index[1],index[n.index]) # if unimodal print lower and upper limit
print(c(lower=pmf[index[1]],upper=pmf[index[n.index]]))
}else{interval=index
}
list(indices=interval,actual.CI=clevel)
}
251:卵の名無しさん
18/11/18 11:18:46.99 uPZ4H5RS.net
marked.fish <- function(.x,Nmax=10000, Print=FALSE){ # marked fish # to 95%CI
N2p= function(N,g=56,s=45,x=.x){ # N:total number of fishe
if(N < g + s - x) return(0)
b = N-g # g:genuine(marked) b:bogus(unmarked) s:re-sampled
dhyper(x,g,b,s) # choose(g,x)*choose(b,s-x)/choose(g+b,s)
}
pmf=Vectorize(N2p)
N=1:Nmax
y=pmf(N)
z=y/sum(y)
mode.idx=N[y==max(y)] # can be multiple
n.idx=length(mode.idx)
mode=min(mode.idx)+(n.idx-1)/10
mean=sum(N*z)
hdi = pmf2hdi(y,Print=FALSE)$indices
zc=cumsum(z)
median=which.max((zc>0.5))
if(Print){
par(mfrow=c(2,1))
plot(N,z,type='h',col='gray',ylab='density',bty='l')
abline(v=c(mode,median,mean),lty=c(1,2,3))
legend('topright',bty='n',legend=c('mode','median','mean'),lty=1:3)
plot(N,zc,type='l',col='gray',ylab='cdf',bty='l')
abline(h=0.5,lty=3)}
qtl = c(min(which(zc>0.025)) , min(which(zc>0.975)))
list(mode=mode, median=median, mean=mean,CI.hdi=hdi,CI.Qqtl=qtl)
}
252:卵の名無しさん
18/11/18 11:19:33.02 uPZ4H5RS.net
marked.fish(36,Print=T)
marked.fish(3,Print=T)
n=0:45
Y=sapply(n,function(n) marked.fish(n))
y=matrix(unlist(Y["CI.hdi",]),nrow=2)
plot(n,y[2,],type='n',bty='l',xlab='re-sampled marked fish',
ylab='estimated size of total')
segments(n,y[1,],n,y[2,],lwd=3,col='gray')
points(n,unlist(Y['mode',]),pch=21)
points(n,unlist(Y['median',]),pch='+')
points(n,unlist(Y['mean',]),pch='*')
legend('center',bty='n',pch=c('○','+','*'),legend=c('mode','median','mean'))
result
253:=data.frame(n,mode=unlist(Y['mode',]),median=unlist(Y['median',]), mean=round(unlist(Y['mean',]),1)) result[1:20,] result[21:40,] tail(result) n[floor(result[,'mode'])!=result[,'mode']] # multiple
254:卵の名無しさん
18/11/18 11:20:38.75 uPZ4H5RS.net
>>227
(2)の答は4個あるな。
255:卵の名無しさん
18/11/18 13:29:06.59 uPZ4H5RS.net
>>224
プログラミンの練習にpythonに移植、Rより面倒。
import math
def simplex(x): # convert vector to whose sum =1
s=sum(x)
return ([y/s for y in x]) # return(list(map( (lambda y: y/s) , x )))
def kld(p,q): # Kullback-Leibler divergence
if len(p)!=len(q):
raise Exception("Not equal length!")
p = simplex(p)
q = simplex(q)
return(sum(list (map (lambda x,y: x* math.log(x)/math.log(y), p,q))))
256:卵の名無しさん
18/11/18 17:41:08.98 uPZ4H5RS.net
>>234
エラー処理はなしにして無理矢理、one-liner にすると
def Kullback_Leiber(p,q): return(sum(list (map (lambda x,y: x* math.log(x)/math.log(y), [i/sum(p) for i in p],[j/sum(q) for j in q]))))
257:卵の名無しさん
18/11/19 00:27:20.08 6+hS1SxI.net
i tried it in Showa u motherfucker. in that time niggers were supposed be in what niggahz were supposed to be motherfucking in, which we call a discrimination.
they pay shit loaded money to motherfucking niggers ass-bitch cocksucker fucking gringo homosexual hobo
i mean fuck you all go down hell
258:卵の名無しさん
18/11/19 06:06:04.36 tA4kj3ba.net
2^3はpythonで1を返す
ビット演算子(~, &, |, ^, <<, >>)
2**3 か pow(2,3)で冪乗
259:卵の名無しさん
18/11/19 06:40:59.39 tA4kj3ba.net
練習に、これを移植したいなぁ。
URLリンク(www.geocities.jp)
260:卵の名無しさん
18/11/19 06:43:11.58 tA4kj3ba.net
すでにやった人がいた:P
URLリンク(dev.ariel-networks.com)
261:卵の名無しさん
18/11/19 07:27:32.80 tA4kj3ba.net
>>238
数が小さいので頭で考えると (4L,3L)
[(0,0),(4,0),(1,3),(1,0),(0,1),(4,1),(2,3),(2,0)]
になるが、
Haskellの解は無駄な汲み出しをしている気がするなぁ。
[(0,0),(4,0),(0,3),(4,3),(1,3),(3,0),(1,0),(3,3),(0,1),(4,2),(4,1),(0,2),(2,3),(2,0)]
262:卵の名無しさん
18/11/19 07:29:17.17 tA4kj3ba.net
>>240
問題はこれ
問題 : 4 リットルと 3 リットルの容器を使って 2 リットルの水を測るにはどうすればいい?
263:卵の名無しさん
18/11/19 07:31:08.11 tA4kj3ba.net
こっちの方が断然、難関。
油分け算
[問題] 油分け算
14 リットルの容器 A に油が満杯に入っています。これを 11 リットルの容器 B と 3 リットルの容器 C を使って二等分してください。
容器 A と B には 7 リットルずつ油が入ります。油を二等分する最短手順を求めてください。
容器 B と C のサイズが 9 リットルと 5 リットルの場合の手順は?
264:卵の名無しさん
18/11/19 08:12:59.88 tA4kj3ba.net
>>239
WinGCHiで動作するように少し改変
import Data.List
basicState = (0,0)
actions = let xmax = 4
ymax = 3
in [(\(x, y) -> (xmax, y)),
(\(x, y) -> (x, ymax)),
(\(x, y) -> (0, y)),
(\(x, y) -> (x, 0)),
(\(x, y) -> if (x + y > xmax) then (xmax, y+x-xmax) else (x+y, 0)),
(\(x, y) -> if (x + y > y
265:max) then (x+y-ymax, ymax) else (0, x+y))] main = print $ searchStates [basicState] searchStates :: [(Int, Int)] -> [(Int, Int)] searchStates states = let nexts = filter (not . (checkState states)) $ concat $ map (execSeek actions) states in if length nexts > 0 then searchStates $ states ++ (nub nexts) else states execSeek :: [((Int, Int) -> (Int, Int))] -> (Int, Int) -> [(Int, Int)] execSeek (f:fs) crnt | null fs = (f crnt : []) | True = (f crnt : []) ++ execSeek fs crnt checkState :: [(Int, Int)] -> (Int, Int) -> Bool checkState states (crnt_x, crnt_y) = any isSameState states where isSameState :: (Int, Int) -> Bool isSameState (x, y) = if (x == crnt_x && y == crnt_y) then True else False
266:卵の名無しさん
18/11/19 08:25:49.04 tA4kj3ba.net
>>239
これは可能な組み合わせを列挙しているだけで必ずしも手順をしめすプログラムじゃないな。
267:卵の名無しさん
18/11/19 08:30:40.71 L6cqzabr.net
i tried it in Showa u motherfucker. in that time niggers were supposed be in what niggahz were supposed to be motherfucking in, which we call a discrimination.
they pay shit loaded money to motherfucking niggers ass-bitch cocksucker fucking gringo homosexual hobo
i mean fuck you all go down hell
268:卵の名無しさん
18/11/19 12:28:58.07 xPquTj4a.net
>>240
[(0,0),(0,3),(3,0),(3,3),(4,2),(0,2)] というのが数学板で返された
269:卵の名無しさん
18/11/19 14:10:23.88 lgLouqKT.net
>>246 は国試に23回も落ちた挙句
婚活にも失敗してる素人童貞で
くるくるぱーの裏口バカに
なっちゃってるのらぁあぁぁ
Fラン事務員の濃ゆぅぅい生ガキ汁
ド底辺の臭いが落ちないよぉ
んほおぉぉぉおぉぉ
270:卵の名無しさん
18/11/19 15:18:00.83 /8nCvktv.net
>>242
(14,0,0),(3,11,0),(3,8,3),(6,8,0),(6,5,3),(9,5,0),(9,2,3),(12,2,0),(12,0,2),(1,11,2),(1,10,3),(4,10,0),(4,7,3),(7,7,0)
これでできるけど、最短かどうかは自信がないなぁ。
271:卵の名無しさん
18/11/19 15:21:56.75 /8nCvktv.net
>>247
ド底辺シリツ医大卒の知性を表すような文章だなぁ。
>242の答でもだせばいいのに、
馬鹿なのか?馬鹿なのにどうして大学に入れるわけ?
あれかな?
あれだよね?
あれ
あれ
う
ら
ぐ
ち
272:卵の名無しさん
18/11/19 15:46:07.22 /8nCvktv.net
[問題]
30 リットルの容器 A に油が満杯に入っています。これを 17 リットルの容器 B と 13 リットルの容器 C を使って二等分してください。容器 A と B には 15 リットルずつ油が入ります。油を二等分する手順を求めてください。
[30,0,0]
[13,17,0]
[13,4,13]
[26,4,0]
[26,0,4]
[9,17,4]
[9,8,13]
[22,8,0]
[22,0,8]
[5,17,8]
[5,12,13]
[18,12,0]
[18,0,12]
[1,17,12]
[1,16,13]
[14,16,0]
[14,3,13]
[27,3,0]
[27,0,3]
[10,17,3]
[10,7,13]
[23,7,0]
[23,0,7]
[6,17,7]
[6,11,13]
[19,11,0]
[19,0,11]
[2,17,11]
[2,15,13]
[15,15,0]
273:卵の名無しさん
18/11/19 18:20:27.15 lgLouqKT.net
ネットで口汚くあちこちのスレを荒らしている国試浪人の事務員だが
この世に彼奴を下回るカスがいるだろうか
いや居ない
リアルではだれも口にしないが、みな思っていることだ
事務員本人も内心は自覚していることだろう
でなければ毎日毎日、専門医や開業医や皮膚科でもないのに
それぞれのスレを荒らしに来るはずがない
よっぽど妬ましいんだろうなW
274:卵の名無しさん
18/11/19 20:30:41.47 /8nCvktv.net
rm(list=ls())
Amax=10 ; Bmax=7 ; Cmax=3
init = c(10,0,0)
stacks=t(as.matrix(init))
a2b <- function(abc){
a=abc[1];b=abc[2];c=abc[3]
if(a+b > Bmax) c(a+b-Bmax,Bmax,c)
else c(0, a+b, c)
}
a2c <- function(abc){
a=abc[1];b=abc[2];c=abc[3]
if(a+c > Cmax) c(a+c-Cmax, b, Cmax)
else c(0, b, a+c)
}
b2c <- function(abc){
a=abc[1];b=abc[2];c=abc[3]
if(b+c > Cmax) c(a, b+c-Cmax,Cmax)
else c(a, 0, b+c)
}
b2a <- function(abc){
a=abc[1];b=abc[2];c=abc[3]
if(b+a > Amax) c(Amax, b+a-Amax,c)
else c(b+a, 0, c)
}
275:卵の名無しさん
18/11/19 20:31:14.24 /8nCvktv.net
c2a <- function(abc){
a=abc[1];b=abc[2];c=abc[3]
if(c+a > Amax) c(Amax, b, c
276:+a-Amax) else c(c+a, b, 0) } c2b <- function(abc){ a=abc[1];b=abc[2];c=abc[3] if(c+b > Bmax) c(a, Bmax, c+b-Bmax) else c(a, c+b, 0) } actions = c(a2b,a2c,b2c,c2a,c2a,c2b) transfer <- function(x){ re=NULL for(fun in actions){ re=rbind(re,fun(x)) } unique(re) } transit=transfer(init) is.vim <- function(vector,matrix){ # is vector in matrix any(apply(matrix,1,function(x) all(x==vector))) }
277:卵の名無しさん
18/11/19 21:00:32.27 /8nCvktv.net
URLリンク(ailaby.com)
278:卵の名無しさん
18/11/19 22:04:51.47 vmWf+9X3.net
actions = c(a2b,a2c,b2c,c2a,c2a,c2b)
is.vim <- function(vector,matrix){ # is vector in matrix
any(apply(matrix,1,function(x) all(x==vector)))
}
is.goal <- function(x){
all(x==goal)
}
transfer <- function(x){
re=NULL
for(fun in actions){
v=fun(x)
if(!is.vim(v,stacks)) re=rbind(re,fun(x))
}
unique(re)
}
transit=transfer(init)
push <- function(x){
n=nrow(x)
for(i in 1:n){
if(!is.vim(x[i,],stacks)) stacks=rbind(x[i,],stacks)
if(is.goal(x[i,])) break
}
return(stacks)
}
stacks=push(transit)
279:卵の名無しさん
18/11/19 22:22:12.67 vmWf+9X3.net
URLリンク(jprogramer.com)
280:卵の名無しさん
18/11/19 22:29:14.48 vmWf+9X3.net
>>251
期待に反して悪いが俺、事務員じゃないんだね。
臨床やってるからこういう議論もできる。
URLリンク(egg.2ch.net)
879 卵の名無しさん sage 2018/11/15(木) 07:18:18.94 ID:LT687Ilf
>>878
>875は脾弯越えの操作でpullする時の話。
URLリンク(i.imgur.com)
んで、あんたどこ卒?
ド底辺シリツ医大へ裏口入学なんだろ?
中学入試を少し難問化した>227に答えてみ!
281:卵の名無しさん
18/11/19 22:31:41.85 vmWf+9X3.net
>>251
国立卒はちゃんとわかってる。
開業医スレのシリツ三法則(試案、名投稿より作成)
1.私立医が予想通り糞だからしょうがない
>スレリンク(hosp板:101番)-102
>スレリンク(hosp板:844番)-853
ID:RFPm1BdQ
>スレリンク(hosp板:869番)
>スレリンク(hosp板:874番)-875
>スレリンク(hosp板:874番)-880
>スレリンク(hosp板:882番)
ID:liUvUPgn
2.馬鹿に馬鹿と言っちゃ嫌われるのは摂理
実例大杉!
3.リアルでは皆思ってるだけで口に出してないだけ
URLリンク(ishikisoku.com)
282:卵の名無しさん
18/11/19 22:42:33.31 zhu5ykUr.net
Prudence, indeed, will dictate that "uraguchi" long established cannot be changed for light and transient causes;
and accordingly all experience has shown, that BMS are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms from which they can pursue profit.
But when a long train of misbehavior and misconduct , showing invariably the same Imbecility evinces a design to reveal themselves as absolute Bona Fide Moron ,
it is their right, it is their duty, to expel such "uraguchi", and to provide new guards for their future security.
283:卵の名無しさん
18/11/19 23:01:00.76 vmWf+9X3.net
>>251
統計スレに投稿するならこれくらい答えてみ。
話題のド底辺シリツ医大裏口入学を題材にした問題。
ド底辺シリツ裏口調査団が100人を順次調査した。
裏口判明人数をそのまま公表はヤバすぎる結果であったため、
連続して裏口がみつかった最大数は4人であったとだけ公表した。
公表結果が正しいとして裏口入学人数の期待値、最頻値、及び95%信頼区間を述べよ。
284:卵の名無しさん
18/11/19 23:13:28.02 vmWf+9X3.net
actions = c(a2b,a2c,b2c,c2a,c2a,c2b)
is.vim <- function(vector,matrix){ # 配列が行列に含まれるか
any(apply(matrix,1,function(x) all(x==vector)))}
is.goal <- function(x){ #ゴール判定
all(x==goal)}
transfer <- function(x){ # 移動してにスタックにない配列のみ返す
re=NULL
for(fun in actions){
v=fun(x)
if(!is.vim(v,stacks)) re=rbind(re,fun(x)) }
unique(re)}
transit=transfer(init) #最初の移動
push <- function(x){ #新規のみスタックに積む
n=nrow(x)
for(i in 1:n){
if(!is.vim(x[i,],stacks)) stacks=rbind(x[i,],stacks)
if(is.goal(x[i,])) break #ゴールしてたらループをぬける
}
return(stacks) #新スタックを返す
}
stacks=push(transit)
285:卵の名無しさん
18/11/20 07:42:56.98 jEVjKi6n.net
>>251
んで、あんたどこ卒?
286:卵の名無しさん
18/11/20 07:48:14.29 jEVjKi6n.net
>>261
探索経路を記録するのと
移転で過去の状態に戻るのをカウントから外す必要があるなぁ。
287:卵の名無しさん
18/11/20 08:30:59.02 GReM9fuK.net
ネットで口汚くあちこちのスレを荒らしている国試浪人の事務員だが
この世に彼奴を下回るカスがいるだろうか
いや居ない
リアルではだれも口にしないが、みな思っていることだ
事務員本人も内心は自覚していることだろう
でなければ毎日毎日、専門医や開業医や皮膚科でもないのに
それぞれのスレを荒らしに来るはずがない
よっぽど妬ましいんだろうなW
288:卵の名無しさん
18/11/20 11:38:05.66 +LTJHbMS.net
油分け算のRスクリプトようやく完成
rm(list=ls())
Amax=10 ; Bmax=7 ; Cmax=3 # capacity
t0 = c(10,0,0) # initial state
goal = c(5,5,0) # goal
.stack <<- t(as.matrix(t0)) # stack (converted to one row matrix)
.checked <<- .stack # checked list
# pouring methods
a2b <- function(abc){ # pour from A to B
a=abc[1];b=abc[2];c=abc[3]
if(a+b > Bmax) c(a+b-Bmax,Bmax,c)
else c(0, a+b, c)
}
a2c <- function(abc){
a=abc[1];b=abc[2];c=abc[3]
if(a+c > Cmax) c(a+c-Cmax, b, Cmax)
else c(0, b, a+c)
}
b2c <- function(abc){
a=abc[1];b=abc[2];c=abc[3]
if(b+c > Cmax) c(a, b+c-Cmax,Cmax)
else c(a, 0, b+c)
}
289:卵の名無しさん
18/11/20 11:38:32.07 +LTJHbMS.net
b2a <- function(abc){
a=abc[1];b=abc[2];c=abc[3]
if(b+a > Amax) c(Amax, b+a-Amax,c)
else c(b+a, 0, c)
}
c2a <- function(abc){
a=abc[1];b=abc[2];c=abc[3]
if(c+a > Amax) c(Amax, b, c+a-Amax)
else c(c+a, b, 0)
}
c2b <- function(abc){
a=abc[1];b=abc[2];c=abc[3]
if(c+b > Bmax) c(a, Bmax, c+b-Bmax)
else c(a, c+b, 0)
}
actions = c(a2b,a2c,b2c,c2a,c2a,c2b) # all pouring method
is.rim <- function(row,matrix){ # is row in matrix?
any(apply(matrix,1,function(x) all(x==row))) # comparble to %in%
}
is.goal <- function(x){ # goal reached?
all(x==goal)
}
290:卵の名無しさん
18/11/20 11:38:51.94 +LTJHbMS.net
pop <- function(){ # pop LIFO
if(is.null(.stack)) return()
LIFO=.stack[1,]
if(nrow(.stack)==1) .stack <<- NULL
else .stack <<- .stack[-1,] # changed GLOBALLY
return(LIFO)
}
push <- function(rows){ # push rows at head of stack
if(is.null(rows)) invisible(NULL) # no NULL show
else .stack <<- rbind(rows , .stack) # changed GLOBELY
}
transfer <- function(x){ # return unchekcked transferred state
re=NULL
for(fun in actions){ # try all methods
v=fun(x) # drop checked state and itself
if(!is.rim(v,.checked) & !all(v==x)) re=rbind(re,fun(x))
}
uni.re=unique(re) # delete duplicated
.checked <<- rbind(uni.re,.checked) # add to .checked GLOBELY
return(uni.re)
}
291:卵の名無しさん
18/11/20 11:39:23.04 +LTJHbMS.net
state=NULL
while(!is.goal(.stack[1,])){
push(transfer(pop()))
state=rbind(state,.stack[1,])
}
> state
[,1] [,2] [,3]
[1,] 3 7 0
[2,] 0 7 3
[3,] 3 4 3
[4,] 6 4 0
[5,] 6 1 3
[6,] 9 1 0
[7,] 9 0 1
[8,] 2 7 1
[9,] 2 5 3
[10,] 5 5 0
292:卵の名無しさん
18/11/20 13:27:38.76 +LTJHbMS.net
>>268
これだと無駄な手順も返しているな。
while(!is.goal(.stack[1,])){
tr=transfer(pop())
push(tr)
if(!is.null(tr))state=rbind(state,.stack[1,])
}
state
> state
[,1] [,2] [,3]
[1,] 3 7 0
[2,] 0 7 3
[3,] 6 4 0
[4,] 6 1 3
[5,] 9 1 0
[6,] 9 0 1
[7,] 2 7 1
[8,] 2 5 3
[9,] 5 5 0
293:卵の名無しさん
18/11/20 15:06:09.76 6Tvud5kf.net
i tried it in Showa u motherfucker. in that time niggers were supposed be in what niggahz were supposed to be motherfucking in, which we call a discrimination.
they pay shit loaded money to motherfucking niggers ass-bitch cocksucker fucking gringo homosexual hobo
i mean fuck you all go down hell
294:卵の名無しさん
18/11/20 17:14:24.57 +LTJHbMS.net
ようやくデバッグできた。
> state=t0
> while(!is.goal(.stack[1,])){
+ (p=pop())
+ (tr=transfer(p))
+ (.checked <<- unique(rbind(p,.checked))) # add to .checked GLOBELY
+ push(tr)
+ (.stack)
+ if(!is.null(transfer(.stack[1,]))) state=rbind(state,.stack[1,])
+ }
> rownames(state)=NULL
> colnames(state)=c(Amax,Bmax,Cmax)
> state
10 7 3
[1,] 10 0 0
[2,] 3 7 0
[3,] 3 4 3
[4,] 6 4 0
[5,] 6 1 3
[6,] 9 1 0
[7,] 9 0 1
[8,] 2 7 1
[9,] 2 5 3
[10,] 5 5 0
295:卵の名無しさん
18/11/20 17:15:16.68 +LTJHbMS.net
目的のノードを見つけたら終了する仕様だから、最短かどうかはわからないなぁ。
296:卵の名無しさん
18/11/20 17:21:50.40 cc4OhAKi.net
仕事しないとなぁ
297:卵の名無しさん
18/11/20 17:53:04.65 3jy0dpIg.net
>>264
>>251
んで、あんたどこ卒?
きっと凄いとこ出てますね、と言われるぞw
298:卵の名無しさん
18/11/20 18:23:06.98 cc4OhAKi.net
時給の良い仕事ないかなぁ?
299:卵の名無しさん
18/11/20 18:44:46.44 cc4OhAKi.net
ハローワークで警備の仕事があるなぁ。
300:卵の名無しさん
18/11/20 19:45:03.72 +LTJHbMS.net
# 問題 : 7 リットルと 3 リットルの容器を使って 5 リットルの水を測るにはどうすればいい?
> state
7 3
[1,] 0 0
[2,] 7 0
[3,] 4 3
[4,] 4 0
[5,] 1 3
[6,] 1 0
[7,] 0 1
[8,] 7 1
[9,] 5 3
[10,] 5 0
301:卵の名無しさん
18/11/20 20:18:02.67 HF+OgDBw.net
Prudence, indeed, will dictate that "uraguchi" long established cannot be changed for light and transient causes;
and accordingly all experience has shown, that BMS are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms from which they can pursue profit.
But when a long train of misbehavior and misconduct , showing invariably the same Imbecility evinces a design to reveal themselves as absolute Bona Fide Moron ,
it is their right, it is their duty, to expel such "uraguchi", and to provide new guards for their future security.
302:卵の名無しさん
18/11/20 22:25:53.92 cc4OhAKi.net
人間関係のない時給の良い仕事はないかなぁ?いじめられるからなぁ
303:卵の名無しさん
18/11/20 22:27:11.31 D0iJ9Tsc.net
It is common knowledge among doctors and patients that Do-Teihen(exclusively bottom-leveled medical school) graduates mean morons who bought their way to Gachi'Ura(currently called by themselves)
According to the experience of entrance exam to medical school in the era of Showa, when the sense of discrimination against
privately-founded medical schools were more intense than it is now,
all such schools but for Keio had been so compared to some specialized institution for educable mentally retarded kids that nobody but imbecile successors of physicians in private practice had applied for admission.
There had been NOT a single classmate who chose willingly against his/her common sense to go to the Do-Teihen(exclusively bottom-leveled medical school, currently also known as Gachi'Ura),
which would have cost outrageous money and its graduates are destined to be called Uraguchi morons who bought thier way into the Do-Teihen, by thier colleagues and even by thier own clients.
Although people won't call them names to their face,
certain 80-90% people of about my age have been yet scorning and sneering at Uraguchi graduates, speaking in the back of our mind,
" Uraguchi morons shall not behave like somebody."
We never speak out face to face in real life.
304:卵の名無しさん
18/11/20 22:32:57.27 cc4OhAKi.net
仕事ください
305:卵の名無しさん
18/11/20 22:39:03.37 cc4OhAKi.net
なんの取り柄もない私に仕事をください
306:卵の名無しさん
18/11/20 22:41:23.23 cc4OhAKi.net
なんかの資格があったらなぁ 仕事がないなぁ 今になって悔やんでしまう
307:卵の名無しさん
18/11/20 22:48:29.81 cc4OhAKi.net
金がない!
308:卵の名無しさん
18/11/20 22:51:11.25 cc4OhAKi.net
もっと金になる勉強をすべきだった 仕事がないなぁ
309:卵の名無しさん
18/11/20 22:57:18.11 cc4OhAKi.net
このまま 社会に出ずに 人生が終わってしまうのか?なんだったんだろう俺の人生は?
310:卵の名無しさん
18/11/20 23:39:20.88 cc4OhAKi.net
明日 また ハローワーク行こう!
311:卵の名無しさん
18/11/21 09:42:48.41 Jctp5Wds.net
>268-269のバグを指摘できていたら見直すのだが
底辺学力でできるのは>197のような漢字の誤変換だけ。
312:卵の名無しさん
18/11/21 12:38:48.27 m3dnATiO.net
ド底辺スレの定期上げ
313:卵の名無しさん
18/11/21 13:50:41.23 cCF4eIpe.net
じゃ、定期あげ
314:卵の名無しさん
18/11/21 15:05:19.22 UV5R2p03.net
>>277
幅優先探索だとこんな感じだな。
.que <<- t(as.matrix(t0))
transfer(c(0,0)) # 70 03
transfer(c(7,0)) # 43 73
transfer(c(4,3)) # 40
transfer(c(4,0)) # 13
transfer(c(1,3)) #10
transfer(c(1,0)) #01
transfer(c(0,1)) #71
transfer(c(7,1))#53
transfer(c(5,3))#50
transfer(c(7,3)) # NULL
transfer(c(0,3)) # 30
transfer(c(3,0)) # 33
transfer(c(3,3)) # 60
transfer(c(6,0)) # 63
transfer(c(6,3)) # 72
transfer(c(7,2)) # 02
transfer(c(0,2))# 10
transfer(c(2,0)) #23
transfer(c(2,3))#50
#
315:卵の名無しさん
18/11/21 20:50:08.75 5Xwsg5oK.net
It is common knowledge among doctors and patients that Do-Teihen(exclusively bottom-leveled medical school) graduates mean morons who bought their way to Gachi'Ura(currently called by themselves)
According to the experience of entrance exam to medical school in the era of Showa, when the sense of discrimination against
privately-founded medical schools were more intense than it is now,
all such schools but for Keio had been so compared to some specialized institution for educable mentally retarded kids that nobody but imbecile successors of physicians in private practice had applied for admission.
There had been NOT a single classmate who chose willingly against his/her common sense to go to the Do-Teihen(exclusively bottom-leveled medical school, currently also known as Gachi'Ura),
which would have cost outrageous money and its graduates are destined to be called Uraguchi morons who bought thier way into the Do-Teihen, by thier colleagues and even by thier own clients.
Although people won't call them names to their face,
certain 80-90% people of about my age have been yet scorning and sneering at Uraguchi graduates, speaking in the back of our mind,
" Uraguchi morons shall not behave like somebody."
We never speak out face to face in real life.
316:卵の名無しさん
18/11/21 21:27:39.69 m3dnATiO.net
非医師の人たちへむけて 今日の1曲
愛国戦隊大日本
317:卵の名無しさん
18/11/21 22:11:11.00 UV5R2p03.net
rm(list=ls())
graphics.off()
dlevy <- function (x,m,c) sqrt(c/2/pi)*exp(-c/2/(x-m))/(x-m)^3/2
set.seed(123)
dat=rgamma(1e4,1)
hist(dat,freq=F) ; summary(dat)
x=density(dat)$x ; y=density(dat)$y
lines(x,y)
f<-function(mc){
m=mc[1];c=mc[2]
sum((y-dlevy(x,m,c))^2)
}
(mc=optim(c(0,1),f, method='N')$par)
curve(dlevy(x,mc[1],mc[2]),add=T,col=2)
318:卵の名無しさん
18/11/21 22:12:01.19 UV5R2p03.net
>>294
これへの回答
あるデータ群に対して、確率密度関数のパラメータをフィッティングさせる方法ってないですか?
ちなみに、フィッティングさせたいのはレブィフライト確率密度関数です。
319:卵の名無しさん
18/11/21 22:46:03.55 uT58TBet.net
量子力学は?www
320:卵の名無しさん
18/11/21 23:46:11.38 tbX2fKWG.net
ボーズ粒子の実態は確率
321:卵の名無しさん
18/11/21 23:59:20.99 uT58TBet.net
国試諦めたんだねw
322:卵の名無しさん
18/11/22 00:06:46.65 jXQTlLg4.net
>>172
残念ながら、事務員じゃないのね。
こういうの書いているの俺な。
内視鏡検査について Part.2 [無断転載禁止](c)2ch.net
スレリンク(hosp板:875番)
875 名前:卵の名無しさん[sage] 投稿日:2018/11/14(水) 20:29:50.55 ID:lTkyjX2F
>>874
俺は肝弯より脾損傷の方がやだね。
開腹手術での受動時の経験と透視でのファイバーの動きを見る機会があるとこんなに可動性あったっけとか思う。
幸い脾損傷の経験はないけど、検査後に左肩への放散痛があったら疑わなくてはと思っている。
323:卵の名無しさん
18/11/22 00:32:25.51 by7Pc9VA.net
Prudence, indeed, will dictate that "uraguchi" long established cannot be changed for light and transient causes;
and accordingly all experience has shown, that BMS are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms from which they can pursue profit.
But when a long train of misbehavior and misconduct , showing invariably the same Imbecility evinces a design to reveal themselves as absolute Bona Fide Moron ,
it is their right, it is their duty, to expel such "uraguchi", and to provide new guards for their future security.
324:卵の名無しさん
18/11/22 19:48:22.68 EhyhVVko.net
30L 17L 13L
[1,] 30 0 0
[2,] 13 17 0
[3,] 13 4 13
[4,] 26 4 0
[5,] 26 0 4
[6,] 9 17 4
[7,] 9 8 13
[8,] 22 8 0
[9,] 22 0 8
[10,] 5 17 8
[11,] 5 12 13
[12,] 18 12 0
[13,] 18 0 12
[14,] 1 17 12
[15,] 1 16 13
[16,] 14 16 0
[17,] 14 3 13
[18,] 27 3 0
[19,] 27 0 3
[20,] 10 17 3
[21,] 10 7 13
[22,] 23 7 0
[23,] 23 0 7
[24,] 6 17 7
[25,] 6 11 13
[26,] 19 11 0
[27,] 19 0 11
[28,] 2 17 11
[29,] 2 15 13
[30,] 15 15 0
325:卵の名無しさん
18/11/22 22:15:42.49 jXQTlLg4.net
>>300
it is their right, it is their duty, to expel such "uraguchi", and to provide new guards for their future security.
この通り、実践すべき!
裏口入学の学生を除籍処分にしないかぎり、信頼の回復はないね。つまり、いつまで経ってもシリツ医大卒=裏口バカと汚名は拭えない。シリツ出身者こそ、裏口入学に厳しい処分せよを訴えるべき。
裏口入学医師の免許剥奪を!の国民運動の先頭に立てばよいぞ。
僕も裏口入学とか、言ってたら信頼の回復はない。
326:卵の名無しさん
18/11/22 22:49:22.84 s6txpOAx.net
Prudence, indeed, will dictate that "uraguchi" long established cannot be changed for light and transient causes;
and accordingly all experience has shown, that BMS are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms from which they can pursue profit.
But when a long train of misbehavior and misconduct , showing invariably the same Imbecility evinces a design to reveal themselves as absolute Bona Fide Moron ,
it is their right, it is their duty, to expel such "uraguchi", and to provide new guards for their future security.
327:卵の名無しさん
18/11/23 07:36:18.66 t+QLwcrH.net
main = print $ length [(x,y)|x<-[-100..100],y<-[-100..100],7*x+3*y==5,abs x + abs y <= 100]
328:卵の名無しさん
18/11/23 07:45:24.89 Qqz1atCA.net
統計の話をしよう!!
サルを何千万匹殺しても無問題!!ただし、共産主義の香りづけをすれば
329:卵の名無しさん
18/11/23 08:10:20.25 QoVjbOvp.net
for x in range(-100,101):
for y in range(-100,101):
if(7*x+3*y==5 and x+y<=100):
print("(" + str(x) + "," + str(y) + ")")
330:卵の名無しさん
18/11/23 08:27:21.45 QoVjbOvp.net
>>306 debugged
for x in range(-100,101):
for y in range(-100,101):
if(7*x+3*y==5 and abs(x)+abs(y)<=100):
print("(" + str(x) + "," + str(y) + ")")
331:卵の名無しさん
18/11/23 08:28:05.53 QoVjbOvp.net
R
gr=expand.grid(-100:100,-100:100)
f=function(x,y) 7*x+3*y==5 & abs(x)+abs(y)<=100
sum(mapply(f,gr[,1],gr[,2]))
332:卵の名無しさん
18/11/23 08:29:57.03 QoVjbOvp.net
R
re=NULL
for(x in -100:100){
for(y in -100:100){
if(7*x+3*y==5 & abs(x)+abs(y)<=100){
re=rbind(re,(c(x,y)))}}}
nrow(re)
333:卵の名無しさん
18/11/23 10:32:55.82 QoVjbOvp.net
# Python
a=7; b=3; c=5
n=100
xy = []
for x in range(-n,n+1):
for y in range(-n,n+1):
if(a*x+b*y==c and abs(x)+abs(y)<=n):
xy.append([x,y])
print (len(xy))
print (xy)
334:卵の名無しさん
18/11/23 18:35:27.02 QoVjbOvp.net
# ある医院に1時間あたり平均5人の患者が来院し、その人数の分布はポアソン分布にしたがうとする。
# 1時間あたりの平均診療人数は6人(平均診療時間10分)で、一人あたりの診療時間は指数分布に従うとする。
# 診察までの平均の待ち時間は何分か?
λ=5
μ=6
N=1e5
sum(rpois(N,λ)*rexp(N,μ))/N
w8t=replicate(1e3,sum(rpois(N,λ)*rexp(N,μ))/N)*60
summary(w8t)
シミュレーション結果も
> summary(w8t)
Min. 1st Qu. Median Mean 3rd Qu. Max.
49.33 49.88 50.01 50.01 50.14 50.61
理論値通りだな。
335:卵の名無しさん
18/11/23 19:10:32.75 QoVjbOvp.net
URLリンク(www.f.waseda.jp)
336:卵の名無しさん
18/11/23 22:53:03.27 t+QLwcrH.net
1時間に平均値5人の患者がくる医院で
次の患者がくるまでの時間が10分以内である確率と
30分以上である確率はいくらか?
337:卵の名無しさん
18/11/24 01:25:40.73 5hOk6q/8.net
It is common knowledge among doctors and patients that Do-Teihen(exclusively bottom-leveled medical school) graduates mean morons who bought their way to Gachi'Ura(currently called by themselves)
According to the experience of entrance exam to medical school in the era of Showa, when the sense of discrimination against
privately-founded medical schools were more intense than it is now,
all such schools but for Keio had been so compared to some specialized institution for educable mentally retarded kids that nobody but imbecile successors of physicians in private practice had applied for admission.
There had been NOT a single classmate who chose willingly against his/her common sense to go to the Do-Teihen(exclusively bottom-leveled medical school, currently also known as Gachi'Ura),
which would have cost outrageous money and its graduates are destined to be called Uraguchi morons who bought thier way into the Do-Teihen, by thier colleagues and even by thier own clients.
Although people won't call them names to their face,
certain 80-90% people of about my age have been yet scorning and sneering at Uraguchi graduates, speaking in the back of our mind,
" Uraguchi morons shall not behave like somebody."
We never speak out face to face in real life.
338:卵の名無しさん
18/11/24 11:07:29.76 wOJ88Y8z.net
deli <- function(course=90,hr=15,call=5){
# average 5 calls during 15 hours with 90 min delivery
k=call/hr
integrate(function(x)k*exp(-k*x),0,course/60)$value
}
vd=Vectorize(deli)
dc=0:180
plot(dc,vd(dc),type='l',lw
339:d=2,bty='l', xlab='Deli.course(min)',ylab='Prob of call')
340:卵の名無しさん
18/11/24 11:42:17.66 wOJ88Y8z.net
deli <- function(course=90,hr=15,call=5){
# average 5 calls during 15 hours with 90 min delivery
k=call/hr
integrate(function(x)k*exp(-k*x),0,course/60)$value
}
vd=Vectorize(deli)
dc=0:180
plot(dc,vd(dc),type='l',lwd=2,bty='l',
xlab='Deli.course(min)',ylab='Prob of call')
uniroot(function(x,u0=0.5)vd(x)-u0,c(0,180))$root
DH <- function(course=90,hr=15,call=5){
k=call/hr
x=course/60
1-exp(-k*x)
}
p2c=function(p,k=5/15) (-60*log(1-p)/k)
curve(p2c(x),bty='l',xlab='p',ylab='course(min)')
341:卵の名無しさん
18/11/24 13:12:14.88 owOvYQ4F.net
このスレの自称医者のほんまもん医師確率は?
検索した知識で医者を騙りMath
スレリンク(hosp板)
342:卵の名無しさん
18/11/24 14:11:47.95 4kuDQ9FR.net
こういうのを見ればわかるだろうに
URLリンク(egg.2ch.net)
>>878
>875は脾弯越えの操作でpullする時の話。
URLリンク(i.imgur.com)
馬鹿なのか、馬鹿じゃなきゃ、これにでも答えてみ!
1時間に平均値5人の患者がくる医院で
次の患者がくるまでの時間が10分以内である確率と
30分以上である確率はいくらか?
343:卵の名無しさん
18/11/24 14:18:05.42 4kuDQ9FR.net
>>316
これ用のスクリプト
18時から翌朝9時までの15時間の当直帯に平均5回のコールがある。当直室にデリヘル90分コースで呼んだとすると
デリヘル滞在中にコールされる確率はいくらか?
344:卵の名無しさん
18/11/24 16:38:49.21 wOJ88Y8z.net
two sample poisson test
パッケージでp値が異なるのでソースを確認。
X=2 ; Y=9
N=17877;M=16660
P=N/(N+M)
poisson.test(c(X,Y),c(N,M))$p.value
binom.test(X,X+Y,P)$p.value
library(rateratio.test)
rateratio.test(c(X,Y),c(N,M))$p.value
2*min(binom.test(X,X+Y,P,alt='l')$p.value,
binom.test(X,X+Y,P,alt='g')$p.value)
345:卵の名無しさん
18/11/24 17:00:00.40 wOJ88Y8z.net
救急車搬送数が日勤の8時間で0、夜勤の16時間で5であったときに
夜勤帯の方が時間あたり救急搬送が多いと言えるか?
救急車搬送数はポアソン分布に従うとして有意水準5%で検定せよ。
日勤0のとき夜勤で何台以上の搬送があれば有意と言えるか?
rm(list=ls())
library(rateratio.test)
poisson.test(c(0,5),c(8,16))$p.value
rateratio.test(c(0,5),c(8,16))$p.value
x=0:20
y=sapply(x,function(x) poisson.test(c(1,x),c(8,16))$p.value)
plot(x,y,bty='l')
x[which.max(y<0.05)]
y=sapply(x,function(x) rateratio.test(c(1,x),c(8,16))$p.value)
plot(x,y,bty='l')
x[which.max(y<0.05)]
346:卵の名無しさん
18/11/24 17:01:06.35 wOJ88Y8z.net
>>321
日勤と夜勤でお看取り件数に差があるかも検定できるな。
347:卵の名無しさん
18/11/24 20:15:42.14 mGu7MkO8.net
Last but not least, three laws of Do-Teihen(lowest-tier) Medical School, currently called Gachi'Ura by its graduates.
It is not the bottom medical school but its enrollee that is despicable, which deserves to be called a bona fide moron beyond redemption.
The graduates of Do-Teihen are so ashamed that none of them dare to mention their own alma mater they had gone through.
The Do-Teihen graduates are so ashamed of having bought their way into the exclusively lowest-tier medical school
that they tend to call a genuine doctor a charlatan who elucidates their imbecility.
348:卵の名無しさん
18/11/24 20:20:35.00 4kuDQ9FR.net
f = function(A=1,B=2,N=100){
p=0
for (i in 1:N){
for(j in 0:(i-1)){
p=p+dpois(i,A)*dpois(j,B)}}
p
}
f()
f(1,3)
349:卵の名無しさん
18/11/24 20:31:46.81 4kuDQ9FR.net
soccer= function(A=1,B=2,N=1000){
pa=pd=0
for (i in 1:N){
for(j in 0:(i-1)){
pa=pa+dpois(i,A)*dpois(j,B)
pd=pd+dpois(i,A)*dpois(i,B)
}}
c(Awin=pa,Bwin=1-pa-pd,Draw=pd)
}
soccer()
350:卵の名無しさん
18/11/24 20:39:49.49 4kuDQ9FR.net
>>325
サッカーの勝敗確率
351:卵の名無しさん
18/11/24 20:47:34.09 4kuDQ9FR.net
>>326 debugged
soccer= function(A=5,B=10,N=100){
pa=pd=0
for (i in 1:N){
pd=pd+dpois(i,A)*dpois(i,B)
for(j in 0:(i-1)){
pa=pa+dpois(i,A)*dpois(j,B)
}}
c(Awin=pa,Bwin=1-pa-pd,Draw=pd)
}
352:卵の名無しさん
18/11/25 02:02:43.79 JOuyBVrN.net
ポイント乞食ご用達の楽天銀行に貯金していて、
楽天に口座凍結されて無一文になった世田谷のS君 元気??
一応 開業医なのに楽天銀行って
慶応のOBらが泣いてるよww
353:卵の名無しさん
18/11/25 08:07:10.02 Vr8P87vG.net
マルコフの確認
(pexp(2+4,1/3)-pexp(2,1/3))/(1-pexp(2,1/3))
pexp(4,1/3)
354:卵の名無しさん
18/11/25 09:08:24.99 B7CJHmdM.net
k=15
a=20
b=30
(pexp(a+b,1/k)-pexp(a,1/k))/(1-pexp(a,1/k))
pexp(b,1/k)
355:卵の名無しさん
18/11/25 12:02:52.13 9toFqzz4.net
k=15
a=20
b=30
y=function(x) 1-exp(-x/k)
(y(a+b)-y(a))/(1-y(a))
y(b)
356:卵の名無しさん
18/11/25 12:19:14.40 9toFqzz4.net
>>327
debugged again
soccer= function(A=5,B=10,N=100){
if(A>B){
tmp=A
A=B
B=tmp
}
pa=pd=0
for (i in 1:N){
pd=pd+dpois(i,A)*dpois(i,B)
for(j in 0:(i-1)){
pa=pa+dpois(i,A)*dpois(j,B)
}}
c(Upset=pa,Ordinal=1-pa-pd,Draw=pd)
}
357:卵の名無しさん
18/11/25 12:22:57.28 9toFqzz4.net
debugged with equivalent routine
soccer= function(A=5,B=10,N=100){
if(A==B) return(c(c(Upset=0,Ordinal=0,Draw=1)))
if(A>B){
tmp=A
A=B
B=tmp
}
pa=pd=0
for (i in 1:N){
pd=pd+dpois(i,A)*dpois(i,B)
for(j in 0:(i-1)){
pa=pa+dpois(i,A)*dpois(j,B)
}}
return(c(Upset=pa,Ordinal=1-pa-pd,Draw=pd))
}
358:卵の名無しさん
18/11/25 12:45:46.33 9toFqzz4.net
>>333
if(A==B) return(c(c(Upset=0,Ordinal=0,Draw=1)))
は不要だな。
359:卵の名無しさん
18/11/25 12:49:45.63 9toFqzz4.net
サッカーの特典はポアソン分布に従うとされている。
PK戦はなしで考える。
平均得点2点のチームAと平均得点3点のチームBが戦ったとき
Aが勝つ確率、Bが勝つ確率 および 引き分けの確率を求めよ。
得点の上限Nを100として計算。
soccer= function(A=2,B=3,N=100){
if(A>B){
tmp=A
A=B
B=tmp
}
pa=pd=0
for (i in 1:N){
pd=pd+dpois(i,A)*dpois(i,B)
for(j in 0:(i-1)){
pa=pa+dpois(i,A)*dpois(j,B)
}}
return(c(Upset=pa,Ordinal=1-pa-pd,Draw=pd))
}
> soccer(2,3)
Upset Ordinal Draw
0.2469887 0.5920274 0.1609839
360:卵の名無しさん
18/11/25 12:52:38.63 9toFqzz4.net
>>335
1億回シミュレーションしてみた。
> sim <- function(A=2,B=3,K=1e8) {
+ a=rpois(K,A) ; b=rpois(K,B)
+ c(Upset=mean(a>b),Ordinal=mean(a<b),Draw=mean(a==b))
+ }
> sim()
Upset Ordinal Draw
0.2470561 0.5851947 0.1677492
ほぼ同じした結果がでて、気分が( ・∀・)イイ!!
361:卵の名無しさん
18/11/25 14:41:03.20 9toFqzz4.net
λ0=3/60 # 平均到達率
μ0=4/60 # 平均サービス率 1/μ0 : 平均サービス時間
(ρ0=λ0/μ0) # 平均トラフィック密度
# □ ← ○○○○○○
ρ0/(1-ρ0)*(1/μ0)
ρ0/(1-ρ0)*(1/μ0)+1/μ0
# □ ← ○○○
# □ ← ○○○
(λ1=λ0/2)
(ρ1=λ1/μ0)
ρ1/(1-ρ1)*(1/μ0)
ρ1/(1-ρ1)*(1/μ0)+(1/μ0)
# □ ←
# \
# ○○○○○
# /
# □ ←
(μ2=2*μ0)
(ρ2=λ0/μ2)
2*ρ2^3/(1-ρ2^2) * (1/μ0)
2*ρ2^3/(1-ρ2^2) * (1/μ0) + (1/μ0)
# □□ ← ○○○○○○
(μ3=2*μ0)
(ρ3=λ0/μ3)
ρ3/(1-ρ3)*(1/μ3)
ρ3/(1-ρ3)*(1/μ3) + (1/μ3)