臨床統計もおもしろいですよ、その2at HOSP
臨床統計もおもしろいですよ、その2 - 暇つぶし2ch61:卵の名無しさん
18/11/07 21:22:13.74 s+v4AjoX.net
グリーンねえさん

62:卵の名無しさん
18/11/08 07:40:30.60 PGJy3ILP.net
>>59
## p : probability of head at coin flip
seqNp <- function(N=100,K=5,p=0.5){
if(N==K) return(p^K)
q=1-p
a=numeric(N) # a(n)=P0(n)/p^n , P0(n)=a(n)*p^n
for(i in 1:K) a[i]=q/p^i # P0(i)=q
for(i in K:(N-1)){ # recursive formula
a[i+1]=0
for(j in 0:(K-1)){
a[i+1]=(a[i+1]+a[i-j])
}
a[i+1]=q/p*a[i+1]
}
P0=numeric(N)
for(i in 1:N) P0[i]=a[i]*p^i # P0(n)=a(n)*p^n
MP=matrix(rep(NA,N*K),ncol=K)
colnames(MP)=paste0('P',0:(K-1))
MP[,'P0']=P0
MP[1,'P1']=p
for(i in (K-2):K) MP[1,i]=0
for(k in 2:K){
for(i in 1:(N-1)) MP[i+1,k]=p*MP[i,k-1]
} # Pk(n+1)=p*P(k-1)(n)
ret=1-apply(MP,1,sum)
ret[N]
}
seqNp(N=100,K=4,p=0.1)

63:卵の名無しさん
18/11/08 15:06:24.25 PGJy3ILP.net
m=100
ps=[(a,b,c)|a<-[1..m],b<-[a..floor(m^2/2-1/2)],c<-[b..2*b],a^2+b^2==c^2]
ps !! 99
[(a,b,c)|a<-[1..m],b<-[a..floor(a^2/2-1/2)],c<-[b..floor(sqrt(a^2+b^2))],a^2+b^2==c^2]
[(a,b,c)|a<-[1..m],b<-[a..floor(m^2/2-1/2)],let c = sqrt(a^2+b^2), fromIntegral(floor(c))==c]

64:卵の名無しさん
18/11/08 15:07:58.80 PGJy3ILP.net
a^2+b^2=c^2を満たす3つの整数(a<b<c)
の組み合わせのうち(3,4,5)から数えて7番目は何になるかという問題がわかりません
答:(9,40,41)
応用問題:
a^2+b^2=c^2を満たす3つの整数(a<b<c)
の組み合わせのうち(3,4,5)から数えて100番目は何になるか 👀
Rock54: Caution(BBR-MD5:1341adc37120578f18dba9451e6c8c3b)


65:卵の名無しさん
18/11/08 16:45:02.14 PGJy3ILP.net
pitagoras <- function(A){
pita=NULL
for(a in 3:A){
B=floor(a^2/2-1/2)
for(b in a:B){
c=a^2+b^2
if(floor(sqrt(c)) == sqrt(c) ){
pita=rbind(pita,c(a,b,sqrt(c)))
}
}
}
colnames(pita)=letters[1:3]
return(pita)
}
pita=pitagoras(999)
saveRDS(pita,'pita999.rds')
pita[1,]
pita[7,]
pita[77,]
pita[777,]
pita[1000,]
tail(pita)

66:卵の名無しさん
18/11/08 20:38:27.74 cpzz/2HM.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.

67:卵の名無しさん
18/11/08 21:27:55.58 PVj0UwaU.net
Hutanari Ti〇po

68:卵の名無しさん
18/11/08 22:34:40.76 klK7Dgwj.net
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.
ド底辺特殊シリツ医大卒は裏口入学の負い目から裏口馬鹿を暴く人間を偽医者扱いしたがる。

69:卵の名無しさん
18/11/08 22:35:56.08 klK7Dgwj.net
第一法則の英文の意図的な文法誤謬を指摘してみ!

70:卵の名無しさん
18/11/08 22:37:45.15 JqNfxHqE.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.

71:卵の名無しさん
18/11/08 23:56:13.79 5CXia8DJ.net
Raise the hem of the white coat with a white coat appearing naked.
Put half of Voltaren in the anus
Peel the white eyes while hitting your ass with a bang bang with both hands
Shouts that "Utopia is surprisingly surprised! It is surprisingly utopian!
Raise the buttocks and fire the Voltaren rocket to the patient.

72:卵の名無しさん
18/11/09 07:26:09.53 guOlTCed.net
(mean(replicate(1e4,any(diff(cumsum(rbinom(100,1,0.5)),5)==5))))
[1] 0.8089
>
> (mean(replicate(1e4,with(rle(rbinom(100,1,0.5)), max(lengths[which(values=
<rle(rbinom(100,1,0.5)), max(lengths[which(values== 1)])>=5))))
[1] 0.8117
>

73:卵の名無しさん
18/11/09 07:26:39.67 guOlTCed.net
(mean(replicate(1e4,any(diff(cumsum(rbinom(100,1,0.5)),5)==5))))
[1] 0.8089
>
> (mean(replicate(1e4,with(rle(rbinom(100,1,0.5)), max(lengths[which(values=
<rle(rbinom(100,1,0.5)), max(lengths[which(values==1)])>=5))))
[1] 0.8117

74:卵の名無しさん
18/11/09 07:27:42.12 guOlTCed.net
実行速度
system.time(mean(replicate(1e4,any(diff(cumsum(rbinom(100,1,0.5)),5)==5))))
user system elapsed
1.840 0.000 1.875
>
> system.time(mean(replicate(1e4,with(rle(rbinom(100,1,0.5)), max(lengths[wh
<e(1e4,with(rle(rbinom(100,1,0.5)), max(lengths[whi ch(values==1)])>=5))))
user system elapsed
4.440 0.000 4.631

75:卵の名無しさん
18/11/09 10:39:09.83 mj0MZvbh.net
「お゙ぉおォおん、お゙ぉおォおんにいぃひゃぁん、大漁らったのぉおお?」
「ぁあああ あぉぁあああ あぉ、大漁らったよお゛お゛お゛ぉ」 「ぁあああ あぉぁぁ゛ぁ゛ぁぁ゛ぁ゛ぁぁ゛ぁ゛ぁあああ あぉぁぁ゛ぁ゛しゅごいぃのぉおおょぉぉぅぃぃっよぉおお゙いぃぃいぃぃ!、、にゃ、にゃにが、、ハァハァにゃにが捕れたのぉおお?」
乳首を舌れやしゃしく舐めにゃがらオレは答えたのぉおお
「…鯛とか、、、ヒラメがいぃっぱいぃ捕れたよお゛お゛お゛ぉ」
セリフを聞き、オジサンはびくんびくんと身体をひきちゅらせたのぉおお
「はっ!はぁぁ゛ぁ゛ぁぁ゛ぁ゛ぁぁ゛ぁ゛ぁあああ あぉんっ!イ、イサキは?イサキは、と、取れたのぉおお??」
「ぁあああ あぉぁあああ あぉ。れかいぃイサキが取れたよお゛お゛お゛ぉ。今年一番のぉおお大漁ら。」
「大漁っ!!イサキぃぃ!!お゙ぉおォおんにいぃひゃぁんかっこいぃぃぃっよぉおお゙いぃぃぃっよぉおお゙ぃぃぃいぃ ぃくううううう!」

76:卵の名無しさん
18/11/09 13:39:50.75 wRJjRrMD.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.

77:卵の名無しさん
18/11/09 14:43:04.66 mj0MZvbh.net
"Oo, ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo!
"Aaaaaaaaaaaa, big fish caught you" "Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa "Sho-o-no-okoi, oh yeah, oh yeah, yeah, yeah, yeah, ha haa caught up for ha ha?"
I was licking a nipple and talking lolly I answered yao
"... Sea breams ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
Listening to the dialogue, Ojisan pulls him body


78:with his boyfriend "Ha ha haaaaaaaaaaaaaaaaa, Isaki, Isaki, can you get it?" "Aaaaaaaaaaaa ... I could have picked out a good Isaki, the biggest fishes of the year, this year." "Big fishing !! Isaki !! Ooohoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo! "



79:卵の名無しさん
18/11/09 14:47:27.17 fYz4ML3G.net
import numpy as np
from fractions import Fraction
# URLリンク(tpcg.io)
def seqNp(N = 10,K = 5,p = 0.5):
if N == K: return p**K
q = 1-p
a = [0]*(N+1)
for i in range(1,K+1):
a[i] = q/(p**(i))
for i in range(K,N):
a[i+1] = 0
for j in range(0,K):
a[i+1] = a[i+1]+a[i-j]
a[i+1] = q/p*a[i+1]
P0=[0]*(N+1)
for i in range(1,N+1):
P0[i] = a[i]*p**i
del P0[0]
MP = np.zeros([K,N])
MP[0] = P0
MP[1][0] = p
for i in range(K-3,K):
MP[i][0] = 0
for k in range(1,K):
for i in range(0,N-1):
MP[k][i+1] = p*MP[k-1][i]
re = 1-np.sum(MP,axis=0)
print(Fraction(re[N-1]))
print(re[N-1])

80:卵の名無しさん
18/11/09 14:54:20.70 fYz4ML3G.net
RからPythonへの移植がようやく終わった。
確率が分数で表示されるようになった。
配列はRは1からPythonは0から始まるのでその調整に手間取った。
URLリンク(tpcg.io)

81:卵の名無しさん
18/11/09 16:24:27.33 fYz4ML3G.net
"""
Pk(n) (k=0,1,2,3,4)を途中、5連続して表が出ていなくて
最後のk回は連続して表が出ている確率とする。
P0(1)=P1(1)=1/2、P2(1)=P3(1)=P4(1)=0
Pk(n+1)=1/2*P(k-1)(n)
P0(n+1)=1/2*{P0(n)+P1(n)+P2(n)+P3(n)+P4(n)}
=1/2*{P0(n)+1/2*P0(n-1)+1/4*P0(n-2)+1/8*P0(n-3)+1/16*P0(n-4)}
P0(n)=a(n)/2^nとおいて
a(n+1)/2^(n+1)=1/2^(n+1){a(n)+a(n-1)+a(n-2)+a(n-3)+a(n-4)}
a(n+1)=a(n)+a(n-1)+a(n-2)+a(n-3)+a(n-4)
"""

82:卵の名無しさん
18/11/09 18:29:58.21 n6Zmr3Yp.net
We hold these truths to be self-evident, that all "uraguchi" are created retards,
That they are endowed by their creator with certain unalienable traits, that among these are sloth, mythomania, and the pursuit of imbecility.
That to rectify these traits, Bottom Medical Schools (BMS) are instituted for retards, deriving their just powers from what has been referred as the arbitrary donation of the parents of the rectified,
That whenever any form of the retards becomes destructive of rectification,
it is the right of the BMS to suspend or expel them, and to impose additional tuition laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect the profit of BMS .

83:卵の名無しさん
18/11/09 19:01:24.31 fYz4ML3G.net
# 全体N個中当たりS個、1個ずつ籤を引いて当たったらやめる.
# r個めが初めて当たりであったときSの信頼区間を推定するシミュレーション。
atari <- function(N,r,k=1e3){ # k: simlation times
f <- function(S,n=N){which.max(sample(c(rep(1,S),rep(0,n-S))))}
vf=Vectorize(f)
sim=replicate(k,vf(1:(N-r)))
s=which(sim==r)%%(N-r)
s[which(s==0)]=N-r
hist(s,freq=T,col='skyblue')
print(quantile(s,c(.025,.05,.50,.95,.975)))
print(HDInterval::hdi(s))
}
atari(100,3)

84:卵の名無しさん
18/11/09 19:07:22.92 fYz4ML3G.net
pdf2hdi <- function(pdf,xMIN=0,xMAX=1,cred=0.95){
nxx=1001
xx=seq(xMIN,xMAX,length=nxx)
xx=xx[-nxx]
xx=xx[-1]
xmin=xx[


85:1] xmax=xx[nxx-2] AUC=integrate(pdf,xmin,xmax)$value PDF=function(x)pdf(x)/AUC cdf <- function(x) integrate(PDF,xmin,x)$value ICDF <- function(x) uniroot(function(y) cdf(y)-x,c(xmin,xmax))$root hdi=HDInterval::hdi(ICDF,credMass=cred) print(c(hdi[1],hdi[2]),digits=5) invisible(ICDF) } # N個のクジでr個めで初めてあたった時のN個内の当たり数の推測 Atari <- function(N,r){ pmf <- function(x) ifelse(x>N-r+1,0,(1-x/N)^(r-1)*x/N) # dnbinom(r-1,1,x/N) ; dgeom(r-1,x/N) # curve((1-x/N)^(r-1)*x/N,0,N) AUC=integrate(pmf,0,N)$value pdf <- function(x) pmf(x)/AUC mode=optimise(pdf,c(0,N),maximum=TRUE)$maximum mean=integrate(function(x)x*pdf(x),0,N)$value cdf <- function(x) integrate(pdf,0,x)$value median=uniroot(function(x)cdf(x)-0.5,c(0,N))$root print(c(mode=mode,median=median,mean=mean)) pdf2hdi(pdf,0,N,cred=0.95) } Atari(100,3) Atari(100,30)



86:卵の名無しさん
18/11/09 20:27:50.16 n7vPLA8Y.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.

87:卵の名無しさん
18/11/09 21:35:35.51 guOlTCed.net
次の課題はこれだな。
コインを100回投げて表が連続した最大数が10であったとき
このコインの表がでる確率の95%信頼区間はいくらか?

88:卵の名無しさん
18/11/09 21:59:40.95 WU3o6hYa.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.

89:卵の名無しさん
18/11/09 22:34:31.28 fYz4ML3G.net
>>84
解析解は難しいけど、ニュートンラフソン法で数値解ならだせるな。
seq2pCI <- function(N,K){
vp=Vectorize(function(p)seqNp(N,K,p)-seqNp(N,K+1,p))
curve(vp(x),bty='l') ; abline(h=0.05,lty=3)
lwr=uniroot(function(x,u0=0.05) vp(x)-u0,c(0.01,0.7))$root
upr=uniroot(function(x,u0=0.05) vp(x)-u0,c(0.7,0.99))$root
c(lower=lwr,upper=upr)
}
seq2pCI(100,10)
> seq2pCI(100,10)
lower upper
0.5585921 0.8113441
英文コピペで荒らしているド底辺シリツ医大の裏口馬鹿には検算すらできんないだろうな。

90:卵の名無しさん
18/11/09 22:53:11.07 fYz4ML3G.net
>>86
呼び出す関数として、これが必要
seqNp <- function(N=100,K=5,p=0.5){
if(N==K) return(p^K)
q=1-p
a=numeric(N) # a(n)=P0(n)/p^n , P0(n)=a(n)*p^n
for(i in 1:K) a[i]=q/p^i # P0(i)=q
for(i in K:(N-1)){ # recursive formula
a[i+1]=0
for(j in 0:(K-1)){
a[i+1]=(a[i+1]+a[i-j])
}
a[i+1]=q/p*a[i+1]
}
P0=numeric(N)
for(i in 1:N) P0[i]=a[i]*p^i # P0(n)=a(n)*p^n
MP=matrix(rep(NA,N*K),ncol=K)
colnames(MP)=paste0('P',0:(K-1))
MP[,'P0']=P0
MP[1,'P1']=p
for(i in (K-2):K) MP[1,i]=0
for(k in 2:K){
for(i in 1:(N-1)) MP[i+1,k]=p*MP[i,k-1]
} # Pk(n+1)=p*P(k-1)(n)
ret=1-apply(MP,1,sum)
ret[N]
}
ここに上げておいた。
URLリンク(tpcg.io)

91:卵の名無しさん
18/11/10 00:19:47.42 Kp2aSERi.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.

92:卵の名無しさん
18/11/10 07:28:52.35 qmnilAbW.net
恵方巻き

93:卵の名無しさん
18/11/10 07:31:45.66 oGLeA9Hd.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.

94:卵の名無しさん
18/11/10 07:35:47.21 Gl2x1zZV.net
>>86
optimizeを使ってurirootの区間を自動設定に改善。
seq2pCI <- function(N,K,alpha=0.05){
vp=Vectorize(function(p)seqNp(N,K,p)-seqNp(N,K+1,p))
curve(vp(x),lwd=2,bty='l') ; abline(h=0.05,lty=3)
peak=optimize(vp,c(0,1),maximum=TRUE)$maximum
lwr=uniroot(function(x,u0=alpha) vp(x)-u0,c(0.01,peak))$root
upr=uniroot(function(x,u0=alpha) vp(x)-u0,c(peak,0.99))$root
c(lower=lwr,upper=upr)
}

95:卵の名無しさん
18/11/10 08:01:47.11 qmnilAbW.net
aiueo700

96:卵の名無しさん
18/11/10 10:46:19.21 MTRtacln.net
最大連続数を増やしてグラフ化
seq2pCI <- function(N,K,alpha=0.05,Print=T){
vp=Vectorize(function(p)seqNp(N,K,p)-seqNp(N,K+1,p))
if(Print){curve(vp(x),lwd=2,bty='l',xlab='Pr[head]',ylab=paste('Pr[max',K,'-head repetition]'))
abline(h=alpha,lty=3)}
peak=optimize(vp,c(0,1),maximum=TRUE)$maximum
mean=integrate(function(x)x*vp(x),0,1)$value/integrate(function(x)vp(x),0,1)$value
lwr=uniroot(function(x,u0=alpha) vp(x)-u0,c(0.01,peak))$root
upr=uniroot(function(x,u0=alpha) vp(x)-u0,c(peak,0.99))$root
c(lower=lwr,mean=mean,mode=peak,upper=upr)
}
seq2pCI(100,4,0.05,T)

vs=Vectorize(function(K)seq2pCI(N=100,K,alpha=0.05,Print=F))
y=vs(2:23)
head(y)
plot(2:23,y['mean',],bty='l',pch=19)
points(2:23,y['mode',],bty='l')

97:卵の名無しさん
18/11/10 14:12:44.30 u8wDSGVd.net
幼稚な事務員

98:卵の名無しさん
18/11/10 14:24:33.17 u8wDSGVd.net
Look to the sky, way up on high
There in the night stars are now right.
Eons have passed: now then at last
Prison walls break, Old Ones awake!
They will return: mankind will learn
New kinds of fear when they are here.
They will reclaim all in their name;
Hopes turn to black when they come back.
Ignorant fools, mankind now rules
Where they ruled then: it's theirs again
Stars brightly burning, boiling and churning
Bode a returning season of doom
Scary scary scary scary solstice
Very very very scary solstice

Up from the sea, from underground
Down from the sky, they're all around
They will return: mankind will learn
New kinds of fear when they are here

99:卵の名無しさん
18/11/10 15:50:53.19 Aj6PTVhz.net
>>435
確率密度関数が左右対象でないから、
QuontileでなくHDI(Highest Density Interval)での95%信頼区間をpdfからcdfの逆関数を作って算出してみる。
# pdfからcdfの逆関数を作ってHDIを表示
pdf2hdi <- function(pdf,xMIN=0,xMAX=1,cred=0.95){
nxx=1001
xx=seq(xMIN,xMAX,length=nxx)
xx=xx[-nxx]
xx=xx[-1]
xmin=xx[1]
xmax=xx[nxx-2]
AUC=integrate(pdf,xmin,xmax)$value
PDF=function(x)pdf(x)/AUC
cdf <- function(x) integrate(PDF,xmin,x)$value
ICDF <- function(x) uniroot(function(y) cdf(y)-x,c(xmin,xmax))$root
hdi=HDInterval::hdi(ICDF,credMass=cred)
c(hdi[1],hdi[2])
}

100:卵の名無しさん
18/11/10 15:51:14.92 Aj6PTVhz.net
seqNp <- function(N=100,K=5,p=0.5){
if(N==K) return(p^K)
q=1-p
a=numeric(N) # a(n)=P0(n)/p^n , P0(n)=a(n)*p^n
for(i in 1:K) a[i]=q/p^i # P0(i)=q
for(i in K:(N-1)){ # recursive formula
a[i+1]=0
for(j in 0:(K-1)){
a[i+1]=(a[i+1]+a[i-j])
}
a[i+1]=q/p*a[i+1]
}
P0=numeric(N)
for(i in 1:N) P0[i]=a[i]*p^i # P0(n)=a(n)*p^n
MP=matrix(rep(NA,N*K),ncol=K)
colnames(MP)=paste0('P',0:(K-1))
MP[,'P0']=P0
MP[1,'P1']=p
for(i in (K-2):K) MP[1,i]=0
for(k in 2:K){
for(i in 1:(N-1)) MP[i+1,k]=p*MP[i,k-1]
} # Pk(n+1)=p*P(k-1)(n)
ret=1-apply(MP,1,sum)
ret[N]
}

101:卵の名無しさん
18/11/10 15:52:05.14 Aj6PTVhz.net
2つのサブルーチンを定義してから、
# N試行で最大K回連続成功→成功確率pの期待値、最頻値と95%HDI
# max K out of N-trial to probability & CI
mKoN2pCI <- function(N=100 , K=4 , conf.level=0.95){
pmf=Vectorize(function(p)seqNp(N,K,p)-seqNp(N,K+1,p))
mode=optimize(pmf,c(0,1),maximum=TRUE)$maximum
auc=integrate(pmf,0,1)$value
pdf=function(x) pmf(x)/auc
mean=integrate(function(x)x*pdf(x),0,1)$value
curve(pdf(x),lwd=3,bty='l',xlab='Pr[head]',ylab='density')
lu=pdf2hdi(pdf,cred=conf.level)
curve(pdf(x),lu[1],lu[2],type='h',col='lightblue',add=T)
re=c(lu[1],mean=mean,mode=mode,lu[2])
print(re,digits=4)
invisible(re)
}
> mKoN2pCI(100,4)
lower mean mode upper
0.1747676 0.3692810 0.3728936 0.5604309
> seq2pCI(100,4,0.05,T)
lower mean mode upper
0.1662099 0.3692810 0.3728936 0.5685943
当然ながら、HDIの方が信頼区間幅が小さいのがみてとれる。

102:卵の名無しさん
18/11/10 15:59:25.71 Aj6PTVhz.net
とりあえず>84のプログラムは完成。

103:卵の名無しさん
18/11/10 18:18:24.26 eRQ4an/O.net
95%クオンタイルでの算出
# N試行で最大K回連続成功→成功確率pの期待値、最頻値と95% Quantile
# max K out of N-trial to probability & CIq
mKoN2pCIq <- function(N=100 , K=4 , alpha=0.05){
pmf=Vectorize(function(p)seqNp(N,K,p)-seqNp(N,K+1,p))
mode=optimize(pmf,c(0,1),maximum=TRUE)$maximum
auc=integrate(pmf,0,1)$value
pdf=function(x) pmf(x)/auc
curve(pdf(x),bty='l')
mean=integrate(function(x)x*pdf(x),0,1)$value
cdf=function(x) MASS::area(pdf,0,x)
vcdf=Vectorize(cdf)
lwr=uniroot(function(x)vcdf(x)-alpha/2,c(0,mode))$root
upr=uniroot(function(x)vcdf(x)-(1-alpha/2),c(mode,1))$root
c(lower=lwr,mean=mean,mode=mode,upper=upr)
}

> mKoN2pCI(100,4)[c(1,4)]
lower upper
0.1747676 0.5604309
> mKoN2pCIq(100,4)[c(1,4)]
lower upper
0.1748351 0.5605172
あまり、差はないなぁ。

104:卵の名無しさん
18/11/10 18:48:10.97 eRQ4an/O.net
# pdfからcdfの逆関数を作ってhdiを表示させて逆関数を返す
# 両端での演算を回避 ∫[0,1]は∫[1/nxxx,1-1/nxx]で計算
pdf2hdi <- function(pdf,xMIN=0,xMAX=1,cred=0.95,Print=TRUE,nxx=1001){
xx=seq(xMIN,xMAX,length=nxx)
xx=xx[-nxx]
xx=xx[-1]
xmin=xx[1]
xmax=xx[nxx-2]
AUC=integrate(pdf,xmin,xmax)$value
PDF=function(x)pdf(x)/AUC
cdf <- function(x) integrate(PDF,xmin,x)$value
ICDF <- function(x) uniroot(function(y) cdf(y)-x,c(xmin,xmax))$root
hdi=HDInterval::hdi(ICDF,credMass=cred)
print(c(hdi[1],hdi[2]),digits=5)
if(Print){
par(mfrow=c(3,1))
plot(xx,sapply(xx,PDF),main='pdf',type='h',xlab='x',ylab='Density',col='lightgreen')
legend('top',bty='n',legend=paste('HDI:',round(hdi,3)))
plot(xx,sapply(xx,cdf),main='cdf',type='h',xlab='x',ylab='Probability',col='lightblue')
pp=seq(0,1,length=nxx)
pp=pp[-nxx]
pp=pp[-1]
plot(pp,sapply(pp,ICDF),type='l',xlab='p',ylab='x',main='ICDF')
par(mfrow=c(1,1))
}
invisible(ICDF)
}
確率密度関数を正弦波とか円周にしても計算できるはず。

105:卵の名無しさん
18/11/10 21:22:19.55 BbEZ9aeT.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.

106:卵の名無しさん
18/11/10 21:35:01.58 eRQ4an/O.net
ド底辺シリツ裏口調査団が100人を順次調査した。
裏口判明人数をそのまま公表はヤバすぎる結果であったため、
連続して裏口がみつかった最大数は4人であったとだけ公表した。
公表結果が正しいとして裏口入学人数の期待値、最頻値、及び95%信頼区間を述べよ。
期待値37人、最頻値37人 95%信頼区間17人~56人
> mKoN2pCI(100,4) # one minute plz
lower mean mode upper
0.1747676 0.3692810 0.3728936 0.5604309
> (mean=integrate(function(x)x*pdf(x),0,1)$value)
[1] 0.369281
> (var=integrate(function(x)(x-mean)^2*pdf(x),0,1)$value)
[1] 0.009878284
> (sd=sqrt(var))
[1] 0.09938955
正規分布で十分近似
> c(lower=qnorm(0.025,mean,sd),upper=qnorm(0.975,mean,sd))
lower upper
0.1744810 0.5640809
与えられた数字は100と4だけなんだよなぁ。
まあ、連続最大数という条件があるから計算できたのだが。
4と100から、平均値と標準偏差がもっと簡単に導出できれば正規分布近似計算できるのだが
まあ、プログラムが組めたから正規分布近似計算する必要はないな。

107:卵の名無しさん
18/11/10 21:36:25.04 eRQ4an/O.net
>>102
原文はこれな。
私は昭和の時代に大学受験したけど、昔は今よりも差別感が凄く、慶応以外の私立医は特殊民のための特殊学校というイメージで開業医のバカ息子以外は誰も受験しようとすらしなかった。
常識的に考えて、数千万という法外な金を払って、しかも同業者からも患者からもバカだの裏口だのと散々罵られるのをわかって好き好んで私立医に行く同級生は一人もいませんでした。
本人には面と向かっては言わないけれど、俺くらいの年代の人間は、おそらくは8-9割は私立卒を今でも「何偉そうなこと抜かしてるんだ、この裏口バカが」と心の底で軽蔑し、嘲笑しているよ。当の本人には面と向かっては絶対にそんなことは言わないけどね。

108:卵の名無しさん
18/11/10 21:48:48.87 0/hxM8VF.net
作 牧村みき

109:卵の名無しさん
18/11/10 22:53:57.75 eRQ4an/O.net
開脚率の期待値を計算してみた。
ゆるゆる女子大生の開脚率期待値:r人目で初めて開脚
r=3
Ex.yuru <- function(r){
integrate(function(x)x*(1-x)^(r-1)*x,0,1)$value/integrate(function(x)(1-x)^(r-1)*x,0,1)$value
}
Ex.yuru(r)
2/(r+2)
がばがば女子大生の開脚率期待値:N人中z人開脚
N=9
z=3
Ex.gaba <- function(N,z){
integrate(function(x) x*choose(N,z)*x^z*(1-x)^(N-z),0,1)$value/integrate(function(x)choose(N,z)*x^z*(1-x)^(N-z),0,1)$value
}
Ex.gaba(9,3)
(z+1)/(N+2)

110:卵の名無しさん
18/11/10 22:58:20.05 eRQ4an/O.net
n=60:100
pmf=choose(60-1,5-1)/choose(n,5) #Pr(max=60|n)
pdf=pmf/sum (pmf)
sum( n*pdf) #E(n)
plot(n,cumsum(pdf))
abline(h=0.95,lty=3)

plot(n,cumsum(pdf),xlim=c(75,100),ylim=c(0.75,1),type='h')
abline(h=c(0.80,0.90,0.95),lty=3)
累積質量関数をグラフにすると
URLリンク(imagizer.imageshack.com)

111:卵の名無しさん
18/11/11 04:47:59.95 3fp/Z1Bf.net
NNN臨時放送

112:卵の名無しさん
18/11/11 08:25:49.13 8Ef5Z4Y6.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.

113:卵の名無しさん
18/11/11 08:58:08.11 g+y24FcC.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.

114:卵の名無しさん
18/11/11 11:04:24.83 RT24eksu.net
東京医大、本来合格者入学許可へ 今年の受験生50人
2018年10月25日 02時06分
 東京医科大=8月、東京都新宿区
 東京医科大が今年の入試で本来合格ラインを上回っていたのに、不正の影響で不合格となった受験生50人に対し、来年4月の入学を認める方針を固めたことが24日、関係者への取材で分かった。



115:年の本来合格者19人については、難しいとの意見が出ているもようだ。東京医大は50人のうち入学希望が多数に上った場合は、来年の一般入試の募集人員減も検討。 https://www.nishinippon.co.jp/sp/nnp/national/article/460101/ https://www.tokyo-med.ac.jp/med/enrollment.htmlによると 学年 第1学年 第2学年 在学者数 133 113 昨年入学者の留年者や退学者が0として、 大学が公式認定した裏口入学者が少なくとも今年は133人中50人、昨年が113人中19人ということになる。 裏口入学率の期待値、最頻値、およびその95%信頼区間を求めよ。



116:卵の名無しさん
18/11/11 11:06:42.03 RT24eksu.net
>>111
これで求めた確率分布を事前分布として
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.1822 0.2624 0.2813 0.2821 0.3013 0.4312
library(rjags)
y=c(50,19)
N=c(133,113)
Ntotal=length(y)
a=0.5
b=0.5
dataList=list(y=y,N=N,Ntotal=Ntotal,a=a,b=b)
# JAGS model
modelString ="
model{
for(i in 1:Ntotal){
y[i] ~ dbin(theta,N[i])
}
theta ~ dbeta(a,b)
}
"
writeLines(modelString,'TEMPmodel.txt')
jagsModel=jags.model('TEMPmodel.txt',data=dataList)
codaSamples=coda.samples(jagsModel,var=c('theta'),n.iter=20000,na.rm=TRUE)
summary(codaSamples)
js=as.vector(as.matrix(codaSamples))
x11() ; BEST::plotPost(js,xlab="裏口確率")
x11() ; BEST::plotPost(js,showMode = TRUE,xlab="裏口確率")
この問題をやってみよう。
ド底辺シリツ裏口調査団が100人を順次調査した。
裏口判明人数をそのまま公表はヤバすぎる結果であったため、
連続して裏口がみつかった最大数は4人であったとだけ公表した。
公表結果が正しいとして裏口入学人数の期待値、最頻値、及び95%信頼区間を述べよ。

117:卵の名無しさん
18/11/11 11:07:30.56 RT24eksu.net
seqNp <- function(N=100,K=5,p=0.5){
if(p==0) return(0)
if(N==K) return(p^K)
q=1-p
a=numeric(N) # a(n)=P0(n)/p^n , P0(n)=a(n)*p^n
for(i in 1:K) a[i]=q/p^i # P0(i)=q
for(i in K:(N-1)){ # recursive formula
a[i+1]=0
for(j in 0:(K-1)){
a[i+1]=(a[i+1]+a[i-j])
}
a[i+1]=q/p*a[i+1]
}
P0=numeric(N)
for(i in 1:N) P0[i]=a[i]*p^i # P0(n)=a(n)*p^n
MP=matrix(rep(NA,N*K),ncol=K)
colnames(MP)=paste0('P',0:(K-1))
MP[,'P0']=P0
head(MP);tail(MP)
MP[1,'P1']=p
for(i in (K-2):K) MP[1,i]=0
for(k in 2:K){
for(i in 1:(N-1)) MP[i+1,k]=p*MP[i,k-1]
} # Pk(n+1)=p*P(k-1)(n)
ret=1-apply(MP,1,sum)
ret[N]
}
seqNpJ <- function(N,K,p) seqNp(N,K,p) - seqNp(N,K+1,p)

118:卵の名無しさん
18/11/11 11:08:29.37 RT24eksu.net
HDIofGrid = function( probMassVec , credMass=0.95 ) { # by Kruschke
sortedProbMass = sort( probMassVec , decreasing=TRUE )
HDIheightIdx = min( which( cumsum( sortedProbMass ) >= credMass ) )
HDIheight = sortedProbMass[ HDIheightIdx ]
HDImass = sum( probMassVec[ probMassVec >= HDIheight ] )
return( list( indices = which( probMassVec >= HDIheight ) ,
mass = HDImass , height = HDIheight ) )
}

119:卵の名無しさん
18/11/11 11:35:36.92 RT24eksu.net
pp=js
vsJ=Vectorize(function(p) seqNpJ(N=100,K=4,p))
y=vsJ(pp)
summary(y);quantile(y,prob=c(.025,.975))
plot(pp,y,col='navy',bty='l')
pp[which.max(y)]
max(y,na.rm=T)
HDInterval::hdi(y)
BEST::plotPost(y,xlab="裏口確率",col='pink')
BEST::plotPost(y,showMode = TRUE,xlab="裏口確率",col='pink')

120:卵の名無しさん
18/11/11 11:42:28.36 RT24eksu.net
>>115
> summary(y);quantile(y,prob=c(.025,.975))
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.06935 0.20684 0.24441 0.24325 0.28129 0.35319
2.5% 97.5%
0.1403402 0.3369101
> HDInterval::hdi(y)
lower upper
0.1477413 0.3422359
という結果になる。
>大学が公式認定した裏口入学者が少なくとも今年は133人中50人、昨年が113人中19人ということになる
これをχ二乗検定やフィッシャーテストすると
> prop.test(c(50,19),c(133,113))$p.value
[1] 0.0005145557
> Fisher.test(c(50,19),c(133,113))$p.value
[1] 0.0003432805
で今年と去年で裏口率が有意に異なることになるのだが、裏口入学者を除籍処分しないようなシリツ医大の発表は盲信できないね。

121:卵の名無しさん
18/11/11 13:44:05.86 RT24eksu.net
あるタクシー会社のタクシーには1から通し番号がふられている。
タクシー会社の規模から


122:保有タクシー台数は100台以下とわかっている。 この会社のタクシーを5台みかけた。最大の番号が60であった。 この会社の保有するタクシー台数の期待値を分数で答えよ 数値は同じで問題をアレンジ。 あるど底辺シリツ医大の裏口入学者には背中に1から通し番号がふられている。 一学年の定員は100人である。 裏口入学5人の番号のうち最大の番号が60であった。 この学年の裏口入学者数の期待値を分数で答えよ。 小数だと71.48850431950537



123:卵の名無しさん
18/11/11 13:44:55.16 RT24eksu.net
import math
import numpy as np
from fractions import Fraction
def choose(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
found_car = 5
max_number = 60
max_car = 100
n = range(max_car - max_number + 1)
pmf=[0]*len(n)
max_case = choose(max_number-1,found_car-1)
for i in n:
pmf[i] = max_case / choose(i+max_number,found_car)
pdf=[0]*len(n)
for i in n:
pdf[i] = pmf[i]/sum(pmf)
prob=[0]*len(n)
for i in n:
prob[i] = (max_number+i)*pdf[i]
result=sum(prob)
print (Fraction(result))
print (result)

124:卵の名無しさん
18/11/11 13:45:47.68 RT24eksu.net
Rだと
found_car = 5
max_number = 60
max_car = 100
n=max_number:max_car
pmf=choose(max_number-1,found_car-1)/choose(n,found_car) # Pr(max=60|n)
pdf=pmf/sum (pmf)
sum(n*pdf) #E(n)
で済むが 分数では算出できず

125:卵の名無しさん
18/11/11 13:58:43.34 RT24eksu.net
95%信頼区間も1行追加ですむ。
> n=60:100
> pmf=choose(60-1,5-1)/choose(n,5)
> sum(n*pmf)/sum (pmf)
[1] 71.4885
> n[which(cumsum(pmf/sum(pmf))>0.95)]
[1] 93 94 95 96 97 98 99 100

126:卵の名無しさん
18/11/11 13:59:57.00 RT24eksu.net
> n=60:100
> pmf=choose(60-1,5-1)/choose(n,5)
> sum(n*pmf)/sum (pmf)
[1] 71.4885
> min(n[which(cumsum(pmf/sum(pmf))>0.95)])
[1] 93

127:卵の名無しさん
18/11/11 14:00:49.27 4SxoNh8o.net
いあいあ ふんぐるい むぐるうなふ くとぅるう るるいえ うがふなぐる ふたぐん

128:卵の名無しさん
18/11/11 14:11:25.14 RT24eksu.net
# Pythonに移植
import math
import numpy as np
from fractions import Fraction
def choose(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
found_car = 5
max_number = 60
max_car = 100
n = range(max_car - max_number + 1)
pmf=[0]*len(n)
max_case = choose(max_number-1,found_car-1)
for i in n:
pmf[i] = max_case / choose(i+max_number,found_car)
pdf=[0]*len(n)
for i in n:
pdf[i] = pmf[i]/sum(pmf)
prob=[0]*len(n)
for i in n:
prob[i] = (max_number+i)*pdf[i]
result=sum(prob)
print (Fraction(result))
print (result)
cdf = np.cumsum(pdf)
print (max_number + np.min(np.where(cdf>0.95)))

129:卵の名無しさん
18/11/11 14:12:42.99 RT24eksu.net
5030556272103101/70368744177664
71.48850431950537
93
結果は、同じだが分数計算が他の人の結果との照合に便利

130:卵の名無しさん
18/11/11 14:15:53.17 4SxoNh8o.net
エコエコアザラク エコエコザメラク
地獄のキュエーン

131:卵の名無しさん
18/11/11 14:21:08.06 4SxoNh8o.net
算数の問題です
円周率をサンスクリット語で暗唱せよ

132:卵の名無しさん
18/11/11 15:38:32.90 RT24eksu.net
コインを1000万回投げた。連続して表がでる確率が最も高いのは何回連続するときか?
最大値をとるときの確率は 
4456779119136417/18014398509481984
= 0.2474009396866937
となったがあっているか?
数字を0と1を書いて数を数えて割り算するだけ。
3010300桁の数の集計する単純作業だから、おまえにもできるだろ?

133:卵の名無しさん
18/11/11 16:09:19.43 RT24eksu.net
>>127
3010300桁の数はここにアップロードしてやったから早めにダウンロードして照合の桁数を間違えないようにしろよ。
9049で始まり、最後は9376で終わる数字。
URLリンク(fast-uploader.com)

134:卵の名無しさん
18/11/11 16:11:54.59 BgP7Mpr0.net
いやー、昨日のセカンドはやられました。はめられました。
第一ロッター・・・・・小カタメ少なめ 第二ロッター・・・・・小カタメ
第三ロッター・・・・・小カタメ麺半分 第四ロッター(俺)・・・大
見事デスロットです。今思うと前の三人、確信犯だったと思う。
知り合い同士みたいだったし(てかよく見る奴らw)、第三ロッターのメガネが俺の食券見た後


135:、前二人とひそひそ喋ってた。 『あいつ、ロット乱しにして恥かかしてやらない?w』こんな会話してたんだろうな・・・ いつも大を相手にしてる俺に嫉妬してんだろうな。。陰険なやり方だよ。正々堂々と二郎で勝負しろよ。



136:青戸6丁目住民は超変態バカップルを許さまじ食糞協会長:宇野壽倫
18/11/11 16:35:14.78 eesLUl6p.net
★★【盗聴盗撮犯罪者・井口千明(東京都葛飾区青戸6-23-17)の激白】★★
☆食糞ソムリエ・高添沼田の親父☆ &☆変態メス豚家畜・清水婆婆☆の超変態不倫バカップル
  東京都葛飾区青戸6-26-6        東京都葛飾区青戸6-23-19
盗聴盗撮つきまとい嫌がらせ犯罪者/食糞ソムリエ・高添沼田の親父の愛人変態メス豚家畜清水婆婆(青戸6-23-19)の
五十路後半強制脱糞
URLリンク(img.erogazou-pinkline.com)

⊂⌒ヽ            γ⌒⊃
  \ \  彡 ⌒ ミ   / /
    \ \_<(゚)д(゚)>_./ /  食糞ソムリエ・高添沼田の親父どえーす 一家そろって低学歴どえーす 孫も例外なく阿呆どえーす
      \ \_∩_/ /    東京都葛飾区青戸6-26-6に住んどりマッスル
      /(  (::)(::)  )\    盗聴盗撮つきまとい嫌がらせの犯罪をしておりマッスル
    ⊂_/ ヽ_,*、_ノ \_⊃      くれぐれも警察に密告しないでくらはい お願いしまふ
 ̄][ ̄ ̄]            [ ̄ ̄][ ̄
 ̄ ̄][ ̄]            [ ̄][ ̄ ̄
 ̄][ ̄ ̄]            [ ̄ ̄][ ̄
 ̄ ̄][ ̄]            [ ̄][ ̄ ̄
 ̄][ ̄ ̄]            [ ̄ ̄][ ̄
"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~

137:卵の名無しさん
18/11/11 17:42:34.02 RT24eksu.net
# maximal sequential head probability at 10^8 coin flip
> y
[1] 2.2204460492503131e-16 2.2204460492503131e-16
[3] 8.8817841970012523e-16 1.5543122344752192e-15
[5] 3.5527136788005009e-15 6.8833827526759706e-15
[7] 1.4210854715202004e-14 2.8199664825478976e-14
[9] 5.6843418860808015e-14 1.1346479311669100e-13
[11] 2.2737367544323206e-13 4.5452530628153909e-13
[13] 9.0949470177292824e-13 1.8187673589409314e-12
[15] 3.6379788070917130e-12 7.2757355695785009e-12
[17] 1.4551915228366852e-11 2.9103608412128779e-11
[19] 5.8207660913467407e-11 1.1641509978232989e-10
[21] 6.6493359939245877e-06 2.5720460687386204e-03
[23] 4.8202266324911647e-02 1.7456547460031679e-01
[25] 2.4936031630254019e-01 2.1428293501123058e-01
[27] 1.4106434838399229e-01 8.1018980443629832e-02
[29] 4.3428433624081136e-02 2.2484450838189007e-02

138:卵の名無しさん
18/11/11 18:43:47.27 RT24eksu.net
#include <stdio.h>



139:#include<math.h> #include<stdlib.h> #define p 0.5 double flip(int N,double k){ double P[N]; int i; for(i = 0; i < k-1; i++) { P[i] = 0; } P[(int)k-1] = pow(p,k); P[(int)k] = pow(p,k) + (1-p)*pow(p,k); for(i = (int)k; i < N; i++){ P[i+1] = P[i] + (1-P[i-(int)k])*pow(p,(double)(k+1)); } return P[N]; } int main(int argc,char *argv[]){ int N = atoi(argv[1]); double k = atof(argv[2]); double PN =flip(N,k); double PNJ = flip(N,k) - flip(N,k+1); printf("Over %d heads at %d flips : %f\n", (int)k ,N ,PN); printf("Just %d heads at %d flips : %f\n", (int)k ,N ,PNJ); return 0; }



140:卵の名無しさん
18/11/11 18:53:11.12 RT24eksu.net
gcc coin5.c -o coin5.exe -lm
C:\pleiades\workspace>gcc coin5.c -o coin5.exe -lm
gcc coin5.c -o coin5.exe -lm
C:\pleiades\workspace>coin5 100 5
coin5 100 5
Over 5 heads at 100 flips : 0.813343
Just 5 heads at 100 flips : 0.263523
C:\pleiades\workspace>coin5 1000 10
coin5 1000 10
Over 10 heads at 1000 flips : 0.385751
Just 10 heads at 1000 flips : 0.170128 👀
Rock54: Caution(BBR-MD5:1341adc37120578f18dba9451e6c8c3b)


141:卵の名無しさん
18/11/11 22:42:42.63 UCMkX/If.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.

142:卵の名無しさん
18/11/12 00:48:13.50 G7wSOjAG.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.

143:卵の名無しさん
18/11/12 02:39:48.77 +DPZ0e9S.net
臨床問題です
事務員のアスペ指数を計測せよ

144:卵の名無しさん
18/11/12 07:17:09.02 KUf7IfSV.net
>>136
前提が間違っているから
Zero Division Errorだね。
宿題まだか?
数を増やした次の問題が控えているぞ。
コインを1億回投げた。連続して表がでる確率が最も高いのは何回連続するときか?
その確率は
2246038053550679/9007199254740992
= 0.24936031612362342
な。
きちんと検算してから、臨床統計スレに書き込めよ。

145:卵の名無しさん
18/11/12 07:46:46.08 fhdQROV/.net
誰からも相手にされない ド底辺事務員

146:卵の名無しさん
18/11/12 08:13:57.33 KUf7IfSV.net
>>138
数学板ではきちんとしたレスが返ってくるのよ。
こんな感じでね。
URLリンク(rio2016.2ch.net)
他人のコード読むのは勉強になるね。

147:卵の名無しさん
18/11/12 13:48:23.85 Xm/n5tCK.net
この問題、俺にはプログラミング解が精いっぱい。
解析解出せる頭脳は尊敬するな。

N枚のコインを投げて表が連続する確率が最も大きい回数をsとする。
例:N=10でs=2、N=15でs=3
(1) N=777のときのsを述べよ。
(2)s=7となるNの範囲を述べよ。

148:卵の名無しさん
18/11/12 15:10:55.63 gzeh1x/+.net
library(rjags)
y=c(10,16,34,9,10,26)
N=rep(125,6)
Ntotal=length(y)
a=1
b=1
dataList=list(y=y,N=N,Ntotal=Ntotal,a=a,b=b)
# JAGS model
modelString ="
model{
for(i in 1:Ntotal){
y[i] ~ dbin(theta,N[i])
}
theta ~ dbeta(a,b)
}
"

149:卵の名無しさん
18/11/12 15:11:23.82 gzeh1x/+.net
writeLines(modelString,'TEMPmodel.txt')
jagsModel=jags.model('TEMPmodel.txt',data=dataList)
codaSamples=coda.samples(jagsModel,var=c('theta'),n.iter=20000,na.rm=TRUE)
summary(codaSamples)
js=as.vector(as.matrix(codaSamples))
BEST::plotPost(js,xlab="留年確率")
BEST::plotPost(js,showMode = TRUE,xlab="留年確率")

150:卵の名無しさん
18/11/12 15:12:31.12 gzeh1x/+.net
binom::binom.confint(sum(y),sum(N))

151:卵の名無しさん
18/11/12 16:56:10.68 gzeh1x/+.net
>>117
f <- function(Mmax,M=5,Nmax=100){
n=Mmax:Nmax
pmf=choose(Mmax-1,M-1)/choose(n,M)
pdf=pmf/sum (pmf)
mean=sum(n*pdf)
upr=n[which(cumsum(pdf)>0.95)[1]]
lwr=Mmax
c(lwr,mean,upr)
}
x=5:100
y=sapply(x,function(n) f(n)[2])
z=sapply(x,function(n) f(n)[3])
plot(x,y,pch=19)
points(x,z)
cbind(x,y,z)

152:卵の名無しさん
18/11/12 17:01:57.91 gzeh1x/+.net
f <- function(Mmax,M=5,Nmax=100){
n=Mmax:Nmax
pmf=choose(Mmax-1,M-1)/choose(n,M)
pdf=pmf/sum (pmf)
mean=sum(n*pdf)
upr=n[which(cumsum(pdf)>0.95)[1]]
lwr=Mmax
c(lwr,mean,upr)
}
x=5:100
y=sapply(x,function(n) f(n)[2])
z=sapply(x,function(n) f(n)[3])
plot(x,y,type='l',lws=2,bty='l')
segments(x,x,x,z)
#points(x,z)
cbind(x,y,z)

153:卵の名無しさん
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)
これを検証するシミュレーションプログラムを作れ、というのが課題。

154:卵の名無しさん
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

155:卵の名無しさん
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))])) # 最頻値

156:卵の名無しさん
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

157:卵の名無しさん
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.

158:卵の名無しさん
18/11/13 08:24:34.99 kjupm458.net
このスレは事務員が日がな一日妄想を垂れ流し
見物人たちがそれを見てフルボッコにするスレである
事務員 とは?
同一者の別名として、薄汚いジジイ、国試浪人、統計野郎、自称医科歯科、がある
自称医科歯科卒、実際は九州の駅弁国立出身で、卒業後は実家の東京に帰り国試浪人となり23年間経過、家庭教師バイトなどを経て現在は事務員、とされている
本人は、勤務医でたまに開業医の手伝いと内視鏡バイト、専門医なし、と主張しているが、連日連夜の異常な書き込み数の多さからは、勤務医とは考え難く、彼の職業がたとえ何であったとしても、人としてド底辺なことは間違いがない
自ら事務員であると告白したこともある
スレリンク(hosp板:108番)-109
が、事務員であることも疑わしい
実際はナマポかニートの可能性が高い
自分の主張に対して都合の悪い突込みが入ると、相手を私立医と決めつけて、さてはシリツだな、裏口バカ、というセリフでワンパターンに返すことが多い
国試問題を挙げて簡単だとほざいてますが、本番で通らなければお話になりません
いくらネットでわめいていても、医師国試の本番で通らなければお話になりません
大事なことなので2回言いました

159:卵の名無しさん
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.
ド底辺特殊シリツ医大卒は裏口入学の負い目から裏口馬鹿を暴く人間を偽医者扱いしたがる。

160:卵の名無しさん
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')

161:卵の名無しさん
18/11/13 11:31:17.33 UTrDDuDZ.net
ド底辺シリツ医大のある学年にひとりずつ裏口入学登録証があることが判明したがその数は公表されていないとする。
ある裏口入学調査員が無作為に10枚選んで番号を記録して元に戻した。
別の裏口入学調査員が無作為に20枚選んで番号を記録してして元に戻した。
二人の調査官の記録した番号を照合すると3人分の番号が一致していた。
この情報からこの学年の裏口入学者数の95%信頼区間を求めよ。

162:卵の名無しさん
18/11/13 14:13:47.83 UTrDDuDZ.net
固有の番号の書かれたカードが何枚あり、
その枚数は1000枚以下であることはわかっているが、その数を推定したい。
調査員が無作為に10枚選んで番号を記録して元に戻した。
別の調査員が無作為に20枚選んで番号を記録した。
二人の調査員の記録した番号を照合すると3人分の番号が一致していた。
この情報からカード枚数の期待値と95%信頼区間を求めよ。

163:卵の名無しさん
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.

164:卵の名無しさん
18/11/13 19:31:39.92 DHMhO4WL.net
二郎をすすりつつ裏口事務員をさわさわと触る
「お、おにいちゃん、大漁だった?」
「ああ、大漁だったよ」
「あぁぁぁあぁすごいいいぃいぃ!、、な、なにが、、ハァハァなにが捕れたの?」
焼豚を舌でやさしく舐めながら国試浪人は答えた
「…鯛とか、、、ヒラメがいっぱい捕れたよ」
セリフを聞き、オジサンはびくんびくんと身体をひきつらせた
「はっ!はぁぁぁあんっ!イ、イサキは?イサキは、と、取れたの??」
ド底辺事務員をしごく
「ああ。でかいイサキが取れたよ。今年一番の大漁だ。」
「大漁っ!!イサキぃぃ!!おにいちゃんかっこいいいいぃぃぃい ぃくううううう!」

165:卵の名無しさん
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.

166:卵の名無しさん
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 tenderly 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!"

167:卵の名無しさん
18/11/13 22:51:51.61 UlWlhoup.net
ここは くるくるぱー アスペ 事務員が
ナゾナゾを出したり アプリ翻訳したインチキ英語で
自作自演したりするスレです

168:卵の名無しさん
18/11/13 23:30:56.92 fLfkvliu.net
>155の計算結果は最頻値と期待値が大幅に乖離するので
計算に自信が持てずシミュレーションとの合致でようやく納得。
数学板に貼ったら2時間で期待値のHaskellでの算出値のレスが来た。それで信頼区間も確信を持って計算できた。
確率密度はこんな感じなので期待値と最頻値がずれるわけだな。
URLリンク(i.imgur.com)

169:卵の名無しさん
18/11/13 23:40:50.36 fLfkvliu.net
>>160
>155の算出式書けばド底辺シリツ医大卒でも基礎学力があると示せるのに裏口馬鹿を実証してどうすんの?
Rのスクリプトすら読めない裏口バカなんだろ?

170:卵の名無しさん
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

171:卵の名無しさん
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)

172:卵の名無しさん
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.

173:卵の名無しさん
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.

174:卵の名無しさん
18/11/14 20:59:26.07 lTkyjX2F.net
医師国家試験にこういうの問題を出してシリツ医大の裏口馬鹿を排除すればいいのにね。
2人が自転車に乗って走っている。その速さの比は11:8である。この2人が周囲480mの円形の池の同じ地点から同時に同方向にスタートしてまわるとき、速い人は遅い人を4分ごとに追い越す。2人の毎分の速さを求めよ

175:卵の名無しさん
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.

176:卵の名無しさん
18/11/14 21:26:14.73 zDUHf0ws.net
ド底辺事務員の今日のおかず
くいこみ戦隊ブルマちゃん

177:卵の名無しさん
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

178:卵の名無しさん
18/11/15 12:20:42.85 d0+yWFff.net
draft


179: 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])) }



180:卵の名無しさん
18/11/15 14:10:09.98 0BjfilY2.net
実際こんな職員が病院にいたら大変だね
以前に病院のパソコンにスマホつないで充電したり動画を見たりしている職員がいたが
この事務員も同レベルのカスなんだろうな

181:卵の名無しさん
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;
}

182:卵の名無しさん
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))
}
}
}

183:卵の名無しさん
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
俺は肝弯より脾損傷の方がやだね。
開腹手術での受動時の経験と透視でのファイバーの動きを見る機会があるとこんなに可動性あったっけとか思う。
幸い脾損傷の経験はないけど、検査後に左肩への放散痛があったら疑わなくてはと思っている。

184:卵の名無しさん
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で、逆方向は平均時速45kmで定速走行する。診療所の普通車は信号待ちもあり平均時速30kmで定速走行する。
何時以降の病態悪化は診療所の車を使わずに救急車の到着を待つ方が病院に早く着くか?

185:卵の名無しさん
18/11/15 19:08:50.01 u639IIxL.net
>>174
配列の要素ごとの演算をしてくれるRが使い勝手がいいなぁ。
シミュレーターとして使うのは遅いけど。

186:卵の名無しさん
18/11/15 19:10:14.30 u639IIxL.net
>>172
カスとは
>167の答も出せない
おまえのことだよ。

187:卵の名無しさん
18/11/15 19:26:12.08 0BjfilY2.net
医師なら事務員というワードには反応しないよねW

188:卵の名無しさん
18/11/15 19:33:47.58 LT687Ilf.net
>>179
ド底辺シリツというのに反応する椰子はw

189:卵の名無しさん
18/11/15 19:37:22.84 LT687Ilf.net
>>179
URLリンク(egg.2ch.net)
とそれへのレスみて事務員だと思うならお前の頭は相当悪いぞ。
あぁ、ド底辺シリツ医大卒の裏口バカだよなぁ?
>167に即答してみ。裏口入学じゃなきゃできるだろ。

190:卵の名無しさん
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

191:卵の名無しさん
18/11/15 20:14:47.02 0BjfilY2.net
今日も事務員は発狂中
他のスレでは既読スルーされてて
誰も反応なんかしていないよねW



とか書くと
また自作自演しまくるんだろうなー

192:卵の名無しさん
18/11/15 20:33:45.90 LT687Ilf.net
>>183
あらら、>167に即答できないって相当頭が悪いぞ。
裏口入学??

193:卵の名無しさん
18/11/15 20:36:16.18 LT687Ilf.net
専門医スレで誰も正当できなかった>176の方に答えてくれてもいいぞ、国立卒ならこれくらいの四則演算はできるだろ?

194:卵の名無しさん
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.

195:卵の名無しさん
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)
}

196:卵の名無しさん
18/11/15 22:05:46.83 u639IIxL.net
>>186
which deserves to be called a bona fide moron は何故、whoでなくて文法破格のwhichが用いられているか、その理由を述べてみ!

197:卵の名無しさん
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))

198:卵の名無しさん
18/11/15 22:51:18.47 u639IIxL.net
(1)
池の鯉を網で56匹すくいました。
すくった56匹に目印をつけ、池にもどしました。
次の日に鯉45匹をすくったところ、36匹に目印がついていました。
池の鯉はおよそ何匹ですか。
(2)
固有の番号の書かれたカードが何枚あり、
その枚数は1000枚以下であることはわかっているが、その数を推定したい。
調査員が無作為に10枚選んで番号を記録して元に戻した。
別の調査員が無作為に20枚選んで番号を記録した。
二人の調査員の記録した番号を照合すると3枚の番号が一致していた。
この情報からカード枚数の最頻値、期待値とその95%信頼区間を求めよ。

(1)の方は鯉の数の上限を10000匹にして期待値を求めても71程度でほとんど変動しないが
(2)の方は著しく変動する、合致枚数を8枚にすると殆ど変動しない。
再捕獲法での個体数推定の限界だな。

199:卵の名無しさん
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)

200:卵の名無しさん
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)
}

201:卵の名無しさん
18/11/15 23:36:45.82 aG6lkqvZ.net
>>183
鉄則を思い出しましょう
算数事務員はド底辺の裏口バカだから
対話するだけムダである

202:卵の名無しさん
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))

203:卵の名無しさん
18/11/15 23:43:20.76 u639IIxL.net
>>193
そんなの書く暇があれば、これくらい即答できるはずなのに。
2人が自転車に乗って走っている。その速さの比は11:8である。
この2人が周囲480mの円形の池の同じ地点から同時に同方向にスタートしてまわるとき、速い人は遅い人を4分ごとに追い越す。
2人の毎分の速さを求めよ
即答できないって、馬鹿なんだね。

204:卵の名無しさん
18/11/15 23:43:55.25 u639IIxL.net
専門医スレで誰も正当できなかった>176の方に答えてくれてもいいぞ、国立卒ならこれくらいの四則演算はできるだろ?

205:卵の名無しさん
18/11/15 23:55:08.72 kjgKXvFf.net
正当 WWW
発狂バカが やりがちの 漢字誤変換 WWW

206:卵の名無しさん
18/11/16 00:19:20.47 CpQxI30j.net
>>197
そういう指摘する暇があれば即答すればいいのに
やっぱり馬鹿なのね。

207:卵の名無しさん
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


208:/=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



209:卵の名無しさん
18/11/16 14:49:13.79 OhMUxuM/.net
タイムアウトせずにon lineでも動かせた。
URLリンク(tpcg.io)

210:卵の名無しさん
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)
-}

211:卵の名無しさん
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]]

212:卵の名無しさん
18/11/16 18:23:07.05 CpQxI30j.net
>>191
数学板にこの問題とpythonのコードを貼ったら
ちゃんとコード内の関数を読んでレスがきた。
このスレだと漢字の誤変換を指摘するしかできないアホしかいない。
誤変換の指摘を書く暇があれば、これくらい即答できるはずなのに。それもできない馬鹿なのか?裏口入学かな?
2人が自転車に乗って走っている。その速さの比は11:8である。
この2人が周囲480mの円形の池の同じ地点から同時に同方向にスタートしてまわるとき、速い人は遅い人を4分ごとに追い越す。
2人の毎分の速さを求めよ

213:卵の名無しさん
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.

214:卵の名無しさん
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)

215:卵の名無しさん
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

216:卵の名無しさん
18/11/16 22:37:20.95 STS/8KrX.net
僕らの おち○ぽ

217:卵の名無しさん
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.

218:卵の名無しさん
18/11/17 10:15:28.71 Vs5/CoAG.net
>>205
池の鯉の総数と調査します。
五郎君が名前に因んで56匹�


219:゚まえて目印をつけ、池にもどしました。 次の日に三郎君が自分の名前に因んで36匹の目印のついた鯉を捕まえることにしました。 鯉45匹めで予定の36匹が捕まりました。 池の鯉はおよそ何匹ですか。 負の二項分布で計算するとこっちはモード値が70の1個なんだなぁ。



220:卵の名無しさん
18/11/17 10:26:00.26 Vs5/CoAG.net
>>209
このときの推測数の信頼区間の算出が次の課題だな。
3匹目印鯉捕獲目標が45匹目で達成されたときと比較したい。

221:卵の名無しさん
18/11/17 10:51:31.94 Vs5/CoAG.net
>>210
DRAFT

222:卵の名無しさん
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)

223:卵の名無しさん
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)
}

224:卵の名無しさん
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

225:卵の名無しさん
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
負の二項分布でも超幾何分布のときとさほど変わらないなぁ

226:卵の名無しさん
18/11/17 14:05:11.77 oN/r/5pI.net
さて来週の3本は
よくもこんな〇〇〇〇レコードを
これから毎日スレ上げしようぜ
んほおぉぉぉおぉぉ
でお送りしま~す、んっわっほっぅ

227:純粋大和
18/11/17 14:17:58.42 bEfId4t4.net
どうせ助からない(死ぬ奴)の集まりかよ 笑

228:卵の名無しさん
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)の答えを出すまでの計算過程を教えていただきたいです。
よろしくお願い致します。

229:卵の名無しさん
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

230:卵の名無しさん
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]

231:卵の名無しさん
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.


次ページ
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch