X



臨床統計もおもしろいですよ、その2

レス数が1000を超えています。これ以上書き込みはできません。
0001卵の名無しさん
垢版 |
2018/10/30(火) 22:19:26.32ID:kXLKssbE
 
 内科認定医受験の最低限の知識、
 製薬会社の示してくる臨床データ、
 論文の考察、
 論文を書くときの正当性、
 というのが、臨床統計の今までの目的の大きい部分でしたが、
 
 AI=機械学習の基本も、結局は統計学と確率に支配されます。
 そういう雑多な話をするスレです。
 
※前スレ
臨床統計もおもしろいですよ、その1
https://egg.2ch.net/test/read.cgi/hosp/1493809494/
0002卵の名無しさん
垢版 |
2018/10/30(火) 22:49:12.69ID:kXLKssbE
dec2n n = concat . (map show) . reverse . sub
where sub 0 = []
sub num = mod num n : sub (div num n)
main = do
let n=7
let num=10^68 - 7
putStrLn $ dec2n n num


231610455425461524013603062230536506126223530530201410405365413161511216632624602
0003卵の名無しさん
垢版 |
2018/10/30(火) 23:17:28.53ID:kXLKssbE
dec2nw <- function(num, N, digit = 4){
r=num%%N
q=num%/%N
while(q > 0 | digit > 1){
r=append(q%%N,r)
q=q%/%N
digit=digit-1
}
return(r)
}
n=dec2nw(10**16-7,36)
n
cat(c(0:9,letters[1:26])[n+1])
0005卵の名無しさん
垢版 |
2018/10/31(水) 10:21:03.69ID:sRjms2eC
def binomial(n,r):
from math import factorial as f
return f(n)//f(r)//f(n-r) if r>=0 and n-r>=0 else 0

def nloc(m,n,k,l):
q,r = divmod(n*k+l,m)
return (n-q)*(m-k)+q-1-l + ((k-r) if r > k else 0)

def nwin(m,n,c):
return sum(binomial(nloc(m,n,k,l),c-1) for k in range(m) for l in range(n) if k*(n-1)<l*(m-1))


nloc = function(m,n,k,l){
q=(n*k+l)%/%m
r=(n*k+l)%%m
(n-q)*(m-k)+q-1-l + max(k-r,0)
}

nwin = function(m,n,k){
for(k in 0:(m-1)){
for(l in 0:(n-1)){
if(k*(n-1<l*(m-1))
0006卵の名無しさん
垢版 |
2018/10/31(水) 11:53:59.80ID:bPxngJ5R
nloc = function(m,n,k,l){
q=(n*k+l)%/%m
r=(n*k+l)%%m
(n-q)*(m-k)+q-1-l + ifelse(r>k,k-r,0)
}


nwin = function(m,n,c){
re=NULL
for(k in 0:(m-1)){
for(l in 0:(n-1)){
if(k*(n-1)<l*(m-1)){
re=append(re,choose(nloc(m,n,k,l),c-1))
}
}
}
sum(re)
}

nwin(3,4,2)
nwin(5,6,15)
0008卵の名無しさん
垢版 |
2018/10/31(水) 14:43:51.58ID:qgJ05S6D
>>7
import System.Environment
import Data.List
import Data.List.Split

choose (n,r) = product[1..n] `div` product[1..n-r] `div` product[1..r]

nloc m n k l = do
let q = div (n*k+l) m
r = mod (n*k+l) m
in (n-q)*(m-k) + q-1-l + if r>k then k-r else 0

nwin m n c = sum[choose ((nloc m n k l), c-1) | k<-[0..m-1], l<-[0..n-1], k*(n-1) < l*(m-1)]

mwin m n c = sum[choose ((nloc n m k l), c-1) | k<-[0..n-1], l<-[0..m-1], k*(m-1) < l*(n-1)]

draw m n c = choose(m*n,c) - nwin m n c - mwin n m c

main = do
argList <- getArgs -- m : 縦マス(短軸) n : 横マス(長軸) k : 宝の数
let m = read (argList !! 0)
n = read (argList !! 1)
k = read (argList !! 2)
putStrLn $ "p1st = " ++ show(mwin m n k) ++ ", q1st = " ++ show(nwin m n k) ++ ", draw = " ++ show(draw m n k)
0009卵の名無しさん
垢版 |
2018/10/31(水) 15:15:25.46ID:qgJ05S6D
import System.Environment

choose (n,r) = product[1..n] `div` product[1..n-r] `div` product[1..r]

nloc m n k l = do
let q = div (n*k+l) m
r = mod (n*k+l) m
in (n-q)*(m-k) + q-1-l + if r>k then k-r else 0

nwin m n c = sum[choose ((nloc m n k l), c-1) | k<-[0..m-1], l<-[0..n-1], k*(n-1) < l*(m-1)]
mwin m n c = sum[choose ((nloc n m k l), c-1) | k<-[0..n-1], l<-[0..m-1], k*(m-1) < l*(n-1)]
draw m n c = choose(m*n,c) - nwin m n c - mwin n m c

main = do
argList <- getArgs -- m : 縦マス(短軸) n : 横マス(長軸) k : 宝の数
let m = read (argList !! 0)
n = read (argList !! 1)
k = read (argList !! 2)
putStrLn $ "p1st = " ++ show(mwin m n k) ++ ", q1st = " ++ show(nwin m n k) ++ ", draw = " ++ show(draw m n k)

こういうのも瞬時に計算してくれた、10×20部屋に宝箱100個

>takara 10 20 100
p1st = 15057759425309840160151925452579572328997602171271937639470,
q1st = 15057796557877993527038542474310161591275806044157319150135,
draw = 60432921540347294111327092128863840691952977587098698541050

不定長整数が扱えるHaskellならではだな。
Rの
> mpfr(nwin(10,20,100),100)
1 'mpfr' number of precision 100 bits
[1] 15057796557878080240302485923118087468235549676781988478976は誤答とわかる
0010卵の名無しさん
垢版 |
2018/10/31(水) 19:24:32.48ID:qgJ05S6D
>>9
drawにm nが入れ替わるバグが入ってたのを数学板で指摘されたので修正版

import System.Environment

choose (n,r) = product[1..n] `div` product[1..n-r] `div` product[1..r]

nloc m n k l = do
let q = div (n*k+l) m
r = mod (n*k+l) m
in (n-q)*(m-k) + q-1-l + if r>k then k-r else 0

nwin m n c = sum[choose ((nloc m n k l), c-1) | k<-[0..m-1], l<-[0..n-1], k*(n-1) < l*(m-1)]
mwin m n c = sum[choose ((nloc n m k l), c-1) | k<-[0..n-1], l<-[0..m-1], k*(m-1) < l*(n-1)]
draw m n c = choose(m*n,c) - nwin m n c - mwin m n c

main = do
argList <- getArgs -- m : 縦マス(短軸) n : 横マス(長軸) k : 宝の数
let m = read (argList !! 0)
n = read (argList !! 1)
k = read (argList !! 2)
putStrLn $ "p1st = " ++ show(mwin m n k) ++ ", q1st = " ++ show(nwin m n k) ++ ", draw = " ++ show(draw m n k)


10×20部屋に宝箱100個の計算も修正

p1st = 15057759425309840160151925452579572328997602171271937639470
q1st = 15057796557877993527038542474310161591275806044157319150135
draw = 60432958672915447478213709150594429954231181459984080051715
0011卵の名無しさん
垢版 |
2018/10/31(水) 21:01:13.96ID:qgJ05S6D
import System.Environment

choose (n,r) = product[1..n] `div` product[1..n-r] `div` product[1..r]

nloc m n k l = do
let q = div (n*k+l) m
r = mod (n*k+l) m
in (n-q)*(m-k) + q-1-l + if r>k then k-r else 0

nwin m n c = sum[choose ((nloc m n k l), c-1) | k<-[0..m-1], l<-[0..n-1], k*(n-1) < l*(m-1)]
mwin m n c = sum[choose ((nloc n m k l), c-1) | k<-[0..n-1], l<-[0..m-1], k*(m-1) < l*(n-1)]
draw m n c = choose(m*n,c) - nwin m n c - mwin m n c

takara m n k = do
putStrLn $ "短軸p1st = " ++ show(mwin m n k)
putStrLn $ "長軸q1st = " ++ show(nwin m n k)
putStrLn $ "同等draw = " ++ show(draw m n k)

main = do
argList <- getArgs -- m : 縦マス(短軸) n : 横マス(長軸) k : 宝の数
let m = read (argList !! 0)
n = read (argList !! 1)
k = read (argList !! 2)
putStrLn $ "p1st = " ++ show(mwin m n k) ++ ", q1st = " ++ show(nwin m n k) ++ ", draw = " ++ show(draw m n k)
0012卵の名無しさん
垢版 |
2018/10/31(水) 21:19:00.08ID:qgJ05S6D
nloc = function(m,n,k,l){
q=(n*k+l)%/%m
r=(n*k+l)%%m
(n-q)*(m-k)+q-1-l + ifelse(r>k,k-r,0)
}


nwin = function(m,n,c){ # m < n, log axis search wins
re=NULL
for(k in 0:(m-1)){
for(l in 0:(n-1)){
if(k*(n-1)<l*(m-1)){
re=append(re,choose(nloc(m,n,k,l),c-1))
}
}
}
sum(re)
}

longer <- function(m,k){
n=m+1
if(nwin(m,n,k) > nwin(n,m,k)) return(TRUE)
if(nwin(m,n,k) < nwin(n,m,k)) return(FALSE)
if(nwin(m,n,k) == nwin(n,m,k)) return(NULL)
}
0013卵の名無しさん
垢版 |
2018/10/31(水) 21:19:18.35ID:qgJ05S6D
pq1 <- function(m){
n=m+1
k=1
di=nwin(m,n,k) - nwin(n,m,k)
while(di<=0){
di=nwin(m,n,k) - nwin(n,m,k)
k=k+1
}
return(k-1)
}

pq <- function(m,Print=FALSE){ # > 0 long axis search wins
n=m+1
x=1:(m*n)
f = function(k) (nwin(m,n,k) - nwin(n,m,k))/choose(m*n,k)
y=sapply(x,f)
if(Print==TRUE){
plot(x,y,pch=19,bty='l',xlab='宝の数', ylab='確率差(長軸-短軸)')
abline(h=0,lty=3)
# print(y,quote=F)
}
z=which(y>0)
c(min(z),max(z))
}
pq(5,P=T)
(nw=cbind(0,sapply(2:20,pq)))
plot(1:20,(2:21)*(1:20),type='n',bty='l',xlab='m(短軸)',ylab='宝の数')
lines(1:20,(2:21)*(1:20),type='h',col='gray',lwd=2)
segments(1:20,nw[1,],1:20,nw[2,],lwd=4)
0015卵の名無しさん
垢版 |
2018/10/31(水) 21:51:01.16ID:qgJ05S6D
先に1個めの宝を見つけるには短軸探索と長軸探索とどちらが有利かは宝の数によって変わるのでグラフにしてみた。
縦5横6のとき宝の数を1から30まで増やして長軸探索が先にみつける確率と短軸探索がさきにみつける確率の差を描いてみた。
http://i.imgur.com/7qGjOJX.png
縦5横6のときだと宝の数は9から21のときが長軸探索が有利となった。
短軸有利→長軸有利→同等となるようで、再逆転はないもよう。
縦m横m+1として長軸探索が有利になる宝の数の上限と下限を算出してみた。

[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,] 0 2 2 6 9 13 17 23 29 36 43 52 61 71 82 93 105 118 132 147
[2,] 0 3 7 13 21 31 43 57 73 88 105 118 135 152 166 185 202 220 242 253

グラフにしてみた。
http://i.imgur.com/PiL9xyH.png
0016卵の名無しさん
垢版 |
2018/10/31(水) 21:57:13.38ID:qgJ05S6D
各人にとってのi 番目をどちらが先にみつけるかを計算してみた。

4×5マスに宝が5個あるとき

> treasures(4,5,5)
p1st q1st even
[1,] 1948 9680 3876
[2,] 5488 10016 0
[3,] 7752 7752 0
[4,] 10016 5488 0
[5,] 9680 1948 3876

1個め2個めは短軸方向探索のQが、4個め5個めは長軸方向探索のPが、先にみつける宝の配置の組み合わせが多い。3個めは同じ。

全体としてはイーブンだが、

勝者は1個めを先にみつけた方にするか、全部を先にみつけた方にするかで結果が変わる。

Rのコードはここに置いたので数値を変えて実行可能。

http://tpcg.io/Ph7TUQ
0017卵の名無しさん
垢版 |
2018/11/01(木) 10:16:30.80ID:ZkYkKASz
こういう解き方していると馬鹿になるなぁ、と
思いつつ便利なので使ってる。
Wolframで方程式を解かせて計算式をスクリプトに組み込むとかやってるな。結果は具体例でシミュレーションして確認。

a,b,cは自然数とする。
このとき、以下の不等式を満たす(a,b,c)が存在するような自然数Nの最大値を求めよ。
N≦a^2+b^2+c^2≦2018

>>311
Nの最大値は2018

顰蹙のプログラム解

Prelude> [(a,b,c)|a<-[1..45],b<-[a..45],c<-[b..45], a^2+b^2+c^2==2018]
[(1,9,44),(3,28,35),(5,12,43),(8,27,35),(9,16,41),(19,19,36),(20,23,33)]
0018卵の名無しさん
垢版 |
2018/11/01(木) 20:03:52.01ID:wy1a0s+b
aのb乗×cのd乗=abcd(abcd は4桁の整数)
abcdに当てはまる数字は?

[(a,b,c,d)|a<-[0..9],b<-[0..9],c<-[0..9],d<-[0..9],a^b*c^d==1000*a+100*b+10*c+d]
0019卵の名無しさん
垢版 |
2018/11/02(金) 00:51:03.46ID:CfCNBter
広島県の福山友愛病院で、
患者の病状と関係ない薬を大量に投与した。
しかも、意図的にです!



国は違うがドイツの場合

裁判所で開かれた公判で、患者100人を殺害した罪を認めた。これでこの事件は、同国で戦後最悪級の連続殺人事件となった。
起訴されたのは、ドイツ北部デルメンホルストとオルデンブルクの病院で看護師をしていたニルス・ヘーゲル受刑者(41)。
当時勤務していたドイツ北部の2つの病院で2000〜2005年にかけ、34〜96歳の患者を殺害したことを認めた。

同受刑者は自分の蘇生措置の腕を同僚に見せびらかす目的や、退屈しのぎの目的で、

↓↓↓↓↓
患者に処方されていない薬を投与していたとされる。
↑↑↑↑↑


ドイツの場合。まあ日本は日本だが・・・
大口の病院は看護士の単独犯だったわけで捕まったが・・・


福山友愛病院は・・・・・

https://youtu.be/BnHYCZqyZKY
0020卵の名無しさん
垢版 |
2018/11/02(金) 14:33:08.95ID:p4Bn/s/z
安倍総理も使っていて警察も使える医療大麻オイル
国連で今月解禁勧告が出されるという
解禁されれば憲法第98条によって大麻取締法が解禁され、店頭への商品陳列、広告表示等、医薬品としての処方ができるようになります
https://plaza.rakuten.co.jp/denkyupikaso/diary/201806090001/
0022卵の名無しさん
垢版 |
2018/11/02(金) 18:53:08.10ID:3zC36uTy
広島県の福山友愛病院で、
患者の病状と関係ない薬を大量に投与した。
しかも、意図的にです!


国は違うがドイツの場合

裁判所で開かれた公判で、患者100人を殺害した罪を認めた。これでこの事件は、同国で戦後最悪級の連続殺人事件となった。
起訴されたのは、ドイツ北部デルメンホルストとオルデンブルクの病院で看護師をしていたニルス・ヘーゲル受刑者(41)。
当時勤務していたドイツ北部の2つの病院で2000〜2005年にかけ、34〜96歳の患者を殺害したことを認めた。

同受刑者は自分の蘇生措置の腕を同僚に見せびらかす目的や、退屈しのぎの目的で、

↓↓↓↓↓
患者に処方されていない薬を投与していたとされる。
↑↑↑↑↑


ドイツの場合。まあ日本は日本だが・・・
大口の病院は看護士の単独犯だったわけで捕まったが・・・


福山友愛病院は・・・・・

https://youtu.be/BnHYCZqyZKY
0024卵の名無しさん
垢版 |
2018/11/03(土) 14:59:39.97ID:UnKdAdmR
国試浪人の事務員は裏口バカだから
レスするだけ無駄である
0025卵の名無しさん
垢版 |
2018/11/03(土) 15:10:46.97ID:Ipwzsvmc
>>24
算数問題の正解でも書いてればド底辺頭脳でも算数くらいできるんだなと見直したかもしれないのにねぇ。を

ジョーカーを含む53枚のトランプをシャッフルした後に順にめくっていってジョーカーがでたら終了とする。
ジョーカーがでるまでにめくったカードの数の総和の期待値はいくらか?

計算上の数理理論値は364になったのだが、確信がもてないので10万回のシミュレーションをやってみた。

シミュレーション
> summary(re)
Min. 1st Qu. Median Mean 3rd Qu. Max.
328.0 354.5 363.0 363.1 370.7 409.5

多分、あっていると思う。

数学板に投稿してみるかな。

おい、ド底辺。364になる計算式を書いてみ!
0026卵の名無しさん
垢版 |
2018/11/03(土) 15:28:40.93ID:Ipwzsvmc
図形の問題って5ch(2Ch)じゃあ、投稿しにくいんだよなぁ。

こんなのも投稿したけど、かなり面倒なので誰も検証もしないし、反証もしないよな。

https://rio2016.5ch.net/test/read.cgi/math/1532824890/90

そういう事情からか、確率や整数の問題はレスがつきやすいね。 まぁ、問題が理解できないとかはないからね

ところが医師板では統計・確率どころか算数ネタにもほとんどレスがこない。

ド底辺シリツの馬鹿だらけってことかなぁ?
0027卵の名無しさん
垢版 |
2018/11/03(土) 17:40:46.36ID:Ipwzsvmc
>>24
レスできるような基礎学力すらないのがシリツ医大卒だといっているだよ。

ジョーカーを含む53枚のトランプをシャッフルした後に順にめくっていってジョーカーがでたら終了とする。
ジョーカーがでるまでにめくったカードの数の総和の期待値はいくらか?

の計算式書いてみ!
0028卵の名無しさん
垢版 |
2018/11/03(土) 18:16:44.41ID:hHITaoGI
臨床統計の問題です

掲示板の1日のレス数の多さは
ネット依存症の重症度の指標となります

この指標を元に医師板の主だった依存症患者を
1日のレス数を数えてピックアップしましょう
0029卵の名無しさん
垢版 |
2018/11/03(土) 18:22:56.04ID:mjfFp3DY
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.
0030卵の名無しさん
垢版 |
2018/11/03(土) 18:37:42.56ID:Ipwzsvmc
>>28
数値を書いたまともな問題も作れないの?

これ答えてみ!

専門医も開業医からも答がでてないから、頭のいいのを示すチャンスだぞ。

Take it or leave it !!


東京医大、本来合格者入学許可へ 今年の受験生50人
2018年10月25日 02時06分
 東京医科大=8月、東京都新宿区
 東京医科大が今年の入試で本来合格ラインを上回っていたのに、不正の影響で不合格となった受験生50人に対し、来年4月の入学を認める方針を固めたことが24日、関係者への取材で分かった。
昨年の本来合格者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%信頼区間を求めよ。
0031卵の名無しさん
垢版 |
2018/11/03(土) 18:38:49.80ID:Ipwzsvmc
>>29

俺が訳した普及の名投稿の英訳じゃん。

推敲歓迎!!
0032卵の名無しさん
垢版 |
2018/11/03(土) 18:39:30.27ID:Ipwzsvmc
>>29

俺が訳した不朽の名投稿の英訳じゃん。

推敲歓迎!!
0033卵の名無しさん
垢版 |
2018/11/04(日) 16:05:31.31ID:T2FQgr1k
臨床統計の問題です

掲示板の1日のレス数の多さは
ネット依存症の重症度の指標となります

この指標を元に医師板の主だった依存症患者を
1日のレス数を数えてピックアップしましょう
0034卵の名無しさん
垢版 |
2018/11/04(日) 17:50:26.40ID:YHVXN37A
>>33
頭の悪そうな投稿だなぁ。
これでも計算してみ!


ド底辺シリツ医大受験生の親に裏口コンサルタントが訪れて裏金額に2つの決め方を提示した。

A: 定額で2000万円
B: サイコロを1の目がでるまでふったときの出た目を合計した値 × 100万円、 例 2,1と続けば300万、6,5,1なら1200万円

問題(1) AとBではどちらが有利か?
問題(2) Bを選択した場合5000万円以上必要になる確率はくらか?


Bで裏金が1億円以上になる確率を計算すると(不定長さ整数が扱えるHaskellは便利だね)

2060507550845146798433160823128452341/202070319366191015160784900114134073344

になったが、これであっているか検算してくれ。
0035卵の名無しさん
垢版 |
2018/11/05(月) 00:16:38.96ID:NIiUrAnG
ここの国では硬貨は7種類流通しています
この7種類の硬貨を使って1円〜70円の70通りの支払いができます
ただし一度に使用できる硬貨は3枚以下(同じ硬貨複数使いは可)です
7種類の硬貨はそれぞれ何円だったのでしょうか?
0036卵の名無しさん
垢版 |
2018/11/05(月) 00:17:21.55ID:NIiUrAnG
>>35
Rでのブルートフォース解
is.1_70 <- function(x){
total=NULL
for(i in x){
for(j in x){
for(k in x){
ijk=i+j+k
if(!(ijk %in% total)) total=append(total,ijk)
}
}
}
all(1:70 %in% total)
}
(続く)
0037卵の名無しさん
垢版 |
2018/11/05(月) 00:18:36.57ID:NIiUrAnG
>>36
M=69
for(a in 0:M){
for(b in a:M){
for(c in b:M){
for(d in c:M){
for(e in d:M){
for(f in e:M){
for(g in f:M){
for(h in g:M){
y=c(a,b,c,d,e,f,g,h)
if(is.1_70(y)) print(y)
}
}
}
}
}
}
}
}
0038卵の名無しさん
垢版 |
2018/11/05(月) 00:19:36.93ID:NIiUrAnG
import Data.List
m = 69
sub x = do
let ijk = filter (<=70).nub $ sort [i+j+k| i<-x,j<-x,k<-x]
all (\y -> elem y ijk ) [0..70]
main = do
print $ [(b,c,d,e,f,g,h)| b<-[0..m],c<-[b..m],d<-[c..m],e<-[d..m],f<-[e..m],g<-[f..m],h<-[g..m],sub [0,b,c,d,e,f,g]]
0039卵の名無しさん
垢版 |
2018/11/05(月) 01:06:35.42ID:NIiUrAnG
>>38
import Data.List
m = 69
sub x = do -- ans=[1,4,5,15,18,27,34]
let ijk = filter (<=70).nub $ sort [i+j+k| i<-x,j<-x,k<-x]
all (\y -> elem y ijk ) [0..70]
main = do
print $ [(1,4,5,e,f,g,h)| e<-[0..m],f<-[e..m],g<-[f..m],h<-[g..m],sub [0,1,4,5,e,f,g,h]] -- 動作確認用
print $ [(b,c,d,e,f,g,h)| b<-[0..m],c<-[b..m],d<-[c..m],e<-[d..m],f<-[e..m],g<-[f..m],h<-[g..m],sub [0,b,c,d,e,f,g,h]]
0040卵の名無しさん
垢版 |
2018/11/05(月) 01:20:29.50ID:NIiUrAnG
数学板に超初心者のコードを書いたら、達人が高速化してくれた。
プログラム解を毛嫌いする向きもあるけど、初心者のコードを改善してくれたり、cに移植してくれたりする人の存在はとてもありがたい。

import Data.List

firstUnavailable x = let y = 0:x in head $([1..71] &#165;&#165;)$nub$sort$[a+b+c|a<-y,b<-y,c<-y]
next x = [n:x|n<-[head x+1..firstUnavailable x]]
xss = iterate (&#165;xs->concat [next x|x<-xs]) [[1]]
isGood x = let y = 0:x in (==70)$length $intersect [1..70]$nub$sort$[a+b+c|a<-y,b<-y,c<-y]

main = do
    print [x|x<-(xss !! 6),isGood x]
0041卵の名無しさん
垢版 |
2018/11/05(月) 01:22:05.62ID:NIiUrAnG
>>40
文字化けを修正

import Data.List

firstUnavailable x = let y = 0:x in head $([1..71] \\)$nub$sort$[a+b+c|a<-y,b<-y,c<-y]
next x = [n:x|n<-[head x+1..firstUnavailable x]]
xss = iterate (\xs->concat [next x|x<-xs]) [[1]]
isGood x = let y = 0:x in (==70)$length $intersect [1..70]$nub$sort$[a+b+c|a<-y,b<-y,c<-y]

main = do
print [x|x<-(xss !! 6),isGood x]
0042卵の名無しさん
垢版 |
2018/11/05(月) 01:34:19.46ID:NIiUrAnG
>>39
-- b=1は自明なので無駄な検索を削除

import Data.List
m = 69
sub x = do -- ans=[1,4,5,15,18,27,34]
let ijk = filter (<=70).nub $ sort [i+j+k| i<-x,j<-x,k<-x]
all (\y -> elem y ijk ) [0..70]
main = do
-- print $ [(1,4,5,e,f,g,h)| e<-[0..m],f<-[e..m],g<-[f..m],h<-[g..m],sub [0,1,4,5,e,f,g,h]] -- 動作確認用
print $ [(1,c,d,e,f,g,h)| c<-[1..m],d<-[c..m],e<-[d..m],f<-[e..m],g<-[f..m],h<-[g..m],sub [0,1,c,d,e,f,g,h]]
0043卵の名無しさん
垢版 |
2018/11/05(月) 07:20:27.85ID:NIiUrAnG
seqN <- function(N=100,K=5){
a=numeric(N)
for(i in 1:K) a[i]=2^(i-1)
for(i in K:(N-1)){
a[i+1]=0
for(j in 0:(K-1)){
a[i+1]=a[i+1]+a[i-j] # recursion formula
}
}

P0=numeric(N)
for(i in 1:N) P0[i]=a[i]/2^i # P0(n)=a(n)/2^n
P0

MP=matrix(rep(NA,N*K),ncol=K)
colnames(MP)=paste0('P',0:(K-1))
MP[,1]=P0
head(MP);tail(MP)
MP[1,2]=1/2
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]=1/2*MP[i,k-1]
} # Pk(n+1)=1/2*P(k-1)(n)
ret=1-apply(MP,1,sum)

ret[N]
}
seqN(100,5)
seqN(1000,10)
0044卵の名無しさん
垢版 |
2018/11/05(月) 07:25:01.84ID:NIiUrAnG
## 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
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]
}
0045卵の名無しさん
垢版 |
2018/11/05(月) 08:16:25.28ID:NIiUrAnG
>>44
# 検算用のシミュレーションスクリプト

seqn<-function(n=10,N=1000,p=0.5){ # N回のうちn回以上続けて表がでるか?
rn=rbinom(N,1,p) # N個の0 or 1を発生させる
count=0 # 1連続カウンター
for(i in 1:N){
if(rn[i] & count<n){ # rn[i]が1でn個続かなければ
count=count+1
}
else{
if(count==n) {return(TRUE)} # n個の1が見つかればTRUEを返して終了
else{
count=0
}
}
}
return(count==n)
}

mean(replicate(10^4,seqn(10,1000,p=0.5)))
0046卵の名無しさん
垢版 |
2018/11/05(月) 12:05:05.46ID:+OxX3fom
事務員さん
0047卵の名無しさん
垢版 |
2018/11/05(月) 12:14:01.00ID:RNxpU/sa
いくらド底辺シリツ医大卒の裏口バカでも
これくらいは計算できるだろ?

ド底辺シリツ医大の裏口入学調査委員会が
裏口入学は高々10%と報告したとする。

その結果の検証に100人を調査したら4人続けて裏口入学生であった、という。
この検証から裏口入学率が10%であるか否かを有意水準5%で検定せよ。
0048卵の名無しさん
垢版 |
2018/11/05(月) 14:38:27.92ID:Lykd2+5F
>>44
seqNp(100,4,1/10)
fm = function(m=5){
f100_m = function(p) seqNp(100,m,p)
pp=seq(0,1,len=100)
plot(pp,sapply(pp,f100_m),type='l',lwd=2)
abline(h=0.05,lty=3)
(p005=uniroot(function(x,u0=0.05) f100_m(x)-u0,c(0.001,1))$root)
}
0049卵の名無しさん
垢版 |
2018/11/05(月) 18:35:02.59ID:Lykd2+5F
トランプのA〜10の10枚とジョーカー1枚の
合計11枚が机の上に裏向きに置いてある。
ランダムに1枚ずつ引いていった場合の、得られた数字の総和の期待値を求めよ。
ただし、ジョーカーを引いた時点で終了するものとし、
Aは数字扱いではなく、最終的に得られた数字の総和が2倍になるものとする。

x=sample(11)
f <- function(x){
i=1
y=numeric()
while(x[i]!=11){
y[i]=x[i]
i=i+1
}
if(1 %in% y) return(2*(sum(y)-1))
else return(sum(y))
}
# simulation
re=replicate(1e6,f(sample(11)))
summary(re)
hist(re,col='lightblue',xlab='sum',main='')

# brute-force
library(gtools)
perm=permutations(11,11)
mean(apply(perm,1,f))
0050卵の名無しさん
垢版 |
2018/11/06(火) 12:33:08.79ID:jkx5i2bQ
n=3
r=8
str=paste(as.character(1:n),collapse='')
f <- function(x) grepl(str,paste(x,collapse=""))
# Brute-Force
library(gtools)
perm=permutations(n,r,rep=T)
sum(apply(perm,1,f))

# Monte-Carlo
k=100
re=replicate(k,sum(replicate(n^r,f(sample(n,r,rep=T)))))
summary(re)
0051卵の名無しさん
垢版 |
2018/11/06(火) 15:40:53.99ID:jkx5i2bQ
コインを1000回投げた。連続して表がでる確率が最も高いのは何回連続するときか?

seq_dice <- function(N=100,k=5,p=1/6){
P=numeric(N)
for(n in 1:(k-1)){
P[n]=0
}
P[k]=p^k
P[k+1]=p^k+(1-p)*p^k
for(n in (k+1):(N-1)){
P[n+1] = P[n] + (1-P[n-k])* p^(k+1)
}
return(P[N])
}
seq_dice()

seq_diceJ <- function(N=100,k=5,p=1/6){ # Just k sequence
seq_dice(N,k,p)-seq_dice(N,k+1,p)
}
seq_diceJ()

#
vsdJ=Vectorize(seq_diceJ)
NN=1000
kk=1:(NN/50)
p=0.5
y=vsdJ(NN,kk,0.5)
which.max(y)
plot(kk,y,bty='l',pch=19,xlab='sequence',ylab='probability')
0052卵の名無しさん
垢版 |
2018/11/06(火) 17:00:36.05ID:QApCAMmZ
f = function(x){
y=paste(x,collapse='')
str="1"
if(!grepl(str,y)) return(0)
else{
while(grepl(str,y)){
str=paste0(str,"1")
}
return(nchar(str)-1)
}
}

x=sample(0:1,20,rep=T) ; x ;f(x)
0053卵の名無しさん
垢版 |
2018/11/06(火) 19:54:04.82ID:jkx5i2bQ
>>51
# 有理数表示したかったのでPythonに移植

from fractions import Fraction

def seq_dice(N,k,p):
P=list()
for n in range(k-1):
P.append(0)
P.append(p**k)
P.append(p**k + (1-p)*p**k)
for n in range (k,N):
P.append(P[n]+(1-P[n-k])*p**(k+1))
return(P[N])

def seq_diceJ(N,k,p):
return(seq_dice(N,k,p) - seq_dice(N,k+1,p))


def dice(N,k,p):
print("Over " + str(k))
print(Fraction(seq_dice(N,k,p)))
print(" = " + str(seq_dice(N,k,p)))
print("Just " + str(k))
print(Fraction(seq_diceJ(N,k,p)))
print(" = " + str(seq_diceJ(N,k,p)))

dice(10000,5,1/6)

# ここで実行可能
# http://tpcg.io/rMOVCB
0054卵の名無しさん
垢版 |
2018/11/06(火) 20:01:05.33ID:jkx5i2bQ
seq_dice <- function(N=100,k=5,p=1/6){
P=numeric(N)
for(n in 1:(k-1)){
P[n]=0
}
P[k]=p^k
P[k+1]=p^k+(1-p)*p^k
for(n in (k+1):(N-1)){
P[n+1] = P[n] + (1-P[n-k])* p^(k+1)
}
return(P[N])
}
seq_dice()

seq_diceJ <- function(N=100,k=5,p=1/6){ # Just k sequence
seq_dice(N,k,p)-seq_dice(N,k+1,p)
}
seq_diceJ()

#
vsdJ=Vectorize(seq_diceJ)
NN=1e6
kk=1:30
p=0.5
y=vsdJ(NN,kk,0.5)
which.max(y) # 1e2:5 1e3:9 1e4:12 1e5:15 1e6:18
plot(kk,y,bty='l',pch=19,xlab='sequence',ylab='probability')
cbind(kk,y)
options(digits=22)
max(y)
0055卵の名無しさん
垢版 |
2018/11/06(火) 20:43:45.42ID:jkx5i2bQ
>>53
泥タブだと普通にみえるが、Win10のPCだと コードのインデントがなくなって左揃えされてしまうなぁ。
0056卵の名無しさん
垢版 |
2018/11/07(水) 00:33:21.67ID:J7bMbWmD
from fractions import Fraction

def dice126(N):
P=list()
for n in range(6):
P.append(1)
P.append(1-1/(6**6))
for n in range(7,N+1):
P.append(P[n-1]-P[n-6]/(6**6))
return(1-P[N])

def dice123456(N):
print(Fraction(dice126(N)))
print(" = " + str(dice126(N)))

dice123456(1000)
0057卵の名無しさん
垢版 |
2018/11/07(水) 03:24:42.61ID:5r6Cuw34
愛の妖精ぷりんてぃん
0058卵の名無しさん
垢版 |
2018/11/07(水) 20:28:13.57ID:J7bMbWmD
# simulation
mhs = function(x){ # maximum head sequence
y=paste(x,collapse='')
str="1"
if(!grepl(str,y)) return(0)
else{
while(grepl(str,y)){
str=paste0(str,"1")
}
return(nchar(str)-1)
}
}

(x=sample(0:1,100,rep=T)) ; mhs(x)

sim <- function(r=4,n=100,ps=c(9/10,1/10)){
mhs(sample(0:1,n,rep=T,prob=ps))>=r
}

mean(replicate(1e5,sim()))
0059卵の名無しさん
垢版 |
2018/11/07(水) 20:32:14.75ID:J7bMbWmD
ド底辺シリツ医大の裏口入学調査委員会が
裏口入学は高々10%と報告したとする。

その結果の検証に100人を調査したら4人続けて裏口入学生であった、という。
この検証から裏口入学率が10%であるか否かを有意水準1%で検定せよ。
0060卵の名無しさん
垢版 |
2018/11/07(水) 21:22:13.74ID:s+v4AjoX
グリーンねえさん
0061卵の名無しさん
垢版 |
2018/11/08(木) 07:40:30.60ID:PGJy3ILP
>>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)
0062卵の名無しさん
垢版 |
2018/11/08(木) 15:06:24.25ID:PGJy3ILP
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]
0063卵の名無しさん
垢版 |
2018/11/08(木) 15:07:58.80ID:PGJy3ILP
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)
0064卵の名無しさん
垢版 |
2018/11/08(木) 16:45:02.14ID:PGJy3ILP
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)
0065卵の名無しさん
垢版 |
2018/11/08(木) 20:38:27.74ID:cpzz/2HM
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.
0066卵の名無しさん
垢版 |
2018/11/08(木) 21:27:55.58ID:PVj0UwaU
Hutanari Ti〇po
0067卵の名無しさん
垢版 |
2018/11/08(木) 22:34:40.76ID:klK7Dgwj
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.
ド底辺特殊シリツ医大卒は裏口入学の負い目から裏口馬鹿を暴く人間を偽医者扱いしたがる。
0068卵の名無しさん
垢版 |
2018/11/08(木) 22:35:56.08ID:klK7Dgwj
第一法則の英文の意図的な文法誤謬を指摘してみ!
0069卵の名無しさん
垢版 |
2018/11/08(木) 22:37:45.15ID:JqNfxHqE
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.
0070卵の名無しさん
垢版 |
2018/11/08(木) 23:56:13.79ID:5CXia8DJ
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.
0071卵の名無しさん
垢版 |
2018/11/09(金) 07:26:09.53ID:guOlTCed
(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
>
0072卵の名無しさん
垢版 |
2018/11/09(金) 07:26:39.67ID:guOlTCed
(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
0073卵の名無しさん
垢版 |
2018/11/09(金) 07:27:42.12ID:guOlTCed
実行速度

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
0074卵の名無しさん
垢版 |
2018/11/09(金) 10:39:09.83ID:mj0MZvbh
「お゙ぉおォおん、お゙ぉおォおんにいぃひゃぁん、大漁らったのぉおお?」
「ぁあああ あぉぁあああ あぉ、大漁らったよお゛お゛お゛ぉ」 「ぁあああ あぉぁぁ゛ぁ゛ぁぁ゛ぁ゛ぁぁ゛ぁ゛ぁあああ あぉぁぁ゛ぁ゛しゅごいぃのぉおおょぉぉぅぃぃっよぉおお゙いぃぃいぃぃ!、、にゃ、にゃにが、、ハァハァにゃにが捕れたのぉおお?」
乳首を舌れやしゃしく舐めにゃがらオレは答えたのぉおお
「…鯛とか、、、ヒラメがいぃっぱいぃ捕れたよお゛お゛お゛ぉ」
セリフを聞き、オジサンはびくんびくんと身体をひきちゅらせたのぉおお
「はっ!はぁぁ゛ぁ゛ぁぁ゛ぁ゛ぁぁ゛ぁ゛ぁあああ あぉんっ!イ、イサキは?イサキは、と、取れたのぉおお??」
「ぁあああ あぉぁあああ あぉ。れかいぃイサキが取れたよお゛お゛お゛ぉ。今年一番のぉおお大漁ら。」
「大漁っ!!イサキぃぃ!!お゙ぉおォおんにいぃひゃぁんかっこいぃぃぃっよぉおお゙いぃぃぃっよぉおお゙ぃぃぃいぃ ぃくううううう!」
0075卵の名無しさん
垢版 |
2018/11/09(金) 13:39:50.75ID:wRJjRrMD
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.
0076卵の名無しさん
垢版 |
2018/11/09(金) 14:43:04.66ID:mj0MZvbh
"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 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! "
0077卵の名無しさん
垢版 |
2018/11/09(金) 14:47:27.17ID:fYz4ML3G
import numpy as np
from fractions import Fraction
# http://tpcg.io/5xvZhU

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])
0078卵の名無しさん
垢版 |
2018/11/09(金) 14:54:20.70ID:fYz4ML3G
RからPythonへの移植がようやく終わった。

確率が分数で表示されるようになった。

配列はRは1からPythonは0から始まるのでその調整に手間取った。

http://tpcg.io/5xvZhU
0079卵の名無しさん
垢版 |
2018/11/09(金) 16:24:27.33ID:fYz4ML3G
"""
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)
"""
0080卵の名無しさん
垢版 |
2018/11/09(金) 18:29:58.21ID:n6Zmr3Yp
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 .
0081卵の名無しさん
垢版 |
2018/11/09(金) 19:01:24.31ID:fYz4ML3G
# 全体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)
0082卵の名無しさん
垢版 |
2018/11/09(金) 19:07:22.92ID:fYz4ML3G
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)
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)
0083卵の名無しさん
垢版 |
2018/11/09(金) 20:27:50.16ID:n7vPLA8Y
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.
0084卵の名無しさん
垢版 |
2018/11/09(金) 21:35:35.51ID:guOlTCed
次の課題はこれだな。

コインを100回投げて表が連続した最大数が10であったとき
このコインの表がでる確率の95%信頼区間はいくらか?
0085卵の名無しさん
垢版 |
2018/11/09(金) 21:59:40.95ID:WU3o6hYa
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.
0086卵の名無しさん
垢版 |
2018/11/09(金) 22:34:31.28ID:fYz4ML3G
>>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

英文コピペで荒らしているド底辺シリツ医大の裏口馬鹿には検算すらできんないだろうな。
0087卵の名無しさん
垢版 |
2018/11/09(金) 22:53:11.07ID:fYz4ML3G
>>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]
}

ここに上げておいた。
http://tpcg.io/kuNvWl
0088卵の名無しさん
垢版 |
2018/11/10(土) 00:19:47.42ID:Kp2aSERi
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.
0089卵の名無しさん
垢版 |
2018/11/10(土) 07:28:52.35ID:qmnilAbW
恵方巻き
0090卵の名無しさん
垢版 |
2018/11/10(土) 07:31:45.66ID:oGLeA9Hd
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.
0091卵の名無しさん
垢版 |
2018/11/10(土) 07:35:47.21ID:Gl2x1zZV
>>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)
}
0092卵の名無しさん
垢版 |
2018/11/10(土) 08:01:47.11ID:qmnilAbW
aiueo700
0093卵の名無しさん
垢版 |
2018/11/10(土) 10:46:19.21ID:MTRtacln
最大連続数を増やしてグラフ化
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')
0094卵の名無しさん
垢版 |
2018/11/10(土) 14:12:44.30ID:u8wDSGVd
幼稚な事務員
0095卵の名無しさん
垢版 |
2018/11/10(土) 14:24:33.17ID:u8wDSGVd
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
0096卵の名無しさん
垢版 |
2018/11/10(土) 15:50:53.19ID:Aj6PTVhz
>>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])
}
0097卵の名無しさん
垢版 |
2018/11/10(土) 15:51:14.92ID:Aj6PTVhz
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]
}
0098卵の名無しさん
垢版 |
2018/11/10(土) 15:52:05.14ID:Aj6PTVhz
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の方が信頼区間幅が小さいのがみてとれる。
0100卵の名無しさん
垢版 |
2018/11/10(土) 18:18:24.26ID:eRQ4an/O
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

あまり、差はないなぁ。
0101卵の名無しさん
垢版 |
2018/11/10(土) 18:48:10.97ID:eRQ4an/O
# 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)
}

確率密度関数を正弦波とか円周にしても計算できるはず。
0102卵の名無しさん
垢版 |
2018/11/10(土) 21:22:19.55ID:BbEZ9aeT
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.
0103卵の名無しさん
垢版 |
2018/11/10(土) 21:35:01.58ID:eRQ4an/O
ド底辺シリツ裏口調査団が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から、平均値と標準偏差がもっと簡単に導出できれば正規分布近似計算できるのだが
まあ、プログラムが組めたから正規分布近似計算する必要はないな。
0104卵の名無しさん
垢版 |
2018/11/10(土) 21:36:25.04ID:eRQ4an/O
>>102
原文はこれな。

私は昭和の時代に大学受験したけど、昔は今よりも差別感が凄く、慶応以外の私立医は特殊民のための特殊学校というイメージで開業医のバカ息子以外は誰も受験しようとすらしなかった。
常識的に考えて、数千万という法外な金を払って、しかも同業者からも患者からもバカだの裏口だのと散々罵られるのをわかって好き好んで私立医に行く同級生は一人もいませんでした。
本人には面と向かっては言わないけれど、俺くらいの年代の人間は、おそらくは8−9割は私立卒を今でも「何偉そうなこと抜かしてるんだ、この裏口バカが」と心の底で軽蔑し、嘲笑しているよ。当の本人には面と向かっては絶対にそんなことは言わないけどね。
0105卵の名無しさん
垢版 |
2018/11/10(土) 21:48:48.87ID:0/hxM8VF
作 牧村みき
0106卵の名無しさん
垢版 |
2018/11/10(土) 22:53:57.75ID:eRQ4an/O
開脚率の期待値を計算してみた。

ゆるゆる女子大生の開脚率期待値: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)
0107卵の名無しさん
垢版 |
2018/11/10(土) 22:58:20.05ID:eRQ4an/O
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)

累積質量関数をグラフにすると
http://imagizer.imageshack.com/img924/9020/nxNiAP.jpg
0108卵の名無しさん
垢版 |
2018/11/11(日) 04:47:59.95ID:3fp/Z1Bf
NNN臨時放送
0109卵の名無しさん
垢版 |
2018/11/11(日) 08:25:49.13ID:8Ef5Z4Y6
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.
0110卵の名無しさん
垢版 |
2018/11/11(日) 08:58:08.11ID:g+y24FcC
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.
0111卵の名無しさん
垢版 |
2018/11/11(日) 11:04:24.83ID:RT24eksu
東京医大、本来合格者入学許可へ 今年の受験生50人

2018年10月25日 02時06分
 東京医科大=8月、東京都新宿区
 東京医科大が今年の入試で本来合格ラインを上回っていたのに、不正の影響で不合格となった受験生50人に対し、来年4月の入学を認める方針を固めたことが24日、関係者への取材で分かった。
昨年の本来合格者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%信頼区間を求めよ。
0112卵の名無しさん
垢版 |
2018/11/11(日) 11:06:42.03ID:RT24eksu
>>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%信頼区間を述べよ。
0113卵の名無しさん
垢版 |
2018/11/11(日) 11:07:30.56ID:RT24eksu
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)
0114卵の名無しさん
垢版 |
2018/11/11(日) 11:08:29.37ID:RT24eksu
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 ) )
}
0115卵の名無しさん
垢版 |
2018/11/11(日) 11:35:36.92ID:RT24eksu
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')
0116卵の名無しさん
垢版 |
2018/11/11(日) 11:42:28.36ID:RT24eksu
>>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

で今年と去年で裏口率が有意に異なることになるのだが、裏口入学者を除籍処分しないようなシリツ医大の発表は盲信できないね。
0117卵の名無しさん
垢版 |
2018/11/11(日) 13:44:05.86ID:RT24eksu
あるタクシー会社のタクシーには1から通し番号がふられている。
タクシー会社の規模から保有タクシー台数は100台以下とわかっている。
この会社のタクシーを5台みかけた。最大の番号が60であった。
この会社の保有するタクシー台数の期待値を分数で答えよ

数値は同じで問題をアレンジ。

あるど底辺シリツ医大の裏口入学者には背中に1から通し番号がふられている。
一学年の定員は100人である。
裏口入学5人の番号のうち最大の番号が60であった。
この学年の裏口入学者数の期待値を分数で答えよ。

小数だと71.48850431950537
0118卵の名無しさん
垢版 |
2018/11/11(日) 13:44:55.16ID:RT24eksu
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)
0119卵の名無しさん
垢版 |
2018/11/11(日) 13:45:47.68ID:RT24eksu
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)
で済むが 分数では算出できず
0120卵の名無しさん
垢版 |
2018/11/11(日) 13:58:43.34ID:RT24eksu
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
0121卵の名無しさん
垢版 |
2018/11/11(日) 13:59:57.00ID:RT24eksu
> 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
0122卵の名無しさん
垢版 |
2018/11/11(日) 14:00:49.27ID:4SxoNh8o
いあいあ ふんぐるい むぐるうなふ くとぅるう るるいえ うがふなぐる ふたぐん
0123卵の名無しさん
垢版 |
2018/11/11(日) 14:11:25.14ID:RT24eksu
# 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)))
0124卵の名無しさん
垢版 |
2018/11/11(日) 14:12:42.99ID:RT24eksu
5030556272103101/70368744177664
71.48850431950537
93

結果は、同じだが分数計算が他の人の結果との照合に便利
0125卵の名無しさん
垢版 |
2018/11/11(日) 14:15:53.17ID:4SxoNh8o
エコエコアザラク エコエコザメラク
地獄のキュエーン
0126卵の名無しさん
垢版 |
2018/11/11(日) 14:21:08.06ID:4SxoNh8o
算数の問題です
円周率をサンスクリット語で暗唱せよ
0127卵の名無しさん
垢版 |
2018/11/11(日) 15:38:32.90ID:RT24eksu
コインを1000万回投げた。連続して表がでる確率が最も高いのは何回連続するときか?

最大値をとるときの確率は 
4456779119136417/18014398509481984
= 0.2474009396866937
となったがあっているか?

数字を0と1を書いて数を数えて割り算するだけ。
3010300桁の数の集計する単純作業だから、おまえにもできるだろ?
0129卵の名無しさん
垢版 |
2018/11/11(日) 16:11:54.59ID:BgP7Mpr0
いやー、昨日のセカンドはやられました。はめられました。
第一ロッター・・・・・小カタメ少なめ 第二ロッター・・・・・小カタメ
第三ロッター・・・・・小カタメ麺半分 第四ロッター(俺)・・・大

見事デスロットです。今思うと前の三人、確信犯だったと思う。
知り合い同士みたいだったし(てかよく見る奴らw)、第三ロッターのメガネが俺の食券見た後、前二人とひそひそ喋ってた。
『あいつ、ロット乱しにして恥かかしてやらない?w』こんな会話してたんだろうな・・・
いつも大を相手にしてる俺に嫉妬してんだろうな。。陰険なやり方だよ。正々堂々と二郎で勝負しろよ。
0130青戸6丁目住民は超変態バカップルを許さまじ食糞協会長:宇野壽倫
垢版 |
2018/11/11(日) 16:35:14.78ID:eesLUl6p
★★【盗聴盗撮犯罪者・井口千明(東京都葛飾区青戸6−23−17)の激白】★★

☆食糞ソムリエ・高添沼田の親父☆ &☆変態メス豚家畜・清水婆婆☆の超変態不倫バカップル
  東京都葛飾区青戸6−26−6        東京都葛飾区青戸6−23−19

盗聴盗撮つきまとい嫌がらせ犯罪者/食糞ソムリエ・高添沼田の親父の愛人変態メス豚家畜清水婆婆(青戸6−23−19)の
五十路後半強制脱糞
http://img.erogazou-pinkline.com/img/2169/scatology_anal_injection-2169-027.jpg


⊂⌒ヽ            γ⌒⊃
  \ \  彡 ⌒ ミ   / /
    \ \_<(゚)д(゚)>_./ /  食糞ソムリエ・高添沼田の親父どえーす 一家そろって低学歴どえーす 孫も例外なく阿呆どえーす
      \ \_∩_/ /    東京都葛飾区青戸6−26−6に住んどりマッスル
      /(  (::)(::)  )\    盗聴盗撮つきまとい嫌がらせの犯罪をしておりマッスル
    ⊂_/ ヽ_,*、_ノ \_⊃      くれぐれも警察に密告しないでくらはい お願いしまふ
 ̄][ ̄ ̄]            [ ̄ ̄][ ̄
 ̄ ̄][ ̄]            [ ̄][ ̄ ̄
 ̄][ ̄ ̄]            [ ̄ ̄][ ̄
 ̄ ̄][ ̄]            [ ̄][ ̄ ̄
 ̄][ ̄ ̄]            [ ̄ ̄][ ̄
"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~
0131卵の名無しさん
垢版 |
2018/11/11(日) 17:42:34.02ID:RT24eksu
# 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
0132卵の名無しさん
垢版 |
2018/11/11(日) 18:43:47.27ID:RT24eksu
#include <stdio.h>
#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;
}
0133卵の名無しさん
垢版 |
2018/11/11(日) 18:53:11.12ID:RT24eksu
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)
0134卵の名無しさん
垢版 |
2018/11/11(日) 22:42:42.63ID:UCMkX/If
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.
0135卵の名無しさん
垢版 |
2018/11/12(月) 00:48:13.50ID:G7wSOjAG
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.
0136卵の名無しさん
垢版 |
2018/11/12(月) 02:39:48.77ID:+DPZ0e9S
臨床問題です
事務員のアスペ指数を計測せよ
0137卵の名無しさん
垢版 |
2018/11/12(月) 07:17:09.02ID:KUf7IfSV
>>136
前提が間違っているから
Zero Division Errorだね。

宿題まだか?
数を増やした次の問題が控えているぞ。
コインを1億回投げた。連続して表がでる確率が最も高いのは何回連続するときか?

その確率は
2246038053550679/9007199254740992
= 0.24936031612362342
な。

きちんと検算してから、臨床統計スレに書き込めよ。
0138卵の名無しさん
垢版 |
2018/11/12(月) 07:46:46.08ID:fhdQROV/
誰からも相手にされない ド底辺事務員
0140卵の名無しさん
垢版 |
2018/11/12(月) 13:48:23.85ID:Xm/n5tCK
この問題、俺にはプログラミング解が精いっぱい。
解析解出せる頭脳は尊敬するな。


N枚のコインを投げて表が連続する確率が最も大きい回数をsとする。
例:N=10でs=2、N=15でs=3
(1) N=777のときのsを述べよ。
(2)s=7となるNの範囲を述べよ。
0141卵の名無しさん
垢版 |
2018/11/12(月) 15:10:55.63ID:gzeh1x/+
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)
}
"
0142卵の名無しさん
垢版 |
2018/11/12(月) 15:11:23.82ID:gzeh1x/+
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="留年確率")
0144卵の名無しさん
垢版 |
2018/11/12(月) 16:56:10.68ID:gzeh1x/+
>>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)
0145卵の名無しさん
垢版 |
2018/11/12(月) 17:01:57.91ID:gzeh1x/+
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)
0146卵の名無しさん
垢版 |
2018/11/12(月) 19:51:10.36ID:UwZfq4Lo
"マラソン大会の選手に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)

これを検証するシミュレーションプログラムを作れ、というのが課題。
0147卵の名無しさん
垢版 |
2018/11/12(月) 20:57:04.94ID:UwZfq4Lo
>>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
0148卵の名無しさん
垢版 |
2018/11/12(月) 21:48:58.46ID:UwZfq4Lo
最大値でなく平均値が与えられたときの参加人数の推定、

"マラソン大会の選手に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))])) # 最頻値
0149卵の名無しさん
垢版 |
2018/11/12(月) 21:53:15.51ID:UwZfq4Lo
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
0150卵の名無しさん
垢版 |
2018/11/12(月) 22:54:15.54ID:3/93pSbh
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.
0151卵の名無しさん
垢版 |
2018/11/13(火) 08:24:34.99ID:kjupm458
このスレは事務員が日がな一日妄想を垂れ流し
見物人たちがそれを見てフルボッコにするスレである

事務員 とは?
同一者の別名として、薄汚いジジイ、国試浪人、統計野郎、自称医科歯科、がある
自称医科歯科卒、実際は九州の駅弁国立出身で、卒業後は実家の東京に帰り国試浪人となり23年間経過、家庭教師バイトなどを経て現在は事務員、とされている
本人は、勤務医でたまに開業医の手伝いと内視鏡バイト、専門医なし、と主張しているが、連日連夜の異常な書き込み数の多さからは、勤務医とは考え難く、彼の職業がたとえ何であったとしても、人としてド底辺なことは間違いがない
自ら事務員であると告白したこともある
https://egg.5ch.net/test/read.cgi/hosp/1531459372/108-109
が、事務員であることも疑わしい
実際はナマポかニートの可能性が高い
自分の主張に対して都合の悪い突込みが入ると、相手を私立医と決めつけて、さてはシリツだな、裏口バカ、というセリフでワンパターンに返すことが多い
国試問題を挙げて簡単だとほざいてますが、本番で通らなければお話になりません
いくらネットでわめいていても、医師国試の本番で通らなければお話になりません
大事なことなので2回言いました
0152卵の名無しさん
垢版 |
2018/11/13(火) 09:07:06.76ID:UTrDDuDZ
>>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.
ド底辺特殊シリツ医大卒は裏口入学の負い目から裏口馬鹿を暴く人間を偽医者扱いしたがる。
0153卵の名無しさん
垢版 |
2018/11/13(火) 09:19:46.34ID:UTrDDuDZ
平均値を「四捨五入」するか、しないかを指定できるようにして
平均値が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')
0154卵の名無しさん
垢版 |
2018/11/13(火) 11:31:17.33ID:UTrDDuDZ
ド底辺シリツ医大のある学年にひとりずつ裏口入学登録証があることが判明したがその数は公表されていないとする。
ある裏口入学調査員が無作為に10枚選んで番号を記録して元に戻した。
別の裏口入学調査員が無作為に20枚選んで番号を記録してして元に戻した。
二人の調査官の記録した番号を照合すると3人分の番号が一致していた。
この情報からこの学年の裏口入学者数の95%信頼区間を求めよ。
0155卵の名無しさん
垢版 |
2018/11/13(火) 14:13:47.83ID:UTrDDuDZ
固有の番号の書かれたカードが何枚あり、
その枚数は1000枚以下であることはわかっているが、その数を推定したい。
調査員が無作為に10枚選んで番号を記録して元に戻した。
別の調査員が無作為に20枚選んで番号を記録した。
二人の調査員の記録した番号を照合すると3人分の番号が一致していた。
この情報からカード枚数の期待値と95%信頼区間を求めよ。
0156卵の名無しさん
垢版 |
2018/11/13(火) 14:58:33.48ID:EZEaUTrv
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.
0157卵の名無しさん
垢版 |
2018/11/13(火) 19:31:39.92ID:DHMhO4WL
二郎をすすりつつ裏口事務員をさわさわと触る
「お、おにいちゃん、大漁だった?」
「ああ、大漁だったよ」
「あぁぁぁあぁすごいいいぃいぃ!、、な、なにが、、ハァハァなにが捕れたの?」
焼豚を舌でやさしく舐めながら国試浪人は答えた
「…鯛とか、、、ヒラメがいっぱい捕れたよ」
セリフを聞き、オジサンはびくんびくんと身体をひきつらせた
「はっ!はぁぁぁあんっ!イ、イサキは?イサキは、と、取れたの??」
ド底辺事務員をしごく
「ああ。でかいイサキが取れたよ。今年一番の大漁だ。」
「大漁っ!!イサキぃぃ!!おにいちゃんかっこいいいいぃぃぃい ぃくううううう!」
0158卵の名無しさん
垢版 |
2018/11/13(火) 19:46:29.89ID:WZBh4CIg
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.
0159卵の名無しさん
垢版 |
2018/11/13(火) 20:23:20.79ID:DHMhO4WL
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!"
0160卵の名無しさん
垢版 |
2018/11/13(火) 22:51:51.61ID:UlWlhoup
ここは くるくるぱー アスペ 事務員が
ナゾナゾを出したり アプリ翻訳したインチキ英語で
自作自演したりするスレです
0161卵の名無しさん
垢版 |
2018/11/13(火) 23:30:56.92ID:fLfkvliu
>155の計算結果は最頻値と期待値が大幅に乖離するので
計算に自信が持てずシミュレーションとの合致でようやく納得。
数学板に貼ったら2時間で期待値のHaskellでの算出値のレスが来た。それで信頼区間も確信を持って計算できた。
確率密度はこんな感じなので期待値と最頻値がずれるわけだな。
http://i.imgur.com/paJnhr9.png
0162卵の名無しさん
垢版 |
2018/11/13(火) 23:40:50.36ID:fLfkvliu
>>160
>155の算出式書けばド底辺シリツ医大卒でも基礎学力があると示せるのに裏口馬鹿を実証してどうすんの?
Rのスクリプトすら読めない裏口バカなんだろ?
0163卵の名無しさん
垢版 |
2018/11/14(水) 00:11:47.97ID:kAqwthFw
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
0164卵の名無しさん
垢版 |
2018/11/14(水) 00:35:23.31ID:lTkyjX2F
>>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)
0165卵の名無しさん
垢版 |
2018/11/14(水) 02:35:34.04ID:n/IxbzB4
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.
0166卵の名無しさん
垢版 |
2018/11/14(水) 08:49:20.67ID:PJxL6X2W
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.
0167卵の名無しさん
垢版 |
2018/11/14(水) 20:59:26.07ID:lTkyjX2F
医師国家試験にこういうの問題を出してシリツ医大の裏口馬鹿を排除すればいいのにね。

2人が自転車に乗って走っている。その速さの比は11:8である。この2人が周囲480mの円形の池の同じ地点から同時に同方向にスタートしてまわるとき、速い人は遅い人を4分ごとに追い越す。2人の毎分の速さを求めよ
0168卵の名無しさん
垢版 |
2018/11/14(水) 21:03:30.39ID:Q+EwHwPp
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.
0169卵の名無しさん
垢版 |
2018/11/14(水) 21:26:14.73ID:zDUHf0ws
ド底辺事務員の今日のおかず

くいこみ戦隊ブルマちゃん
0170卵の名無しさん
垢版 |
2018/11/15(木) 08:47:29.19ID:MoyC03l0
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
0171卵の名無しさん
垢版 |
2018/11/15(木) 12:20:42.85ID:d0+yWFff
draft


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]))
}
0172卵の名無しさん
垢版 |
2018/11/15(木) 14:10:09.98ID:0BjfilY2
実際こんな職員が病院にいたら大変だね

以前に病院のパソコンにスマホつないで充電したり動画を見たりしている職員がいたが

この事務員も同レベルのカスなんだろうな
0173卵の名無しさん
垢版 |
2018/11/15(木) 18:50:09.51ID:u639IIxL
 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;
}
0174卵の名無しさん
垢版 |
2018/11/15(木) 18:50:25.10ID:u639IIxL
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))
}
}
}
0175卵の名無しさん
垢版 |
2018/11/15(木) 18:52:29.96ID:u639IIxL
>>172
残念ながら、事務員じゃないのね。
こういうの書いているの俺な。

内視鏡検査について Part.2 [無断転載禁止](c)2ch.net
https://egg.5ch.net/test/read.cgi/hosp/1499746033/875

875 名前:卵の名無しさん[sage] 投稿日:2018/11/14(水) 20:29:50.55 ID:lTkyjX2F
>>874
俺は肝弯より脾損傷の方がやだね。
開腹手術での受動時の経験と透視でのファイバーの動きを見る機会があるとこんなに可動性あったっけとか思う。
幸い脾損傷の経験はないけど、検査後に左肩への放散痛があったら疑わなくてはと思っている。
0176卵の名無しさん
垢版 |
2018/11/15(木) 18:56:08.04ID:u639IIxL
手技の議論だけじゃなくて、こういう計算もできる。
せっかく、一般解がだせるようにプログラムまで組んだやったんだがなぁ。


【現役医師】専門医資格取得について、どうお考えですか? 第2章
https://egg.5ch.net/test/read.cgi/hosp/1539580796/69

69 名前:卵の名無しさん[sage] 投稿日:2018/10/23(火) 07:30:15.27 ID:RnIgsz+6
前スレで誰も正解出せなかった、
door to balloon timeが短縮するのに必要な計算問題を
解ける専門医いる?
(数値を変えても計算できるプログラムは前スレ参照、
プログラムを読めた専門医はいなかったらしくそれへのレスなし)

診療所から病院に患者を救急搬送する。
病院から医師搭乗の救急車が診療所に向かっており10時到着予定と連絡が入った。
患者の病態が悪化したら、診療所の普通車で病院に向かい救急車と出会ったら
救急車に患者を移して搬送し病院到着を急ぐという計画を立てた。
普通車から救急車への患者の乗り換えで10分余分に時間がかかる。
道路事情から救急車は病院から診療所への道は
平均時速60kmで、逆方向は平均時速45kmで定速走行する。診療所の普通車は信号待ちもあり平均時速30kmで定速走行する。

何時以降の病態悪化は診療所の車を使わずに救急車の到着を待つ方が病院に早く着くか?
0177卵の名無しさん
垢版 |
2018/11/15(木) 19:08:50.01ID:u639IIxL
>>174
配列の要素ごとの演算をしてくれるRが使い勝手がいいなぁ。
シミュレーターとして使うのは遅いけど。
0179卵の名無しさん
垢版 |
2018/11/15(木) 19:26:12.08ID:0BjfilY2
医師なら事務員というワードには反応しないよねW
0182卵の名無しさん
垢版 |
2018/11/15(木) 20:01:27.27ID:u639IIxL
>>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
0183卵の名無しさん
垢版 |
2018/11/15(木) 20:14:47.02ID:0BjfilY2
今日も事務員は発狂中

他のスレでは既読スルーされてて
誰も反応なんかしていないよねW






とか書くと
また自作自演しまくるんだろうなー
0184卵の名無しさん
垢版 |
2018/11/15(木) 20:33:45.90ID:LT687Ilf
>>183
あらら、>167に即答できないって相当頭が悪いぞ。
裏口入学??
0185卵の名無しさん
垢版 |
2018/11/15(木) 20:36:16.18ID:LT687Ilf
専門医スレで誰も正当できなかった>176の方に答えてくれてもいいぞ、国立卒ならこれくらいの四則演算はできるだろ?
0186卵の名無しさん
垢版 |
2018/11/15(木) 20:58:27.02ID:ziKbMPPq
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.
0187卵の名無しさん
垢版 |
2018/11/15(木) 22:03:57.30ID:u639IIxL
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)
}
0188卵の名無しさん
垢版 |
2018/11/15(木) 22:05:46.83ID:u639IIxL
>>186
which deserves to be called a bona fide moron は何故、whoでなくて文法破格のwhichが用いられているか、その理由を述べてみ!
0189卵の名無しさん
垢版 |
2018/11/15(木) 22:20:49.26ID:u639IIxL
>>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))
0190卵の名無しさん
垢版 |
2018/11/15(木) 22:51:18.47ID:u639IIxL
(1)
池の鯉を網で56匹すくいました。
すくった56匹に目印をつけ、池にもどしました。
次の日に鯉45匹をすくったところ、36匹に目印がついていました。
池の鯉はおよそ何匹ですか。

(2)
固有の番号の書かれたカードが何枚あり、
その枚数は1000枚以下であることはわかっているが、その数を推定したい。
調査員が無作為に10枚選んで番号を記録して元に戻した。
別の調査員が無作為に20枚選んで番号を記録した。
二人の調査員の記録した番号を照合すると3枚の番号が一致していた。
この情報からカード枚数の最頻値、期待値とその95%信頼区間を求めよ。


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

再捕獲法での個体数推定の限界だな。
0191卵の名無しさん
垢版 |
2018/11/15(木) 23:19:30.11ID:u639IIxL
池の鯉を網で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)
0192卵の名無しさん
垢版 |
2018/11/15(木) 23:24:03.77ID:u639IIxL
>>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)
}
0193卵の名無しさん
垢版 |
2018/11/15(木) 23:36:45.82ID:aG6lkqvZ
>>183
鉄則を思い出しましょう

算数事務員はド底辺の裏口バカだから
対話するだけムダである
0194卵の名無しさん
垢版 |
2018/11/15(木) 23:40:32.65ID:u639IIxL
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))
0195卵の名無しさん
垢版 |
2018/11/15(木) 23:43:20.76ID:u639IIxL
>>193
そんなの書く暇があれば、これくらい即答できるはずなのに。

2人が自転車に乗って走っている。その速さの比は11:8である。
この2人が周囲480mの円形の池の同じ地点から同時に同方向にスタートしてまわるとき、速い人は遅い人を4分ごとに追い越す。
2人の毎分の速さを求めよ

即答できないって、馬鹿なんだね。
0196卵の名無しさん
垢版 |
2018/11/15(木) 23:43:55.25ID:u639IIxL
専門医スレで誰も正当できなかった>176の方に答えてくれてもいいぞ、国立卒ならこれくらいの四則演算はできるだろ?
0197卵の名無しさん
垢版 |
2018/11/15(木) 23:55:08.72ID:kjgKXvFf
正当 WWW

発狂バカが やりがちの 漢字誤変換 WWW
0198卵の名無しさん
垢版 |
2018/11/16(金) 00:19:20.47ID:CpQxI30j
>>197
そういう指摘する暇があれば即答すればいいのに
やっぱり馬鹿なのね。
0199卵の名無しさん
垢版 |
2018/11/16(金) 14:34:20.45ID:OhMUxuM/
覆面算の □/□ * □/□ = □□/□ 
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
0201卵の名無しさん
垢版 |
2018/11/16(金) 15:29:32.07ID:OhMUxuM/
これは最大値・最小値を求めてから組み合わせを出すことになるから時間がかかるなぁ。

-- 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)
-}
0202卵の名無しさん
垢版 |
2018/11/16(金) 16:11:47.91ID:OhMUxuM/
バックグラウンで放置してたら計算してくれていた。

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]]
0203卵の名無しさん
垢版 |
2018/11/16(金) 18:23:07.05ID:CpQxI30j
>>191
数学板にこの問題とpythonのコードを貼ったら
ちゃんとコード内の関数を読んでレスがきた。

このスレだと漢字の誤変換を指摘するしかできないアホしかいない。

誤変換の指摘を書く暇があれば、これくらい即答できるはずなのに。それもできない馬鹿なのか?裏口入学かな?

2人が自転車に乗って走っている。その速さの比は11:8である。
この2人が周囲480mの円形の池の同じ地点から同時に同方向にスタートしてまわるとき、速い人は遅い人を4分ごとに追い越す。
2人の毎分の速さを求めよ
0204卵の名無しさん
垢版 |
2018/11/16(金) 19:16:23.53ID:lLHsnLDJ
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.
0205卵の名無しさん
垢版 |
2018/11/16(金) 20:56:38.81ID:CpQxI30j
>>203

池の鯉を網で56匹すくいました。
すくった56匹に目印をつけ、池にもどしました。
次の日に鯉45匹をすくったところ、36匹に目印がついていました。
池の鯉はおよそ何匹ですか。


魚の総数を上限1万匹とし、その確率分布は一様分布を仮定。

再捕獲した45匹中何匹に目印がついているかで推測される95%信頼区間(Highest Density Interval)をグラフにしてみた。

http://i.imgur.com/NKcQ61u.png

Rのコードはここに置いた(通知を変えて実行できる)

http://tpcg.io/TBD7MO
0206卵の名無しさん
垢版 |
2018/11/16(金) 22:01:15.87ID:7kS528uk
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
0207卵の名無しさん
垢版 |
2018/11/16(金) 22:37:20.95ID:STS/8KrX
僕らの おち○ぽ
0208卵の名無しさん
垢版 |
2018/11/17(土) 09:18:23.91ID:Xiv5Sp0o
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.
0209卵の名無しさん
垢版 |
2018/11/17(土) 10:15:28.71ID:Vs5/CoAG
>>205
池の鯉の総数と調査します。
五郎君が名前に因んで56匹を捕まえて目印をつけ、池にもどしました。
次の日に三郎君が自分の名前に因んで36匹の目印のついた鯉を捕まえることにしました。
鯉45匹めで予定の36匹が捕まりました。
池の鯉はおよそ何匹ですか。

負の二項分布で計算するとこっちはモード値が70の1個なんだなぁ。
0210卵の名無しさん
垢版 |
2018/11/17(土) 10:26:00.26ID:Vs5/CoAG
>>209
このときの推測数の信頼区間の算出が次の課題だな。
3匹目印鯉捕獲目標が45匹目で達成されたときと比較したい。
0212卵の名無しさん
垢版 |
2018/11/17(土) 10:51:40.44ID:Vs5/CoAG
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)
0213卵の名無しさん
垢版 |
2018/11/17(土) 12:29:55.67ID:MdaDRZ5p
非対称分布の信頼区間算出にパッケージないのかな?

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)
}
0214卵の名無しさん
垢版 |
2018/11/17(土) 13:55:53.88ID:ZSsSLaRh
>>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
0215卵の名無しさん
垢版 |
2018/11/17(土) 13:56:56.74ID:ZSsSLaRh
> 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

負の二項分布でも超幾何分布のときとさほど変わらないなぁ
0216卵の名無しさん
垢版 |
2018/11/17(土) 14:05:11.77ID:oN/r/5pI
さて来週の3本は

よくもこんな〇〇〇〇レコードを
これから毎日スレ上げしようぜ
んほおぉぉぉおぉぉ

でお送りしま~す、んっわっほっぅ
0217純粋大和
垢版 |
2018/11/17(土) 14:17:58.42ID:bEfId4t4
どうせ助からない(死ぬ奴)の集まりかよ 笑
0218卵の名無しさん
垢版 |
2018/11/17(土) 17:37:00.95ID:ZSsSLaRh
数学板のこれ面白かった。情報量とか調べながら解答してきた。

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)の答えを出すまでの計算過程を教えていただきたいです。
よろしくお願い致します。
0219卵の名無しさん
垢版 |
2018/11/17(土) 17:38:33.02ID:ZSsSLaRh
数時間潰しての結果がこれ、わずか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
0220卵の名無しさん
垢版 |
2018/11/17(土) 18:43:39.12ID:ZSsSLaRh
>>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]
0221卵の名無しさん
垢版 |
2018/11/17(土) 19:20:41.23ID:XNk+eTpQ
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.
0222卵の名無しさん
垢版 |
2018/11/17(土) 20:12:01.95ID:ZSsSLaRh
# https://logics-of-blue.com/information-theory-basic/
"予想がつかない→不確実性(情報エントロピー)が大きい→平均情報量も大きい"
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)))
}
# 相互情報量は不確実性(情報エントロピー)の減少量とみなすことができます
0223卵の名無しさん
垢版 |
2018/11/17(土) 21:45:47.30ID:ZSsSLaRh
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
0224卵の名無しさん
垢版 |
2018/11/17(土) 21:50:36.68ID:ZSsSLaRh
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
0225卵の名無しさん
垢版 |
2018/11/17(土) 23:42:40.77ID:7FfFKHDd
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.
0226卵の名無しさん
垢版 |
2018/11/18(日) 06:08:27.82ID:YaOZKwLp
事務員で遊ぶのも飽きてきたし
そろそろコミケの原稿を書き始めなきゃなぁ
0227卵の名無しさん
垢版 |
2018/11/18(日) 06:55:57.87ID:deJ1Cp/X
中学入試を難問化した問題で遊んでみる。

池の鯉を網で56匹すくいました。
すくった56匹に目印をつけ、池にもどしました。
次の日に鯉45匹をすくったところ、36匹に目印がついていました。
(1)池の鯉の鯉の数の最尤値を述べよ(2つある)。
(2)最尤値が2つあるのは何匹の目印鯉が捕獲されたときか述べよ。
0228卵の名無しさん
垢版 |
2018/11/18(日) 08:16:59.52ID:afl5ZxKK
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.
0229卵の名無しさん
垢版 |
2018/11/18(日) 10:01:00.69ID:deJ1Cp/X
>>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]
0230卵の名無しさん
垢版 |
2018/11/18(日) 11:18:38.60ID:uPZ4H5RS
>>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)
}
0231卵の名無しさん
垢版 |
2018/11/18(日) 11:18:46.99ID:uPZ4H5RS
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)
}
0232卵の名無しさん
垢版 |
2018/11/18(日) 11:19:33.02ID:uPZ4H5RS
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=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
0234卵の名無しさん
垢版 |
2018/11/18(日) 13:29:06.59ID:uPZ4H5RS
>>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))))
0235卵の名無しさん
垢版 |
2018/11/18(日) 17:41:08.98ID:uPZ4H5RS
>>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]))))
0236卵の名無しさん
垢版 |
2018/11/19(月) 00:27:20.08ID:6+hS1SxI
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
0237卵の名無しさん
垢版 |
2018/11/19(月) 06:06:04.36ID:tA4kj3ba
2^3はpythonで1を返す
ビット演算子(~, &, |, ^, <<, >>)
2**3 か pow(2,3)で冪乗
0240卵の名無しさん
垢版 |
2018/11/19(月) 07:27:32.80ID:tA4kj3ba
>>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)]
0241卵の名無しさん
垢版 |
2018/11/19(月) 07:29:17.17ID:tA4kj3ba
>>240

問題はこれ

問題 : 4 リットルと 3 リットルの容器を使って 2 リットルの水を測るにはどうすればいい?
0242卵の名無しさん
垢版 |
2018/11/19(月) 07:31:08.11ID:tA4kj3ba
こっちの方が断然、難関。

油分け算

[問題] 油分け算

14 リットルの容器 A に油が満杯に入っています。これを 11 リットルの容器 B と 3 リットルの容器 C を使って二等分してください。
容器 A と B には 7 リットルずつ油が入ります。油を二等分する最短手順を求めてください。

容器 B と C のサイズが 9 リットルと 5 リットルの場合の手順は?
0243卵の名無しさん
垢版 |
2018/11/19(月) 08:12:59.88ID:tA4kj3ba
>>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 > ymax) 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
0244卵の名無しさん
垢版 |
2018/11/19(月) 08:25:49.04ID:tA4kj3ba
>>239
これは可能な組み合わせを列挙しているだけで必ずしも手順をしめすプログラムじゃないな。
0245卵の名無しさん
垢版 |
2018/11/19(月) 08:30:40.71ID:L6cqzabr
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
0246卵の名無しさん
垢版 |
2018/11/19(月) 12:28:58.07ID:xPquTj4a
>>240
[(0,0),(0,3),(3,0),(3,3),(4,2),(0,2)] というのが数学板で返された
0247卵の名無しさん
垢版 |
2018/11/19(月) 14:10:23.88ID:lgLouqKT
>>246 は国試に23回も落ちた挙句
婚活にも失敗してる素人童貞で
くるくるぱーの裏口バカに
なっちゃってるのらぁあぁぁ
Fラン事務員の濃ゆぅぅい生ガキ汁
ド底辺の臭いが落ちないよぉ
んほおぉぉぉおぉぉ
0248卵の名無しさん
垢版 |
2018/11/19(月) 15:18:00.83ID:/8nCvktv
>>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)
これでできるけど、最短かどうかは自信がないなぁ。
0249卵の名無しさん
垢版 |
2018/11/19(月) 15:21:56.75ID:/8nCvktv
>>247
ド底辺シリツ医大卒の知性を表すような文章だなぁ。

>242の答でもだせばいいのに、

馬鹿なのか?馬鹿なのにどうして大学に入れるわけ?

あれかな?

あれだよね?

あれ

あれ







0250卵の名無しさん
垢版 |
2018/11/19(月) 15:46:07.22ID:/8nCvktv
[問題]
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]
0251卵の名無しさん
垢版 |
2018/11/19(月) 18:20:27.15ID:lgLouqKT
ネットで口汚くあちこちのスレを荒らしている国試浪人の事務員だが
この世に彼奴を下回るカスがいるだろうか
いや居ない
リアルではだれも口にしないが、みな思っていることだ

事務員本人も内心は自覚していることだろう
でなければ毎日毎日、専門医や開業医や皮膚科でもないのに
それぞれのスレを荒らしに来るはずがない

よっぽど妬ましいんだろうなW
0252卵の名無しさん
垢版 |
2018/11/19(月) 20:30:41.47ID:/8nCvktv
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)
}
0253卵の名無しさん
垢版 |
2018/11/19(月) 20:31:14.24ID:/8nCvktv
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)

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)))
}
0255卵の名無しさん
垢版 |
2018/11/19(月) 22:04:51.47ID:vmWf+9X3
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)
0257卵の名無しさん
垢版 |
2018/11/19(月) 22:29:14.48ID:vmWf+9X3
>>251
期待に反して悪いが俺、事務員じゃないんだね。

臨床やってるからこういう議論もできる。
https://egg.2ch.net/test/read.cgi/hosp/1499746033/878

879 卵の名無しさん sage 2018/11/15(木) 07:18:18.94 ID:LT687Ilf
>>878
>875は脾弯越えの操作でpullする時の話。
http://i.imgur.com/ztM8yOL.png

んで、あんたどこ卒?
ド底辺シリツ医大へ裏口入学なんだろ?
中学入試を少し難問化した>227に答えてみ!
0258卵の名無しさん
垢版 |
2018/11/19(月) 22:31:41.85ID:vmWf+9X3
>>251
国立卒はちゃんとわかってる。

開業医スレのシリツ三法則(試案、名投稿より作成)

1.私立医が予想通り糞だからしょうがない

>https://egg.5ch.net/test/read.cgi/hosp/1537519628/101-102
>https://egg.5ch.net/test/read.cgi/hosp/1537519628/844-853
ID:RFPm1BdQ

>https://egg.5ch.net/test/read.cgi/hosp/1537519628/869
>https://egg.5ch.net/test/read.cgi/hosp/1537519628/874-875
>https://egg.5ch.net/test/read.cgi/hosp/1537519628/874-880
>https://egg.5ch.net/test/read.cgi/hosp/1537519628/882
ID:liUvUPgn

2.馬鹿に馬鹿と言っちゃ嫌われるのは摂理
実例大杉!

3.リアルでは皆思ってるだけで口に出してないだけ
http://ishikisoku.com/wp-content/uploads/2016/12/SQIR26V.jpg
0259卵の名無しさん
垢版 |
2018/11/19(月) 22:42:33.31ID:zhu5ykUr
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.
0260卵の名無しさん
垢版 |
2018/11/19(月) 23:01:00.76ID:vmWf+9X3
>>251
統計スレに投稿するならこれくらい答えてみ。
話題のド底辺シリツ医大裏口入学を題材にした問題。

ド底辺シリツ裏口調査団が100人を順次調査した。
裏口判明人数をそのまま公表はヤバすぎる結果であったため、
連続して裏口がみつかった最大数は4人であったとだけ公表した。
公表結果が正しいとして裏口入学人数の期待値、最頻値、及び95%信頼区間を述べよ。
0261卵の名無しさん
垢版 |
2018/11/19(月) 23:13:28.02ID:vmWf+9X3
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)
0263卵の名無しさん
垢版 |
2018/11/20(火) 07:48:14.29ID:jEVjKi6n
>>261
探索経路を記録するのと
移転で過去の状態に戻るのをカウントから外す必要があるなぁ。
0264卵の名無しさん
垢版 |
2018/11/20(火) 08:30:59.02ID:GReM9fuK
ネットで口汚くあちこちのスレを荒らしている国試浪人の事務員だが
この世に彼奴を下回るカスがいるだろうか
いや居ない
リアルではだれも口にしないが、みな思っていることだ

事務員本人も内心は自覚していることだろう
でなければ毎日毎日、専門医や開業医や皮膚科でもないのに
それぞれのスレを荒らしに来るはずがない

よっぽど妬ましいんだろうなW
0265卵の名無しさん
垢版 |
2018/11/20(火) 11:38:05.66ID:+LTJHbMS
油分け算の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)
}
0266卵の名無しさん
垢版 |
2018/11/20(火) 11:38:32.07ID:+LTJHbMS
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)
}
0267卵の名無しさん
垢版 |
2018/11/20(火) 11:38:51.94ID:+LTJHbMS
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)
}
0268卵の名無しさん
垢版 |
2018/11/20(火) 11:39:23.04ID:+LTJHbMS
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
0269卵の名無しさん
垢版 |
2018/11/20(火) 13:27:38.76ID:+LTJHbMS
>>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
0270卵の名無しさん
垢版 |
2018/11/20(火) 15:06:09.76ID:6Tvud5kf
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
0271卵の名無しさん
垢版 |
2018/11/20(火) 17:14:24.57ID:+LTJHbMS
ようやくデバッグできた。

> 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
0272卵の名無しさん
垢版 |
2018/11/20(火) 17:15:16.68ID:+LTJHbMS
目的のノードを見つけたら終了する仕様だから、最短かどうかはわからないなぁ。
0273卵の名無しさん
垢版 |
2018/11/20(火) 17:21:50.40ID:cc4OhAKi
仕事しないとなぁ
0275卵の名無しさん
垢版 |
2018/11/20(火) 18:23:06.98ID:cc4OhAKi
時給の良い仕事ないかなぁ?
0276卵の名無しさん
垢版 |
2018/11/20(火) 18:44:46.44ID:cc4OhAKi
ハローワークで警備の仕事があるなぁ。
0277卵の名無しさん
垢版 |
2018/11/20(火) 19:45:03.72ID:+LTJHbMS
# 問題 : 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
0278卵の名無しさん
垢版 |
2018/11/20(火) 20:18:02.67ID:HF+OgDBw
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.
0279卵の名無しさん
垢版 |
2018/11/20(火) 22:25:53.92ID:cc4OhAKi
人間関係のない時給の良い仕事はないかなぁ?いじめられるからなぁ
0280卵の名無しさん
垢版 |
2018/11/20(火) 22:27:11.31ID:D0iJ9Tsc
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.
0281卵の名無しさん
垢版 |
2018/11/20(火) 22:32:57.27ID:cc4OhAKi
仕事ください
0282卵の名無しさん
垢版 |
2018/11/20(火) 22:39:03.37ID:cc4OhAKi
なんの取り柄もない私に仕事をください
0283卵の名無しさん
垢版 |
2018/11/20(火) 22:41:23.23ID:cc4OhAKi
なんかの資格があったらなぁ 仕事がないなぁ 今になって悔やんでしまう
0284卵の名無しさん
垢版 |
2018/11/20(火) 22:48:29.81ID:cc4OhAKi
金がない!
0285卵の名無しさん
垢版 |
2018/11/20(火) 22:51:11.25ID:cc4OhAKi
もっと金になる勉強をすべきだった 仕事がないなぁ
0286卵の名無しさん
垢版 |
2018/11/20(火) 22:57:18.11ID:cc4OhAKi
このまま 社会に出ずに 人生が終わってしまうのか?なんだったんだろう俺の人生は?
0287卵の名無しさん
垢版 |
2018/11/20(火) 23:39:20.88ID:cc4OhAKi
明日 また ハローワーク行こう!
0288卵の名無しさん
垢版 |
2018/11/21(水) 09:42:48.41ID:Jctp5Wds
>268-269のバグを指摘できていたら見直すのだが
底辺学力でできるのは>197のような漢字の誤変換だけ。
0289卵の名無しさん
垢版 |
2018/11/21(水) 12:38:48.27ID:m3dnATiO
ド底辺スレの定期上げ
0290卵の名無しさん
垢版 |
2018/11/21(水) 13:50:41.23ID:cCF4eIpe
じゃ、定期あげ
0291卵の名無しさん
垢版 |
2018/11/21(水) 15:05:19.22ID:UV5R2p03
>>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
#
0292卵の名無しさん
垢版 |
2018/11/21(水) 20:50:08.75ID:5Xwsg5oK
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.
0293卵の名無しさん
垢版 |
2018/11/21(水) 21:27:39.69ID:m3dnATiO
非医師の人たちへむけて 今日の1曲

愛国戦隊大日本
0294卵の名無しさん
垢版 |
2018/11/21(水) 22:11:11.00ID:UV5R2p03
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)
0295卵の名無しさん
垢版 |
2018/11/21(水) 22:12:01.19ID:UV5R2p03
>>294
これへの回答

あるデータ群に対して、確率密度関数のパラメータをフィッティングさせる方法ってないですか?
ちなみに、フィッティングさせたいのはレブィフライト確率密度関数です。
0296卵の名無しさん
垢版 |
2018/11/21(水) 22:46:03.55ID:uT58TBet
量子力学は?www
0298卵の名無しさん
垢版 |
2018/11/21(水) 23:59:20.99ID:uT58TBet
国試諦めたんだねw
0299卵の名無しさん
垢版 |
2018/11/22(木) 00:06:46.65ID:jXQTlLg4
>>172
残念ながら、事務員じゃないのね。
こういうの書いているの俺な。

内視鏡検査について Part.2 [無断転載禁止](c)2ch.net
https://egg.5ch.net/test/read.cgi/hosp/1499746033/875

875 名前:卵の名無しさん[sage] 投稿日:2018/11/14(水) 20:29:50.55 ID:lTkyjX2F
>>874
俺は肝弯より脾損傷の方がやだね。
開腹手術での受動時の経験と透視でのファイバーの動きを見る機会があるとこんなに可動性あったっけとか思う。
幸い脾損傷の経験はないけど、検査後に左肩への放散痛があったら疑わなくてはと思っている。
0300卵の名無しさん
垢版 |
2018/11/22(木) 00:32:25.51ID:by7Pc9VA
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.
0301卵の名無しさん
垢版 |
2018/11/22(木) 19:48:22.68ID:EhyhVVko
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
0302卵の名無しさん
垢版 |
2018/11/22(木) 22:15:42.49ID:jXQTlLg4
>>300
it is their right, it is their duty, to expel such "uraguchi", and to provide new guards for their future security.
この通り、実践すべき!

裏口入学の学生を除籍処分にしないかぎり、信頼の回復はないね。つまり、いつまで経ってもシリツ医大卒=裏口バカと汚名は拭えない。シリツ出身者こそ、裏口入学に厳しい処分せよを訴えるべき。

裏口入学医師の免許剥奪を!の国民運動の先頭に立てばよいぞ。
僕も裏口入学とか、言ってたら信頼の回復はない。
0303卵の名無しさん
垢版 |
2018/11/22(木) 22:49:22.84ID:s6txpOAx
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.
0304卵の名無しさん
垢版 |
2018/11/23(金) 07:36:18.66ID:t+QLwcrH
main = print $ length [(x,y)|x<-[-100..100],y<-[-100..100],7*x+3*y==5,abs x + abs y <= 100]
0305卵の名無しさん
垢版 |
2018/11/23(金) 07:45:24.89ID:Qqz1atCA
統計の話をしよう!!
サルを何千万匹殺しても無問題!!ただし、共産主義の香りづけをすれば
0306卵の名無しさん
垢版 |
2018/11/23(金) 08:10:20.25ID:QoVjbOvp
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) + ")")
0307卵の名無しさん
垢版 |
2018/11/23(金) 08:27:21.45ID:QoVjbOvp
>>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) + ")")
0308卵の名無しさん
垢版 |
2018/11/23(金) 08:28:05.53ID:QoVjbOvp
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]))
0309卵の名無しさん
垢版 |
2018/11/23(金) 08:29:57.03ID:QoVjbOvp
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)
0310卵の名無しさん
垢版 |
2018/11/23(金) 10:32:55.82ID:QoVjbOvp
# 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)
0311卵の名無しさん
垢版 |
2018/11/23(金) 18:35:27.02ID:QoVjbOvp
# ある医院に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

理論値通りだな。
0313卵の名無しさん
垢版 |
2018/11/23(金) 22:53:03.27ID:t+QLwcrH
1時間に平均値5人の患者がくる医院で
次の患者がくるまでの時間が10分以内である確率と
30分以上である確率はいくらか?
0314卵の名無しさん
垢版 |
2018/11/24(土) 01:25:40.73ID:5hOk6q/8
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.
0315卵の名無しさん
垢版 |
2018/11/24(土) 11:07:29.76ID:wOJ88Y8z
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')
0316卵の名無しさん
垢版 |
2018/11/24(土) 11:42:17.66ID:wOJ88Y8z
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)')
0318卵の名無しさん
垢版 |
2018/11/24(土) 14:11:47.95ID:4kuDQ9FR
こういうのを見ればわかるだろうに

https://egg.2ch.net/test/read.cgi/hosp/1499746033/879

>>878
>875は脾弯越えの操作でpullする時の話。
http://i.imgur.com/ztM8yOL.png

馬鹿なのか、馬鹿じゃなきゃ、これにでも答えてみ!

1時間に平均値5人の患者がくる医院で
次の患者がくるまでの時間が10分以内である確率と
30分以上である確率はいくらか?
0319卵の名無しさん
垢版 |
2018/11/24(土) 14:18:05.42ID:4kuDQ9FR
>>316

これ用のスクリプト

18時から翌朝9時までの15時間の当直帯に平均5回のコールがある。当直室にデリヘル90分コースで呼んだとすると
デリヘル滞在中にコールされる確率はいくらか?
0320卵の名無しさん
垢版 |
2018/11/24(土) 16:38:49.21ID:wOJ88Y8z
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)
0321卵の名無しさん
垢版 |
2018/11/24(土) 17:00:00.40ID:wOJ88Y8z
救急車搬送数が日勤の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)]
0322卵の名無しさん
垢版 |
2018/11/24(土) 17:01:06.35ID:wOJ88Y8z
>>321
日勤と夜勤でお看取り件数に差があるかも検定できるな。
0323卵の名無しさん
垢版 |
2018/11/24(土) 20:15:42.14ID:mGu7MkO8
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.
0324卵の名無しさん
垢版 |
2018/11/24(土) 20:20:35.00ID:4kuDQ9FR
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)
0325卵の名無しさん
垢版 |
2018/11/24(土) 20:31:46.81ID:4kuDQ9FR
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()
0327卵の名無しさん
垢版 |
2018/11/24(土) 20:47:34.09ID:4kuDQ9FR
>>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)
}
0328卵の名無しさん
垢版 |
2018/11/25(日) 02:02:43.79ID:JOuyBVrN
ポイント乞食ご用達の楽天銀行に貯金していて、
楽天に口座凍結されて無一文になった世田谷のS君 元気??

一応 開業医なのに楽天銀行って  

慶応のOBらが泣いてるよww
0329卵の名無しさん
垢版 |
2018/11/25(日) 08:07:10.02ID:Vr8P87vG
マルコフの確認
(pexp(2+4,1/3)-pexp(2,1/3))/(1-pexp(2,1/3))
pexp(4,1/3)
0330卵の名無しさん
垢版 |
2018/11/25(日) 09:08:24.99ID:B7CJHmdM
k=15
a=20
b=30
(pexp(a+b,1/k)-pexp(a,1/k))/(1-pexp(a,1/k))
pexp(b,1/k)
0331卵の名無しさん
垢版 |
2018/11/25(日) 12:02:52.13ID:9toFqzz4
k=15
a=20
b=30
y=function(x) 1-exp(-x/k)
(y(a+b)-y(a))/(1-y(a))
y(b)
0332卵の名無しさん
垢版 |
2018/11/25(日) 12:19:14.40ID:9toFqzz4
>>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)
}
0333卵の名無しさん
垢版 |
2018/11/25(日) 12:22:57.28ID:9toFqzz4
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))
}
0335卵の名無しさん
垢版 |
2018/11/25(日) 12:49:45.63ID:9toFqzz4
サッカーの特典はポアソン分布に従うとされている。

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
0336卵の名無しさん
垢版 |
2018/11/25(日) 12:52:38.63ID:9toFqzz4
>>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

ほぼ同じした結果がでて、気分が( ・∀・)イイ!!
0337卵の名無しさん
垢版 |
2018/11/25(日) 14:41:03.20ID:9toFqzz4
λ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)
0338卵の名無しさん
垢版 |
2018/11/25(日) 15:33:46.37ID:9toFqzz4
>>331
答えから、指数分布のマルコフ性が導き出されていることを確認
0339卵の名無しさん
垢版 |
2018/11/25(日) 21:52:47.06ID:9toFqzz4
# 10分に2本の割合で電車が到着するダイヤ。
# それぞれの平均待ち時間を求めてみよう
# 5分おきのダイヤでの、平均待ち時間は何分か?
i=j=5
fij <- function(x){
if(x<i) return(i-x)
return(i+j-x)
}
fij=Vectorize(fij)
curve(fij(x),0,10,type='h')
integrate(fij,0,10)$value/10

# 2(=i)分後、8(=j)分後、と電車が到着するダイヤでの平均待ち時間は何分か?
i=2 ; j=8 # 8:00,8:02,8:10,8:12,8:20,...
fij <- function(x){
if(x<i) return(i-x)
return(i+j-x)
}
fij=Vectorize(fij)
curve(fij(x),0,i+j,type='h')
integrate(fij,0,i+j)$value/(i+j)
0340卵の名無しさん
垢版 |
2018/11/25(日) 22:09:31.18ID:9toFqzz4
# 8:15,8:50,9:15,9:50,10:15,10:50....
i=50-15 ; j=60-(50-15)
fij <- function(x){
if(x<i) return(i-x)
return(i+j-x)
}
fij=Vectorize(fij)
curve(fij(x),0,i+j,type='h')
integrate(fij,0,i+j)$value/(i+j)
(i*i/2+(60-i)*j/2)/(i+j)
0341卵の名無しさん
垢版 |
2018/11/25(日) 22:53:07.02ID:JHTxnUVJ
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.
0342卵の名無しさん
垢版 |
2018/11/26(月) 00:38:59.24ID:ZChMNBQH
数学板の質問スレに俺でも答えられる問題がでるとホッとするな。
簡単すぎて誰も答えないからというのもあるが。
0343卵の名無しさん
垢版 |
2018/11/26(月) 01:19:35.09ID:ZChMNBQH
時刻表から平均待ち時間を算出する。

tt=c(0,10,13,20,23,30,40,47,50,60) # time table
ct2wt <- function(x){ # clock time to waiting time
n=length(tt)
if(x<=tt[1]){w8=tt[1]-x
}else{
for(i in 1:(n-1)){
if(tt[i]<=x & x<=tt[i+1]){
w8=(tt[i+1]-x)
break
}
}}
return(w8)
}
ct2wt=Vectorize(ct2wt)
curve(ct2wt(x),0,60,type='h',bty='l')
integrate(ct2wt,0,60)$value/60
x=diff(tt)
sum(x^2/2)/sum(x)
0344卵の名無しさん
垢版 |
2018/11/26(月) 01:24:22.62ID:iwt1L6U2
ちっちっ×××× ちっち××××
××××ち××××
へいたんな×× おうとつない
×××だけぷっくりしてるの
あまいあじがするから××てほしいな?
にゃにゃにゃにゃにゃにゃにゃん☆

ちっちっ×××× ちっち××××
××××ち××××
つるつるな×× おにくがない
しるくの×××ごこちなんだ
ほおずりですりすりっとしてほしいな?

×××××でいっぱい××て?
ぜんぶ××××から♪

ちっちっ×××× ちっち××××
××××ち××××
すべすべの×× おおきくない
けんこうにすっごくいいんだよ
ゆびさきで××××ってしてほしいな? 👀
Rock54: Caution(BBR-MD5:1341adc37120578f18dba9451e6c8c3b)
0345卵の名無しさん
垢版 |
2018/11/26(月) 07:32:00.16ID:ZChMNBQH
>>343
Haskellの練習

Prelude> let tt = [0,10,13,20,23,30,40,47,50,60]
Prelude> let diff = zipWith (-) (tail tt) (init tt)
Prelude> sum (map (\x -> x^2/2) diff) / sum(diff)
3.95
0346卵の名無しさん
垢版 |
2018/11/26(月) 07:50:43.97ID:ZChMNBQH
>>343
python の 練習

import numpy as np
diff=np.diff([0,10,13,20,23,30,40,47,50,60])
print ( sum(map (lambda x: x**2/2,diff))/sum(diff ))
0347卵の名無しさん
垢版 |
2018/11/26(月) 07:51:08.82ID:ZChMNBQH
>>343
問題はこれ

東京駅からのぞみ号で朝8時から9時に出発する(9時発も可)。

無作為に選んだ8時台の時間に出発ホームに到着したとすると平均の待ち時間は何分か?

以下が東京8時台発のぞみ号の時刻表である。

8:00 8:10 8:13 8:20 8:23 8:30 8:40 8:47 8:50 9:00
0348卵の名無しさん
垢版 |
2018/11/26(月) 18:21:38.38ID:ZDBUmL4t
>>347
この問題を数学板に書いたら応用問題が返ってきた。

ある駅のホームの1番線には1時間ごと、2番線には(1/2)時間ごと、3番線には(1/3)時間ごとに電車が来るようにダイヤを組みたい。
ランダムな時間に駅に着いたときの平均待ち時間を最小にするには、どのようにダイヤを組めば良いか。
ただし、何番線の電車に乗っても向かう方向や停車駅に違いは無いとする。

プログラミングで簡単に解けた。

w8 <- function(xy,Print=FALSE){
x=xy[1];y=xy[2]
if(x<0|x>20|y<0|y>30)return(Inf)
tt=c(0,x,x+20,x+40,y,y+30,60)
tt=sort(tt)
d=diff(tt)
w=sum(d^2/2)/sum(d)
if(Print){
print(tt)
cat(sum(d^2/2),'/',sum(d))
}
return(w)
}
optim(par=c(0,0),w8,method='Nelder-Mead')
w8(c(10,15),P=T)
optim(par=c(0,0),w8,method='Nelder-Mead',control=list(fnscale=-1))
w8(c(0,0),P=T)
0349卵の名無しさん
垢版 |
2018/11/26(月) 19:10:20.76ID:WZnn9Mtx
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.
0350卵の名無しさん
垢版 |
2018/11/26(月) 20:45:26.65ID:G0yfFsA6
>>348
1時間に4本の4番線にも拡大できるようにプログラムを一般化。

densha <- function(init,Print=FALSE){
init=c(0,init)
J=length(init)
if(any(init*(1:J)>60)|any(init<0)) return(60)
H=list()
for(i in 1:J){
H[[i]]=init[i]+60/i*(0:(i-1))
}
tt=sort(unlist(H))
tt=c(tt,tt[1]+60)
d=diff(tt)
w=sum(d^2/2)/sum(d)
if(Print){
print(H)
cat(sum(d^2/2),'/',sum(d),'\n')
}
return(w)
}
densha(c(15,10),P=T)
optim(par=c(10,10,10),densha,method='BFGS')
densha(c(15,10,7.5),P=T)
0352卵の名無しさん
垢版 |
2018/11/27(火) 08:48:31.40ID:WzO5TT32
Pn(t)=rho^n/n!P0(t) ,1<=n<=s

Pn(t)=rho^n/(s!s^(n-s))P0(t) , n>=s

P0(t)= 1/{sigma[n=0,n=s]rho^n/n! + rho^(s+1)/(s!(s-rho))}

http://www.geocities.co.jp/Technopolis-Mars/5427/math/sw_waitque5.html

MMS = function(t, n, lamda,mu,s){
rho=lamda/mu
sig=0
for(i in 0:n) sig=sig+rho^i/factorial(i)
p0t=1/( sig + rho^(s+1)/factorial(s)/(s-rho) )
ifelse(n >= s, rho^n/factorial(s)/s^(n-s)*p0t, rho^n/factorial(n)*p0t)
}
0353卵の名無しさん
垢版 |
2018/11/27(火) 09:47:23.68ID:WzO5TT32
MMS = function(n, lamda=1/20,mu=1/10,s=3){
rho=lamda/mu
sig=0
for(i in 0:s) sig=sig+rho^i/factorial(i)
p0=1/( sig + rho^(s+1)/factorial(s)/(s-rho) )
ifelse(n >= s, rho^n/factorial(s)/s^(n-s)*p0, rho^n/factorial(n)*p0)
}
1-sum(sapply(0:3,MMS))
0354卵の名無しさん
垢版 |
2018/11/27(火) 09:48:36.29ID:WzO5TT32
演習問題
&#61550; 問題
&#61550; 電話回線のチケット予約システムがあり、その窓口数は3であ

&#61550; 予約の電話は平均して20秒に1回
&#61550; 窓口は1件あたり10秒必要
&#61550; 予約時3つの窓口がすべて応対中であれば話中になる
&#61550; このシステム全体を損失系M/M/3とみなせるとする

このとき、
&#61550; 話中である確率を求めなさい
&#61550; 話中となる確率を1%未満とするには、窓口はいくつ必要です
か?
0355卵の名無しさん
垢版 |
2018/11/27(火) 09:56:32.58ID:WzO5TT32
>>354 MMS = function(n, lamda=1/20,mu=1/10,s=3){
rho=s*lamda/mu
sig=0
for(i in 0:s) sig=sig+rho^i/factorial(i)
p0=1/( sig + rho^(s+1)/factorial(s)/(s-rho) )
ifelse(n >= s, rho^n/factorial(s)/s^(n-s)*p0, rho^n/factorial(n)*p0)
}
1-sum(sapply(0:3,MMS))
0356卵の名無しさん
垢版 |
2018/11/27(火) 09:57:04.81ID:WzO5TT32
MMS = function(n, lamda=1/20,mu=1/10,s=3){
rho=s*lamda/mu
sig=0
for(i in 0:s) sig=sig+rho^i/factorial(i)
p0=1/( sig + rho^(s+1)/factorial(s)/(s-rho) )
ifelse(n >= s, rho^n/factorial(s)/s^(n-s)*p0, rho^n/factorial(n)*p0)
}
1-sum(sapply(0:3,MMS))
0357卵の名無しさん
垢版 |
2018/11/27(火) 09:59:56.71ID:WzO5TT32
MMS = function(n, λ=1/20,μ=1/10,s=3){
ρ=s*λ/μ
sig=0
for(i in 0:s) sig=sig+ρ^i/factorial(i)
p0=1/( sig + ρ^(s+1)/factorial(s)/(s-ρ) )
ifelse(n >= s, ρ^n/factorial(s)/s^(n-s)*p0, ρ^n/factorial(n)*p0)
}
1-sum(sapply(0:3,MMS))
0358卵の名無しさん
垢版 |
2018/11/27(火) 10:36:18.18ID:WzO5TT32
MMS = function(n, λ=1/20,μ=1/10,s=3){
ρ=λ/μ
sig=0
for(i in 0:s) sig=sig+ρ^i/factorial(i)
p0=1/( sig + ρ^(s+1)/factorial(s)/(s-ρ) )
ifelse(n >= s, ρ^n/factorial(s)/s^(n-s)*p0, ρ^n/factorial(n)*p0)
}
0359卵の名無しさん
垢版 |
2018/11/27(火) 11:23:34.49ID:WzO5TT32
draft

.lambda=1/20
.mu=1/10
.s=1
MMS = function(n, lambda=.lambda ,mu=.mu,s=.s){
rho=lambda/mu
sig=0
for(i in 0:s) sig=sig+rho^i/factorial(i)
p0=1/( sig + rho^(s+1)/factorial(s)/(s-rho) )
ifelse(n >= s, rho^n/factorial(s)/s^(n-s)*p0, rho^n/factorial(n)*p0)
}

now8=function(x){
p=0
for(i in 0:x) p=p+MMS(i,s=x)
}

1-now8(1)

E=0
for(i in 0:1e4) E=E+i*MMS(i)
E*(1/.mu)

n=(1:10)[which.max(sapply(1:10,now8)>0.9)]
now8(n)
0360卵の名無しさん
垢版 |
2018/11/27(火) 12:44:46.57ID:RTIAbEXI
”お待たせしません”を謳い文句にした真面耶馬医院で
患者の来院は平均して20分に1人、診療は1人あたり10分とする。
診察医は一人。
謳い文句に反して患者が待たされる確率は?
患者の平均待ち時間は?
待たされる確率を10%以下にするには何人の医師が必要か?
待ち時間を3分以下にするには何人の医師が必要か?

lambda=1/20;mu=1/10
MMS = function(n, lambda ,mu, s){
rho=lambda/mu # rho < s
sig=0
for(i in 0:s) sig=sig+rho^i/factorial(i)
p0=1/( sig + rho^(s+1)/factorial(s)/(s-rho) )
# Pn : probability of n guests in system
Pn=ifelse(n >= s, rho^n/factorial(s)/s^(n-s)*p0, rho^n/factorial(n)*p0)
Ps=rho^s/factorial(s)*p0
L=rho + Ps*s*rho/(s-rho)^2 # guests in system
Lq=Ps*s*rho/(s-rho)^2 # guests in que
Wq=Lq/lambda # waiting time in que
c(`Pn(t)`=Pn,L=L,Lq=Lq,Wq=Wq)
}

# No Wait Probability when s=x
nwp=function(x,lambda,mu){
p=0
for(i in 0:x) p=p+MMS(i,lambda,mu,s=x)
p
}
nwp(1,lambda,mu)
nwp(2,lambda,mu)
0361卵の名無しさん
垢版 |
2018/11/27(火) 13:05:37.04ID:RTIAbEXI
問題(第1種情報処理技術者試験・平成元年度春期午前問17を改題)

ある医院では、患者が平均10分間隔でポアソン到着にしたがって訪ねてくることがわかった。
医者は1人であり、1人の患者の診断及び処方にかかる時間は平均8分の指数分布であった。

設問1 患者が待ち始めてから、診断を受け始めるまでの「平均待ち時間」を求めなさい。

設問2 待っている患者の平均人数を求めなさい。

設問3 患者の「平均待ち時間」が60分となるような平均到着間隔は約何分か?秒単位を
      切り捨てた値を答えなさい。

これに 
設問4  「平均待ち時間」を10分以下にするには同じ診察効率の医師が何人に必要か?
0362卵の名無しさん
垢版 |
2018/11/27(火) 13:53:38.67ID:RTIAbEXI
# ある医院では、患者が平均10分間隔でポアソン到着にしたがって訪ねてくることがわかった。
# 医者は1人であり、1人の患者の診療にかかる時間は平均8分の指数分布であった。
# 「平均待ち時間」を5分以下にするには同じ診察効率の医師が何人に必要か?
# その最小人数で「平均待ち時間」を5分以下に保って診療するには1時間に何人まで受付可能か?
sapply(1:3,function(x) MMS(0,1/10,1/8,x)['Wq'])
MMS(0,1/10,1/8,s=2)
f= function(l) MMS(0,l,mu=1/8,s=2)['Wq']
v=Vectorize(f)
curve(v(x),bty='l',0,2/8) # rho=l/m < s , l < s*m
abline(h=5,lty=3)
60*uniroot(function(x)v(x)-5,c(0.1,0.2))$root
MMS(0,9.3/60,mu=1/8,s=2)
0363卵の名無しさん
垢版 |
2018/11/27(火) 15:40:44.01ID:RTIAbEXI
# M/M/S(s)
MMSs <- function(n,lambda,mu,s){
if(n > s) return(0)
rho=lambda/mu # rho < s
sig=0
for(i in 0:s) sig=sig+rho^i/factorial(i)
Pn=rho^n/factorial(n)/sig
return(Pn)
}
s=3
sapply(0:s,function(x) MMSs(x,1/20,1/10,s))
cnvg=function(x,lambda,mu) MMSs(x,lambda,mu,x) # 輻輳 convergence
vc=Vectorize(function(x) cnvg(x,10/60,1/30))
(1:10)[vc(1:10) < 0.05]
0364卵の名無しさん
垢版 |
2018/11/27(火) 18:51:54.59ID:sOmaXwxS
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.
0365卵の名無しさん
垢版 |
2018/11/27(火) 20:30:45.92ID:RTIAbEXI
mms <- function(n,lambda,mu,s,t=0,Print=TRUE){
alpha=lambda/mu
rho=lambda/s/mu # alpha=s*rho
sig0=0
for(i in 0:(s-1)) sig0=sig0+alpha^i/factorial(i)
P0=1/( sig0 + alpha^s/factorial(s-1)/(s-alpha) )
Pn=ifelse(n >= s, alpha^n/factorial(s)/s^(n-s)*P0, alpha^n/factorial(n)*P0)
Lq=lambda*mu*alpha^s/factorial(s-1)/(s*mu-lambda)^2*P0
L=Lq+alpha
Wq=Lq/lambda
#=mu*alpha^s/factorial(s-1)/(s*mu-lambda)^2*P0
W=Wq+1/mu
Pc=mu*P0*alpha^s/factorial(s-1)/(s*mu-lambda)
#=s^s*P0/factorial(s)*rho^s/(1-rho)
PTt=Pc*exp(-(1-rho)*s*mu*t)
output=c(P0=P0,Pn=Pn,Lq=Lq,L=L,Wq=Wq,W=W,Pc=Pc,PTt=PTt)
# P0:0 in system, Pn:n in system, Lq:guests in que, Wq: waiting time in que
# L:quests in system, W:total waiting time, Pc:all windows occupied,
# P: waiting time in que greater than t
if(Print) print(output,digits=3)
invisible(output)
}
mms(n=0,lambda=1/60,mu=1/10,s=1,t=0)
0366卵の名無しさん
垢版 |
2018/11/27(火) 20:40:29.10ID:2tUinJG4
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.
0367卵の名無しさん
垢版 |
2018/11/27(火) 21:06:39.05ID:RTIAbEXI
レジが1台ある。客の到着が1時間あたり平均12人であり、
レジの所要時間が平均3分のとき,次の値を求めてみよう。
?到着したとき,すぐにサービスが受けられる確率
?系の中にいる人の平均人数
?サービスを待っている人の平均人数
?到着してからサービスを受けて去るまでの平均時間

?到着してからサービスを受けるまでの平均待ち時間
?客の到着が2倍の平均24人になった。到着してからサービスを受けて去るまでの平均時間を変えないようにするには
レジの平均サービス時間を何分にすればよいか?求めてみよう。
0368卵の名無しさん
垢版 |
2018/11/27(火) 21:08:46.15ID:RTIAbEXI
筆算は面倒。数値を変えても算出できるようにした。

mms <- function(n,lambda,mu,s,t=0,Print=TRUE){
alpha=lambda/mu
rho=lambda/s/mu # alpha=s*rho
sig0=0
for(i in 0:(s-1)) sig0=sig0+alpha^i/factorial(i)
P0=1/( sig0 + alpha^s/factorial(s-1)/(s-alpha) )
Pn=ifelse(n >= s, alpha^n/factorial(s)/s^(n-s)*P0, alpha^n/factorial(n)*P0)
Lq=lambda*mu*alpha^s/factorial(s-1)/(s*mu-lambda)^2*P0
L=Lq+alpha
Wq=Lq/lambda
#=mu*alpha^s/factorial(s-1)/(s*mu-lambda)^2*P0
W=Wq+1/mu
Pc=mu*P0*alpha^s/factorial(s-1)/(s*mu-lambda)
#=s^s*P0/factorial(s)*rho^s/(1-rho)
PTt=Pc*exp(-(1-rho)*s*mu*t)
output=c(P0=P0,Pn=Pn,Lq=Lq,L=L,Wq=Wq,W=W,Pc=Pc,PTt=PTt)
# P0:0 in system, Pn:n in system, Lq:guests in que, Wq: waiting time in que
# L:quests in system, W:total waiting time, Pc:all windows occupied,
# P: waiting time in que greater than t
if(Print) print(output,digits=3)
invisible(output)
}

> mms(0,12/60,1/3,1)
P0 Pn Lq L Wq W Pc PTt
0.4 0.4 0.9 1.5 4.5 7.5 0.6 0.6
> uniroot(function(x) mms(0,24/60,1/x,1,P=F)['W']-7.5,c(0.1,2))$root
[1] 1.874993
0369卵の名無しさん
垢版 |
2018/11/27(火) 23:07:59.15ID:RTIAbEXI
# M/M/s/K
MMSK <- function(lambda,mu,s,k){
alpha=lambda/mu
sig1=sig2=0
for(n in 0:s) sig1=sig1+alpha^n/factorial(n)
if(k>s) for(n in 1:(k-s)) sig2=sig2+alpha^s/s*(alpha/s)^n
Psk=s^s/factorial(s)*(alpha/s)^k/(sig1+sig2)
return(Psk)
}

MMSK(lambda=1/20,mu=1/10,s=3,k=3)
MMSS(n=3,l=1/20,m=1/10,s=3)
E2s <- function(alpha,s) MMSK(alpha,1,s,s)
E2s(0.5,3) # call loss, convergence α^s/s! / Σ[n=0,s]a^n/n!

a=seq(0,3,len=101)
plot(a,sapply(a,function(x)E2s(x,s=1)),type='l',bty='l',ylab='call loss prob.')
lines(a,sapply(a,function(x)E2s(x,s=2)),lty=2)
lines(a,sapply(a,function(x)E2s(x,s=3)),lty=3)
0370卵の名無しさん
垢版 |
2018/11/27(火) 23:08:01.08ID:yIHJQdw7
音楽の問題です

アヘ顔ダブルPEA〜〜〜CE
v(゜∀。)v
0371卵の名無しさん
垢版 |
2018/11/28(水) 07:55:01.98ID:5n5kFcMp
f <- function() sum(rbinom(10,3,1/3)==rbinom(10,3,1/3))
g <- function(k) mean(replicate(k,f()))
h=Vectorize(g)
x=seq(1000,100000,by=1000)
re=h(x)
plot(x,re,pch=19,bty='l',ann=F)
0372卵の名無しさん
垢版 |
2018/11/28(水) 08:08:55.83ID:5n5kFcMp
f <- function() sum(rbinom(10,3,1/3)==rbinom(10,3,1/3))
g <- function(k) mean(replicate(k,f()))
h=Vectorize(g)
x=seq(1000,100000,by=1000)
re=h(x)
plot(x,re,pch=19,bty='l',ann=F)

x=rep(100,10000)
y=h(x)
cx=cumsum(x)
cy=cumsum(y)/1:10000
plot(cx,cy,type='l')
0373卵の名無しさん
垢版 |
2018/11/28(水) 13:47:18.06ID:5n5kFcMp
rm(list=ls())
n=10 ; lambda=10/60 ; mu=1/8
# service starc clock time(ssct) since 9:00
ssct=numeric(n)
# waiting time(w8)
w8=numeric(n)
# service end clock time(sect)
sect=numeric(n)
# arrival clock time(act)
set.seed(1234) ; act=round(cumsum(rexp(n,lambda)))
# duration of service(ds)
set.seed(5678) ; ds=round(rexp(n,mu))

# step by step
act
ds
ssct[1]=act[1] # 9:15
sect[1]=act[1]+ds[1] # 9:25

act[2] # 9:16
max(sect[1]-act[2],0) # 9:25-9:16 vs 0
w8[2]=max(sect[1]-act[2],0) # 9 min
ssct[2]=max(sect[1],act[2]) # 9:25 vs 9:16
sect[2]=ssct[2]+ds[2] # 9:25 + 8 = 9:33

act[3] # 9:17
max(sect[2]-act[3],0) # 9:33 - 9:17 vs 0
w8[3]=max(sect[2]-act[3],0) # 16 min
ssct[3]=max(sect[2],act[3]) # 9:33 vs 9:17
sect[3]=ssct[3]+ds[3] # 9:33 + 11 = 9:44
0374卵の名無しさん
垢版 |
2018/11/28(水) 15:01:41.58ID:5n5kFcMp
# ある医院に1時間あたり平均5人の患者が来院し、その人数の分布はポアソン分布にしたがうとする。
# 1時間あたりの平均診療人数は6人で、一人あたりの診療時間は指数分布に従うとする。
# 診察までの平均の待ち時間は何時間か?

rm(list=ls())

# Five patients comes every hour on average to the clinic,
# and the single physicaina treats six patients every hour on average.
# n=40 ; lambda=5/60 ; mu=6/60

MM1sim <- function(n=40,lambda=5/60,mu=6/60,seed=FALSE,Print=TRUE){
# service starc clock time(ssct) since 9:00
ssct=numeric(n)
# waiting time(w8)
w8=numeric(n)
# service end clock time(sect)
sect=numeric(n)
# arrival clock time(act)
if(seed) set.seed(1234) ;
act=round(cumsum(rexp(n,lambda)))
# duration of service(ds)
if(seed) set.seed(5678) ;
ds=round(rexp(n,mu))

# simulation assuming service starts at 9:00
head(act) # act : arrival clock time
head(ds) # ds : duration of service
# initial values
ssct[1]=act[1] # 9:15 service start clock time for 1st guest
sect[1]=act[1]+ds[1] # 9:25 sevice end clock time for 1st guest
w8[1]=0
0375卵の名無しさん
垢版 |
2018/11/28(水) 15:02:14.90ID:5n5kFcMp
# simulation step by step
#
# act[2] # 9:16 arrival clock time of 2nd
# max(sect[1]-act[2],0) # 9:25-9:16 vs 0 = ?sevice for 1st ends b4 2nd arrival
# w8[2]=max(sect[1]-act[2],0) # 9 min : w8ing time of 2nd
# ssct[2]=max(sect[1],act[2]) # 9:25 vs 9:16 = service start clock time for 2nd
# sect[2]=ssct[2]+ds[2] # 9:25 + 8 = 9:33 service end clock time for 2nd
#
# act[3] # 9:17 arrival clock time of 3rd
# max(sect[2]-act[3],0) # 9:33 - 9:17 vs 0 = ?serivce for 2nd ends b4 3rd arrival?
# w8[3]=max(sect[2]-act[3],0) # 16 min : w8ting time of 3rd
# ssct[3]=max(sect[2],act[3]) # 9:33 vs 9:17 = service start clock time for 3rd
# sect[3]=ssct[3]+ds[3] # 9:33 + 11 = 9:44 service end clock time for 3rd
#

for(i in 2:n){
w8[i]=max(sect[i-1]-act[i],0)
ssct[i]=max(sect[i-1],act[i])
sect[i]=ssct[i]+ds[i]
}
if(Print){
print(summary(w8))
hist(w8,freq=FALSE,col="lightblue",main="")
}
invisible(w8)
}

w8m=replicate(1e3,mean(MM1sim(P=F)))
summary(w8m)
0377卵の名無しさん
垢版 |
2018/11/28(水) 21:10:01.72ID:CEw4d3xR
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.
0378卵の名無しさん
垢版 |
2018/11/29(木) 13:46:13.50ID:vdx9uljL
待ち行列理論の公式って
待ち行列の長さが変わらない定常状態での計算値だなぁ。

こういう設定に適応していいのか疑問があるな。
# Five clients comes every hour on average to the office,
# and the single clerk serves six clients every hour on average.
# n=40 ; lambda=5/60 ; mu=6/60
0379卵の名無しさん
垢版 |
2018/11/29(木) 13:47:25.88ID:vdx9uljL
シミュレーターを改良

MM1sim <- function(n=40,lambda=5/60,mu=6/60,
Lcount=FALSE,seed=FALSE,Brief=TRUE,Print=TRUE,Round=FALSE){
# n: how many clients, lambda: clients per hour, mu: service per hour
# Lcont: calculate clients in que, seed: ?set.seed
# Brief: ?show summary, Print: ?print graphs, Round: ?round result
# service starc clock time(ssct) since 9:00
ssct=numeric(n)
# waiting time in que(Wq)
Wq=numeric(n)
# waiting time from arrival to service end(W)
W=numeric(n)
# service end clock time(sect)
sect=numeric(n)
# arrival clock time(act)
if(seed) set.seed(1234)
act=cumsum(rexp(n,lambda)) ; if(Round) act=round(act)
# duration of service(ds)
if(seed) set.seed(5678)
ds=rexp(n,mu) ; if(Round) ds=round(ds)

# initial values
ssct[1]=act[1] # 9:15 service start clock time for 1st guest
sect[1]=act[1]+ds[1] # 9:25 sevice end clock time for 1st guest
Wq[1]=0
0380卵の名無しさん
垢版 |
2018/11/29(木) 13:47:48.53ID:vdx9uljL
for(i in 2:n){
Wq[i]=max(sect[i-1]-act[i],0)
ssct[i]=max(sect[i-1],act[i])
sect[i]=ssct[i]+ds[i]
}
W=Wq+ds
L=Lq=NA
if(Lcount){
ct2Lq <- function(ct){ # ct:clock time to Lq
sum(act<ct & ct<ssct)
}
Lq=mean(sapply(seq(0,max(ssct),len=1e4),ct2Lq)) # average clients in que
ct2L <- function(ct){ # ct:clock time to Lq
sum(act<ct & ct<sect)
}
L=mean(sapply(seq(0,max(ssct),len=1e4),ct2L)) # average clients in que
}
if(Brief){
cat("Lq = ",Lq,'\n',"summary of Waiting in que \n")
print(summary(Wq))
cat("L = ",L,'\n',"summary of total time since arrival \n")
print(summary(W))}
0381卵の名無しさん
垢版 |
2018/11/29(木) 13:48:05.65ID:vdx9uljL
if(Print){
par(mfrow=c(2,2))
hist(Wq,freq=FALSE,col="lightblue",main="Waiting time in que")
hist(W,freq=FALSE,col="lightgreen",main="Total time since arrival")
plot(sect,1:n,type='n',bty='l',ylab="client",xlab='clock time',
main=paste('average waiting time :',round(mean(Wq),2)))
segments(y0=1:n,x0=act,x1=ssct,col='gray')
points(act,1:n,pch=1)
points(ssct,1:n,pch=19)
points(sect,1:n,pch=3,cex=0.6)
legend('bottomright',bty='n',legend = c('arrival','service start','service end'),pch=c(1,19,3))
if(Lcount){ct=seq(0,max(ssct),len=1e4)
plot(ct,sapply(ct,ct2Lq),xlab="clock time",ylab="",main="clients in que",
type='s',bty='l')}
par(mfrow=c(1,1))
}
output=list(Wq=Wq,W=W,Lq=Lq,L=L,arrival=act,start=ssct,end=sect,duration=ds)
invisible(output)
}
MM1sim(n=40,Lcount=T,R=T,P=T,seed=F)
0382卵の名無しさん
垢版 |
2018/11/29(木) 14:01:23.60ID:vdx9uljL
来院数がポアソン分布(来院間隔は指数分布)、
診療時間はそれまでの患者の診療時間に影響されない(マルコフ性とか無記憶性と呼ばれる)ので指数分布
と仮定して、1時間に5人受診、診療時間は10分を平均値として受診数を40人としてシミュレーションすると
こんなにばらついた。
https://i.imgur.com/2HSJiRL.png
https://i.imgur.com/aG4ySWl.png
待ち時間行列理論でクリニックの待ち時間計算すると現実と大きく乖離すると思える。
0383卵の名無しさん
垢版 |
2018/11/29(木) 14:23:01.20ID:vdx9uljL
来院数がポアソン分布(来院間隔は指数分布)、
診療時間はそれまでの患者の診療時間に影響されない(マルコフ性とか無記憶性と呼ばれる)ので指数分布
と仮定して、1時間に5人受診、診療時間は10分を平均値として受診数を40人としてシミュレーション。

その結果

診療までの待ち時間
> summary(Wqm)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.793 11.828 19.204 26.041 34.621 164.905
診療終了までの時間
> summary(Wm)
Min. 1st Qu. Median Mean 3rd Qu. Max.
7.952 20.296 29.359 35.335 44.600 161.234
診療待ちの人数
> summary(Lqm)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.1821 0.8501 1.5866 2.0976 2.7414 11.2506
0385卵の名無しさん
垢版 |
2018/11/29(木) 17:16:02.63ID:pxHQyZHt
sim = function(){
x=cumsum(rexp(5,5/15))
x[4] < x[3]+1
}
mean(replicate(1e5,sim()))

pexp(1,5/15)
0386卵の名無しさん
垢版 |
2018/11/29(木) 19:04:59.01ID:vdx9uljL
>>384
定常状態での理論値
mms <- function(n,lambda,mu,s,t=0,Print=TRUE){
alpha=lambda/mu
rho=lambda/s/mu # alpha=s*rho
sig0=0
for(i in 0:(s-1)) sig0=sig0+alpha^i/factorial(i)
P0=1/( sig0 + alpha^s/factorial(s-1)/(s-alpha) )
Pn=ifelse(n >= s, alpha^n/factorial(s)/s^(n-s)*P0, alpha^n/factorial(n)*P0)
Lq=lambda*mu*alpha^s/factorial(s-1)/(s*mu-lambda)^2*P0
L=Lq+alpha
Wq=Lq/lambda
#=mu*alpha^s/factorial(s-1)/(s*mu-lambda)^2*P0
W=Wq+1/mu
Pc=mu*P0*alpha^s/factorial(s-1)/(s*mu-lambda)
#=s^s*P0/factorial(s)*rho^s/(1-rho)
PTt=Pc*exp(-(1-rho)*s*mu*t)
output=c(P0=P0,Pn=Pn,Lq=Lq,L=L,Wq=Wq,W=W,Pc=Pc,PTt=PTt)
# P0:0 in system, Pn:n in system, Lq:guests in que, Wq: waiting time in que
# L:quests in system, W:total waiting time, Pc:all windows occupied,
# P: waiting time in que greater than t
if(Print) print(output,digits=3)
invisible(output)
}

> mms(0,5/60,6/60,1)
P0 Pn Lq L Wq W Pc PTt
0.167 0.167 4.167 5.000 50.000 60.000 0.833 0.833
0387卵の名無しさん
垢版 |
2018/11/29(木) 21:16:08.05ID:W5xHj2Da
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.
0388卵の名無しさん
垢版 |
2018/11/30(金) 10:07:25.16ID:c4eruZjZ
rm(list=ls())
graphics.off()
par(mfrow=c(1,2))
a=360 ; b=1
R = function(t) ifelse(0<=t&t<=2*b,-a*t*(t-2*b),0)
N = integrate(R,0,2*b)$value ; (N=4*a*b^3/3)
A = function(t) ifelse(0<=t&t<=2*b,-a*t^3/3 +a*b*t^2,N)
curve(A(x),0,3,lwd=2,bty='l',xlab='t')
mu=100
n.win=2
c=n.win*mu
curve(R(x),0,3,lwd=2,bty='l',xlab='t') ; abline(h=2:3*mu,lty=1:2)
uniroot(function(t) R(t)-c,c(0,1))$root
d = sqrt(b^2-c/a)
t1 = b - d ; t1
Q <- function(t) A(t)-A(t1)-c*(t-t1)
curve(Q(x),0,3,bty='l') ; abline(h=0,col=8)
Q. <- function(t) -a*(t-t1)^3/3 + a*d*(t-t1)^2
curve(Q.(x),0,3,bty='l') ; abline(h=0,col=8)
optimize(Q,c(0,1))$minimum
uniroot(Q,c(1,3))$root ; t1+3*d ; (t4.1=b+2*d)
Q(2*b)/c +2*b; (t4.2=a/3/c*(b+d)^2*(2*d-b) +2*b)
par(mfrow=c(1,1))
curve(A(x),0,3,lwd=2,bty='l',xlab='t')
curve(x*N/t4.1,add=T)
integrate(Q.,t1,t4.1)$value ; 9/4*a*d^4
integrate(Q.,t1,2*b)$value + 1/2*(t4.2-2*b)*Q.(2*b) ; a/36*(b+d)^3/(b-d)*(4*b*d-b^2-d^2)
integrate(Q.,t1,t4.1)$value/N
(integrate(Q.,t1,2*b)$value + 1/2*(t4.2-2*b)*Q.(2*b))/N

min(9/4*a*d^4,a/36*(b+d)^3/(b-d)*(4*b*d-b^2-d^2))/N
0389卵の名無しさん
垢版 |
2018/11/30(金) 10:11:24.11ID:c4eruZjZ
c2Wq <- function(c,a=360,b=1){ #-> Wq:平均待ち時間
# R(t): 到着率関数 -at(t-2b)
# c:サービス率
R = function(t) ifelse(0<=t&t<=2*b,-a*t*(t-2*b),0)
N=4*a*b^3/3
d = sqrt(b^2-c/a)
min(case1=9/4*a*d^4/N,case2=a/36*(b+d)^3/(b-d)*(4*b*d-b^2-d^2)/N)
}
c2Wq(300)
0390卵の名無しさん
垢版 |
2018/11/30(金) 14:10:17.12ID:c4eruZjZ
rm(list=ls())
graphics.off()
par(mfrow=c(2,1))
a=360 ; b=1 # R(t) at(t-2b) 到着率関数[0,2b]
R = function(t) ifelse(0<=t&t<=2*b,-a*t*(t-2*b),0)
curve(R(x),0,3,bty='l',xlab='t')
N = integrate(R,0,2*b)$value ; 4*a*b^3/3 # 総人数
A = function(t) ifelse(t<=2*b,-a*t^3/3 +a*b*t^2,N) # 流入関数=∫Rdt
# = integerate(function(t) R(t),0,t) 0<t<2b
curve(A(x),0,3,bty='l',xlab='t')
mu=100 # 一窓口当たりのサービス率
n.win=2 # 窓口数
c=n.win*mu # 全サービス率
curve(R(x),0,3,bty='l',xlab='t') ; abline(h=2:3*mu,lty=1:2,col=8)
legend('center',bty='n',legend=c("2窓口","3窓口"),lty=c(1,2),col=8)
uniroot(function(t) R(t)-c,c(0,1))$root # 行列>0 : 流入率>サービス率
d = sqrt(b^2-c/a)
t1 = b - d ; t1 # 行列の始まる時刻(解析値) : 流入率=サービス率
Q <- function(t) A(t)-A(t1)-c*(t-t1) # 行列の人数 定義域無視
curve(Q(x),0,3,bty='l',xlab='t')
optimize(Q,c(0,1))$minimum
# 行列の終わる時刻
uniroot(Q,c(1,1e6))$root
t4 = ifelse(2*d<b,b+2*d,a/3/c*(b+d)^2*(2*d-b) +2*b) ; t4 #解析値
 # 行列終了時刻 t4 < 2b : 入場締切前に行列0 (2*d<b)
if(2*d<b) c(t1+3*d, b+2*d)
 # 行列終了時刻 t4 > 2b : 入場締切後に行列0 (2*d>b)
 if(2*d>b) c(Q(2*b)/c +2*b, a/3/c*(b+d)^2*(2*d-b) +2*b)
Q <- function(t) ifelse(t1<=t & t<=t4 ,A(t)-A(t1)-c*(t-t1),0) # 行列の人数[t1,t4]
curve(Q(x),0,3,bty='l',type='h',xlab='t',ylab="Wq",col='navy')
0391卵の名無しさん
垢版 |
2018/11/30(金) 14:12:35.52ID:c4eruZjZ
Q.<- function(t){
if(t1<=t & t<= min(t4,2*b)) -a*(t-t1)^3/3 + a*d*(t-t1)^2}
# -a*(t-t1)^3/3 + a*d*(t-t1)^2 # 解析値[t1,min(t4,2b)]
tt=seq(t1,min(t4,2*b),len=1000)
lines(tt,sapply(tt,Q.),bty='l',type='l',xlab='t',ylab='Wq')

par(mfrow=c(1,1))
curve(A(x),0,3,bty='l',ylab='person',xlab='t',lwd=1,
main="到着率:at(t-2b) サービス率:200") # 累積入場者
curve(Q(x),0,3,col='navy',add=T,lwd=1,lty=3,type='h') # 待ち人数
tt=seq(0,3,len=1000)
lines(tt,sapply(tt,function(t)A(t)-Q(t)),lwd=2,col=4)
legend('right',bty='n',legend=c("流入総数","流出総数","待ち人数"),
col=c(1,4,1),lty=c(1,1,3),lwd=c(1,2,1))
integrate(Q,t1,t4)$value # 総待ち時間(=縦軸方向積分面積Area under curve)
Wtotal=ifelse(2*d<b,9/4*a*d^4,a/36*(b+d)^3/(b-d)*(4*b*d-b^2-d^2)) ; Wtotal
Wq=Wt/N ; Wq
0392卵の名無しさん
垢版 |
2018/11/30(金) 14:22:24.86ID:c4eruZjZ
数式を追うだけだと身につかないからプログラムに入力して自分でグラフを書いてみると理解が捗る。
自分がどこができていないもよく分かる。必要な計算ができないとグラフが完成できないから。
プログラムしておくとあとで数値を変えて再利用できるのが( ・∀・)イイ!!

https://i.imgur.com/P3jWTLx.png
0393卵の名無しさん
垢版 |
2018/11/30(金) 21:39:40.37ID:kXCX0lfh
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.
0394卵の名無しさん
垢版 |
2018/11/30(金) 23:12:28.51ID:c4eruZjZ
#
source('tmp.tools.R') # 乱数発生にNeumann法
# 受付時間9:00-12:30,15:30-19:00
curve(10*(dgamma(x-9,2,1)+dgamma(x-16,8,5)),9,20,type='h') # 雛形
R <- function(x) ifelse((9<x&x<12.5)|(15.5<x&x<19),dgamma(x-9,2,1)+dgamma(x-16,8,5),0)
set.seed(123) ; data=vonNeumann2(function(x) R(x),9,19,Print=F)
N=100 # 来院患者数
n.win=1 # サービス窓口数
mu=8 # サービス率(1時間診察人数)
client=hist(data,freq=F,breaks=30,col='skyblue',main='',xlab='clock time')
breaks=client$breaks
y=client$counts/sum(client$counts)*N # 総数をN人に
# 到達率関数,離散量を連続関数に
R <- function(x) ifelse((9<x&x<12.5)|(15.5<x&x<19),y[which.max(x<=breaks)-1],0)
R=Vectorize(R)
curve(R(x),9,20,type='h',bty='l')
c=n.win*mu # 総サービス率
abline(h=c,col=8)
t1=uniroot(function(t)R(t)-c,c(9,10))$root ; t1 # 到達率=サービス率で待ち時間開始
t2=uniroot(function(t)R(t)-c,c(16,17))$root ; t2 # 午後の部
0395卵の名無しさん
垢版 |
2018/11/30(金) 23:12:57.93ID:c4eruZjZ
tt=seq(9,24,len=1000)
Rtt=R(tt)
plot(tt,Rtt,type='s',bty='l')
cumR=cumsum(Rtt)/sum(Rtt)*N # cumsumで累積来院数をgrid化
plot(tt,cumR,type='l',bty='l')
A <- function(t) cumR[which.max(t<=tt)] # 離散量を連続関数に
A=Vectorize(A)
curve(A(x),9,24,bty='l')
Q <- function(t){ # 時刻tでの待ち人数
if(t<t1) return(0)
if(t1<t&t<t2) return(max(A(t)-A(t1)-c*(t-t1),0)) # 午前の部
else return(max(A(t)-A(t2)-c*(t-t2),0)) # 午後の部
}
Q=Vectorize(Q)
curve(Q(x),9,24,bty='l',type='h',col=2,ylab='persons',xlab='clock time')
# 待ちの発生と終了の時刻をグラフから読み取る
t15=seq(14,15,len=100) ; plot(t15,sapply(t15,Q)) # 14.6
t17=seq(16.9,17.2,len=100) ; plot(t17,sapply(t17,Q)) # 17.0
Q(22.7)
t22=seq(22.75,22.80,len=100) ; plot(t22,sapply(t22,Q)) # 22.8

curve(Q(x),9,24,bty='l',type='h',col=2,ylab='persons',xlab='clock time')
MASS::area(Q,9, 14.6,limit=20)/A(14.6) # 午前の待ち時間
MASS::area(Q,17,22.8,limit=20)/(A(22.8)-A(17)) # 午後の待ち時間
0396卵の名無しさん
垢版 |
2018/11/30(金) 23:51:07.01ID:c4eruZjZ
午前の受付9時から12時30分まで午後の受付15時30分から19時までのクリニックに
図のような二峰性の分布で100人が来院するとする。
https://i.imgur.com/mEvgZjr.png
> breaks
[1] 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5
[13] 15.0 15.5 16.0 16.5 17.0 17.5 18.0 18.5 19.0
> round(y)
[1] 5 8 10 8 6 5 3 0 0 0 0 0 0 0 0 7 19 17 8 3

医師は一人、診察時間は平均8分として待ち時間をグラフ化。
https://i.imgur.com/8Z21ezi.png

数値積分して平均の待ち時間を算出。
> integrate(Q,9,14.6,subdivisions=256)$value/A(14.6) # 午前の待ち時間
[1] 1.175392
> integrate(Q,17,22.8,subdivisions=256)$value/(A(22.8)-A(17)) # 午後の待ち時間
[1] 2.214289
0397卵の名無しさん
垢版 |
2018/12/01(土) 00:40:16.84ID:yFxD3TpK
>>385
混雑と待ち(朝倉書店)が届いたので

これやってみた。
ポアソン分布や指数分布を前提とせず、実際のヒストグラムから待ち時間のシミュレーション。
午前の受付9時から12時30分まで午後の受付15時30分から19時までのクリニックに
図のような二峰性の分布で100人が来院するとする。
https://i.imgur.com/mEvgZjr.png
> breaks
[1] 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5
[13] 15.0 15.5 16.0 16.5 17.0 17.5 18.0 18.5 19.0
> round(y)
[1] 5 8 10 8 6 5 3 0 0 0 0 0 0 0 0 7 19 17 8 3

医師は一人、診察時間は平均8分として待ち時間をグラフ化。
https://i.imgur.com/8Z21ezi.png

数値積分して平均の待ち時間を算出。
> integrate(Q,9,14.6,subdivisions=256)$value/A(14.6) # 午前の待ち時間
[1] 1.175392
> integrate(Q,17,22.8,subdivisions=256)$value/(A(22.8)-A(17)) # 午後の待ち時間
[1] 2.214289


https://i.imgur.com/IKoA1iQ.png

診療終了23時w
0398卵の名無しさん
垢版 |
2018/12/01(土) 00:40:42.20ID:yFxD3TpK
午後から医師は二人に増やすとどうなるかシミュレーションしてみた。
診察時間は一人平均8分の設定は同じ。

https://i.imgur.com/ULERzvs.png
> integrate(Q,17,19.9,subdivisions=256)$value/(A(19.9)-A(17)) # 午後の待ち時間
[1] 1.496882
待ち時間が2.2時間から1.5時間に短縮。

診療終了は20時!
0399卵の名無しさん
垢版 |
2018/12/01(土) 09:45:22.56ID:j/i2xXms
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.
0400卵の名無しさん
垢版 |
2018/12/01(土) 10:03:30.90ID:RmWyTNtb
rm(list=ls())
nwin=2 ; mu=10
C=nwin*mu # サービス効率
R <- function(t) dgamma(t,2,1)*100 # 到達関数
R=Vectorize(R)
curve(R(x),0,10,bty='l') ; abline(h=C,col=8)
t1=uniroot(function(x)R(x)-C,c(0,1))$root ; t1 # 行列開始時刻
t2=optimise(R,c(0,2),maximum = T)$maximum ; t2 # 行列増大速度最高時刻
t3=uniroot(function(x)R(x)-C,c(1,4))$root ; t3 # 行列最長時刻
A <- function(t) integrate(R,0,t)$value # 累積来客数
A=Vectorize(A)
curve(A(x),0,10,bty='l')
Q <- function(t) A(t)-A(t1)-C*(t-t1) # 行列人数
Q=Vectorize(Q)
curve(Q(x),0,10,bty='l') ; abline(h=0,col=8)
optimize(Q,c(0,10),maximum=T)$maximum ; t3 # 行列最長時刻
t4=uniroot(Q,c(4,8))$root ; t4 # 行列終了時刻
# calculate t4 w/o Q-function 到達関数から行列終了時刻を算出
curve(R(x),0,10,bty='l',xlab='clock time',ylab='arrival rate')
abline(h=C,col=8)
t13=seq(t1,t3,len=20)
segments(x0=t13,y0=C,y1=R(t13),col=3)
text(1.25,25,'V') ; text(c(t1,t3,t4),20,c('t1','t3','t4'),cex=0.95)
V=integrate(function(t)R(t)-C,t1,t3)$value ; V # 待ち時間*人数
dQ <- function(t) integrate(function(x) C-R(x),t3,t)$value - V
uniroot(dQ,c(t3,10))$root ; t4
t34=seq(t3,t4,len=20)
segments(x0=t34,y0=20,y1=R(t34),col='cyan') ; text(4,15,'V')
0402卵の名無しさん
垢版 |
2018/12/01(土) 10:24:54.70ID:RmWyTNtb
>>399
ド底辺シリツ医を蔑むパロディであることわかってコピペしてんの?

これにでも答えてみ!

あるド底辺裏口シリツ医大のある学年に100人の学生がいる。
100人の学生は全員裏口入学である。
裏口入学を自覚したら翌日に退学しなければならない。
学生は自分以外の学生が裏口入学であるとことは全員知っているが自分が裏口入学であることは知らない。
教授が全員の前で「この学年には少なくとも一人が裏口入学している」と発言した。
この後、どうなるかを述べよ。
0403卵の名無しさん
垢版 |
2018/12/01(土) 13:36:46.51ID:ZZpMV2Nw
この季節はいつも風邪気味になるなぁ
外来から貰ってんのかな
冬コミが近いのに原稿がまだできとらんが
体調管理はしっかりしていかんとなぁ
ジャンルはFTで良いかなぁ
ガチ百合にすっかなぁ
0404卵の名無しさん
垢版 |
2018/12/01(土) 16:09:30.06ID:ZZpMV2Nw
便秘薬をいろいろ試しているが
どれが良いかなぁ
0405卵の名無しさん
垢版 |
2018/12/01(土) 18:54:24.93ID:RmWyTNtb
t0fn <- function(n){ # terminal 0 of factorial n ( n=10, 10!=3628800 => 2
m=floor(log(n)/log(5))
ans=0
for(i in 1:m) ans=ans+n%/%(5^i)
ans
}
t0fn=Vectorize(t0fn)
t0fn(10^(1:12))

10!から1兆!まで末尾の0の数
> t0fn(10^(1:12))
[1] 2 24 249 2499 24999
[6] 249998 2499999 24999999 249999998 2499999997
[11] 24999999997 249999999997
0406卵の名無しさん
垢版 |
2018/12/01(土) 18:55:28.45ID:RmWyTNtb
おい、ド底辺。

1兆の階乗は末尾に0が
249999999997
並ぶと計算されたが、あってるか?
検算しておいてくれ。
0407卵の名無しさん
垢版 |
2018/12/01(土) 20:53:46.49ID:o9d/f5rc
今年の納税額は五千万超えるなぁ

冬コミはFTCW の新作出るかなぁ?
0408卵の名無しさん
垢版 |
2018/12/01(土) 21:08:44.05ID:o9d/f5rc
ふ◯◯◯ち◯◯れ◯◯◯◯
0409卵の名無しさん
垢版 |
2018/12/01(土) 22:41:26.00ID:N4WBnKxq
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.
0410卵の名無しさん
垢版 |
2018/12/01(土) 23:38:07.20ID:yFxD3TpK
あるド底辺裏口シリツ医大のある学年に100人の学生がいる。
100人の学生は全員裏口入学である。
裏口入学を自覚したら翌日に退学しなければならない。
学生は自分以外の学生が裏口入学であるとことは全員知っているが自分が裏口入学であることは知らない。
教授が全員の前で「この学年には少なくとも一人が裏口入学している」と発言した。
この後、どうなるかを述べよ。
0411卵の名無しさん
垢版 |
2018/12/02(日) 06:45:16.31ID:e9Pc8hcV
# Troubled train T1 with m passengers left station S1 arrived S2 station s minute later
# than depature of train T0
# beta*m passenger got out and rs passengers got in, where
# r denotes in-passenger rate per minute, T0 took b(beta*m + rs) extra-minutes
# regular train T0 takes c minutes for exchange of passengers
dango <- function(s,m,beta=3/10,r=3,b=0.01,c=0){
mm=(1-beta)*m+r*s
ss=s+b*(beta*m+r*s)-c
c(ss,mm)
}
sm=c(10,100)
re=sm
for(i in 1:2){
sm=dango(sm[1],sm[2])
re=rbind(re,sm)
}
rownames(re)=NULL
plot(re)
0412卵の名無しさん
垢版 |
2018/12/02(日) 07:38:46.89ID:IdisUW1u
薬局の店舗数を増やそうかなぁ
0413卵の名無しさん
垢版 |
2018/12/02(日) 12:10:26.58ID:TL1hN1iv
dat=hist(c(rnorm(1e6),rnorm(1e5,5,0.5)))
attach(dat)
plot(breaks[-1],counts,type='s',log='y',ylim=range(counts))
segments(x0=breaks[-1],y=min(counts),y1=counts)
segments(x0=breaks[1],y=min(counts),y1=counts[1])
0414卵の名無しさん
垢版 |
2018/12/02(日) 21:14:03.05ID:qDXWsGoQ
liars <- function(Answer){ # case of all liars permitted
N=length(Answer)
dat=permutations(2,N,0:1,set=F,rep=T)
check <- function(y,answer=Answer){
all(answer[y==0]==sum(y)) # all honest answer compatible?  
} # numeric(0)==sum(y):logical(0) all(logical(0)) : TRUE
dat[apply(dat,1,check),]
}
liars(c(1,2,2,3,3))
liars(c(1,3,5,7,9,1,3,5,7,9))
(x=sample(10,10,rep=T)) ; apply(!liars(x),1,sum)
liars(c(8, 9, 8, 2, 4, 4, 2, 3, 9, 8))
0415卵の名無しさん
垢版 |
2018/12/02(日) 21:35:54.10ID:jYRj3cxk
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.
0416卵の名無しさん
垢版 |
2018/12/02(日) 22:20:54.56ID:iMFc27fK
互いに相関のある5項目くらいのスコアの合計点から疾患の発生を予測するカットオフ値を求めました

単純に合計点した時の予測能は不十分であったため
主成分分析をして各主成分を線型結合して主成分スコアを出す時に、AUC値が最大になるように線型結合する係数に重み付けするのは一般的に大丈夫かしら?
0417卵の名無しさん
垢版 |
2018/12/02(日) 22:35:39.65ID:qDXWsGoQ
# 一般化、全員嘘つきも可、重複する答も可l

iars <- function(Answer){ # duplicate answer and/or case of all liars permitted
N=length(Answer)
dat=gtools::permutations(2,N,0:1,set=F,rep=T)
check <- function(y,answer=Answer){
if(all(y==1)) !all(1:N %in% answer)
else all(answer[y==0]==sum(y)) & !(sum(y) %in% answer[y==1])
# all honest answer compatible & not included in liar's anwer   
}
dat[apply(dat,1,check),]
}
liars(c(2,2,2,3,3))
liars(c(2,3,3,4,5))
liars(Answer<-sample(10,10,rep=T)) ; Answer
liars(c(4,5,5,6,7,7,8,8,9,10))
0418卵の名無しさん
垢版 |
2018/12/02(日) 22:54:14.37ID:5KkHnCxW
3S Policy Causes the ResultTruman of Panama document and 3S policy

We are keeping the citizens in a cage named "Freedom of Falsehood".
The way you just give them some luxury and convenience.Then release sports, screen, sex (3S).
Because the citizens are our livestock. For that reason, we must make it longevity. It makes it sick
(with chemicals etc.) and keeps it alive.This will keep us harvesting. This is also the authority
of the victorious country.The medal and the Nobel prize is not all Raoul declarationExamples of 3S policy
Hypocrites and disguised society and Panama document "He moved here here two years ago, I was afraid
of looking, but I thought it was a polite person to greet" Hello "when I saw it ... It was not like I was waking
this kind of incident ... ... "(Neighboring residents)On November 7, Shosuke Hotta, 42, a self-proclaimed office
worker in Sagamihara City, Kanagawa Prefecture, was arrested on suspicion of abusing her daughter Sakurai Ai.
This is the nature of the Earthlings
0419卵の名無しさん
垢版 |
2018/12/02(日) 23:16:13.68ID:+r9Osf+E
>>416
>互いに相関のある
なら変数減らせるんじゃね?
AUC?Area Under the Curve?
AICじゃなくて?
0420卵の名無しさん
垢版 |
2018/12/02(日) 23:31:52.94ID:61sstTZi
>>419
主成分3までで累積寄与度85%なので、3まで次元は減ります

主成分1 + 主成分2 + 主成分3とするのではなく

AUCを最大にする主成分1 + β1*主成分2 + β2*主成分3の
係数を出すっていうのは一般的に大丈夫なんでしょうか

AUCはarea under curveです
0421卵の名無しさん
垢版 |
2018/12/02(日) 23:42:05.45ID:+r9Osf+E
>>420
統計テキストの演習問題によくあるから一般的だろね。
三角形の周囲長のデータから線形回帰で面積を出すというような意味のないことやってるかも。
0422卵の名無しさん
垢版 |
2018/12/02(日) 23:50:18.66ID:5KkHnCxW
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.
0423卵の名無しさん
垢版 |
2018/12/02(日) 23:57:57.44ID:iMFc27fK
>>421
次数が減るのがメリットかなと…
0424卵の名無しさん
垢版 |
2018/12/03(月) 07:19:35.51ID:DAMQxIpv
>>423
長方形の周囲長者から面積をだすのに
データが100個あればラグランジェの補完式で100次元式で完璧に当てはめることができる。
フィボナッチ数列も同じ。
0425卵の名無しさん
垢版 |
2018/12/03(月) 07:22:30.11ID:DAMQxIpv
象の体表面積の計算に有用な数値ってどこだろ?
身長体重鼻の長さ耳の大きさ?
0426卵の名無しさん
垢版 |
2018/12/03(月) 07:24:12.72ID:DAMQxIpv
スリーサイズと身長体重の相関とか某女子大の講師が書いてたなw
0427卵の名無しさん
垢版 |
2018/12/03(月) 08:49:08.21ID:cRcCrmb8
par(mfrow=c(2,1))

f <- function(x,a=0.01) a^x - log(x)/log(a)
curve(f(x),0,2,bty='l') ; abline(h=1,col=8)
D( expression(a^x - log(x)/log(a)),'x')
df <- function(x,a=0.01) a^x * log(a) - 1/x/log(a)
curve(df(x))

g <- function(x,a=0.01) a^x/(log(x)/log(a))
curve(g(x),0,2,bty='l') ; abline(h=1,col=8)

D(expression (a^x/(log(x)/log(a))),'x')
dg <- function(x,a=0.01) a^x * log(a)/(log(x)/log(a)) - a^x * (1/x/log(a))/(log(x)/log(a))^2
curve(dg,0,10)
0429卵の名無しさん
垢版 |
2018/12/03(月) 12:54:57.80ID:DAMQxIpv
rm(list=ls())
library(gtools)
N=11
Answer=1:N
dat=permutations(2,N,0:1,set=F,rep=T) ; colnames(dat)=LETTERS[1:N]
# 1:嘘つき 0:正直 例.1 1 1 0 1 1 1 1 1 0 1で矛盾がないか調べる
check <- function(y,answer=Answer){ # remark 各人の解答
if(all(y==1)) !all(1:N %in% answer) # 正直者がいないとき
else all(answer[y==0]==sum(y)) & !(sum(y) %in% answer[y==1])
# すべての正直者の答のみが現実と一致するか?  
}
dat[apply(dat,1,check),]

# 一般化、全員嘘つきも可、重複する答も可
liars <- function(Answer,Strict=TRUE){ # duplicate answer and/or case of all liars permitted, Strict:liars always lie
N=length(Answer)
dat=gtools::permutations(2,N,0:1,set=F,rep=T)
check <- function(y,answer=Answer){
if(all(y==1)) !all(1:N %in% answer)
else if(Strict) all(answer[y==0]==sum(y)) & !(sum(y) %in% answer[y==1])
else all(answer[y==0]==sum(y))

# all honest answer compatible & not included in liar's anwer
}
dat[apply(dat,1,check),]
}
liars(c(2,2,2,3,3))
liars(c(2,3,3,4,5))
liars(Answer<-sample(10,10,rep=T)) ; Answer
liars(c(4,5,5,6,7,7,8,8,9,10))
liars(c(4,5,5,6,7,7,8,8,9,10),S=F)
0430卵の名無しさん
垢版 |
2018/12/03(月) 13:13:54.59ID:DAMQxIpv
シリツ医の使命は裏口入学撲滅国民運動の先頭に立つことだよ。

裏口入学の学生を除籍処分にしないかぎり、信頼の回復はないね。つまり、いつまで経ってもシリツ医大卒=裏口バカと汚名は拭えない。シリツ出身者こそ、裏口入学に厳しい処分せよを訴えるべき。

裏口入学医師の免許剥奪を!の国民運動の先頭に立てばよいぞ。
僕も裏口入学とか、言ってたら信頼の回復はない。
0431卵の名無しさん
垢版 |
2018/12/03(月) 15:36:25.67ID:1KqGOOJS
rm(list=ls())
graphics.off()
.a=0.01
f = function(x,a=.a) a^x-log(x)/log(a)
curve(f(x),bty='l',lwd=2) ; abline(h=0,col=8)
max=optimize(f,c(0,1),maximum=T)$maximum
min=optimize(f,c(0,1),maximum=F)$minimum
x1=uniroot(f,c(0,max))$root
x2=uniroot(f,c(max,min))$root
x3=uniroot(f,c(min,1))$root
ans=c(x1,x2,x3) ; ans
points(ans,c(0,0,0),pch=19,col=2)
0432卵の名無しさん
垢版 |
2018/12/03(月) 21:38:41.65ID:uthawMyt
liars <- function(Answer,Strict=TRUE){ # duplicate answer and/or case of all liars permitted
N=length(Answer)
dat=gtools::permutations(2,N,0:1,set=F,rep=T)
check <- function(y,answer=Answer){
if(all(y==1)) {!all(1:N %in% answer)}
else{
if(Strict){all(answer[y==0]==sum(y)) & !(sum(y) %in% answer[y==1])}
else {all(answer[y==0]==sum(y))}
}
# all honest answer compatible & not included in liar's anwer
}
dat[apply(dat,1,check),]
}
liars(c(2,2,2,3,3))
liars(c(2,3,3,4,5),S=F)

liars(Answer<-sample(10,10,rep=T),S=F) ; Answer
liars(Answer)
sort(Answer)
liars(c(1, 2, 3, 4, 5, 5, 5, 5, 9, 9, 9),Strict=FALSE)
liars(c(1, 2, 3, 4, 5, 5, 5, 5, 9, 9, 9),Strict=TRUE)
0433卵の名無しさん
垢版 |
2018/12/03(月) 21:39:50.88ID:uthawMyt
> liars(c(1, 2, 3, 4, 5, 5, 5, 5, 9, 9, 9),Strict=FALSE)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
[1,] 1 1 1 1 1 1 1 1 0 0 1
[2,] 1 1 1 1 1 1 1 1 0 1 0
[3,] 1 1 1 1 1 1 1 1 1 0 0
[4,] 1 1 1 1 1 1 1 1 1 1 1
> liars(c(1, 2, 3, 4, 5, 5, 5, 5, 9, 9, 9),Strict=TRUE)
[1] 1 1 1 1 1 1 1 1 1 1 1
0434卵の名無しさん
垢版 |
2018/12/03(月) 22:45:35.45ID:uthawMyt
liars <- function(Answer,Strict=TRUE){ # duplicate answer and/or case of all liars permitted
N=length(Answer)
arg=list()
for(i in 1:N) arg[[i]]=0:1
dat=do.call(expand.grid,arg) # expand.grid(0:1,0:1,0:1,...,0:1)
colnames(dat)=LETTERS[1:N]
check <- function(y,answer=Answer){
if(all(y==1)) {!all(1:N %in% answer)}
else{ # Strict: all honest answer compatible & not included in liar's anwer
if(Strict){all(answer[y==0]==sum(y)) & !(sum(y) %in% answer[y==1])}
else {all(answer[y==0]==sum(y))}
}
}
dat[apply(dat,1,check),]
}

liars(Answer<-sample(10,10,rep=T),S=F) ; Answer

liars(c(1, 2, 3, 4, 5, 5, 5, 5, 9, 9, 9),Strict=FALSE)
liars(c(1, 2, 3, 4, 5, 5, 5, 5, 9, 9, 9),Strict=TRUE)
0435卵の名無しさん
垢版 |
2018/12/03(月) 23:36:09.50ID:kWZ8ngVO
しゅごーいAWP
0436卵の名無しさん
垢版 |
2018/12/03(月) 23:36:55.91ID:uthawMyt
liars <- function(Answer,Strict=TRUE){ # duplicate answer and/or case of all liars permitted
N=length(Answer)
arg=list()
for(i in 1:N) arg[[i]]=0:1
dat=do.call(expand.grid,arg) # expand.grid(0:1,0:1,0:1,...,0:1)
colnames(dat)=LETTERS[1:N]
check <- function(y,answer=Answer){
if(all(y==1)) {!all(1:N %in% answer)}
else{ # Strict: all honest answer compatible & not included in liar's anwer
if(Strict){all(answer[y==0]==sum(y)) & !(sum(y) %in% answer[y==1])}
else {all(answer[y==0]==sum(y))}
}
}
res=as.matrix(dat[apply(dat,1,check),])
rownames(res)=NULL
return(res)
}

liars(Answer<-sample(10,10,rep=T),S=F) ; Answer

liars(c(1, 2, 3, 4, 5, 5, 5, 5, 9, 9, 9),Strict=FALSE)
liars(c(1, 2, 3, 4, 5, 5, 5, 5, 9, 9, 9),Strict=TRUE)
0437卵の名無しさん
垢版 |
2018/12/04(火) 01:12:57.83ID:nI+jKERK
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.
0438卵の名無しさん
垢版 |
2018/12/04(火) 15:14:54.20ID:nfS0Ph7I
>>436
個数を表示するように改造

# 一般化、全員嘘つきも可、重複する答も可
liars <- function(Answer,Strict=FALSE){ # duplicate answer and/or case of all liars permitted
N=length(Answer) # Strict: liars always lie, never tell the truth
arg=list()
for(i in 1:N) arg[[i]]=0:1
dat=do.call(expand.grid,arg) # expand.grid(0:1,0:1,0:1,...,0:1)
colnames(dat)=LETTERS[1:N]
check <- function(y,answer=Answer){
if(all(y==1)) {!all(1:N %in% answer)}
else{ # Strict: all honest answer compatible & not included in liar's anwer
if(Strict){all(answer[y==0]==sum(y)) & !(sum(y) %in% answer[y==1])}
else {all(answer[y==0]==sum(y))}
}
}
re=as.matrix(dat[apply(dat,1,check),])
rownames(re)=1:nrow(re)
return(rbind(re,Answer))
}


liars(Answer<-sample(10,10,rep=T),S=F)

liars(c(1,2,3,4,5,5,5,5,9,9,9),Strict=FALSE)
liars(c(1,2,3,4,5,5,5,5,9,9,9),Strict=TRUE)
liars(c(7,7,7,7,8,8,8,9,9,10,11),Strict=F)
0439卵の名無しさん
垢版 |
2018/12/04(火) 19:24:56.87ID:nfS0Ph7I
バスの到着間隔が平均30分の指数分布であるEバスと
平均30分の一様分布であるUバスではどちらが待ち時間の期待値が小さいか?
0440卵の名無しさん
垢版 |
2018/12/05(水) 00:36:57.95ID:DRmF49xK
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.
0441卵の名無しさん
垢版 |
2018/12/05(水) 18:34:25.14ID:mPAQrzgG
-- zerOne 5 -> [[0,0,0,0,0],[0,0,0,0,1]....[1,1,1,1,1,1]
zeroOne :: Num a => Int -> [[a]]
zeroOne n = (!! n) $ iterate (\x-> [a:b|a<-[0,1],b<-x]) [[]]
0442卵の名無しさん
垢版 |
2018/12/05(水) 19:07:50.43ID:XTI9A75j
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.
0443卵の名無しさん
垢版 |
2018/12/05(水) 22:12:31.75ID:kHtcpiLC
# dat : all possible combinations
n=5 ;arg=list()
for(i in 1:n) arg[[i]]=0:1
dat=do.call(expand.grid,arg) # expand.grid(0:1,0:1,...)
dat=as.matrix(dat)
colnames(dat)=LETTERS[1:n]

# A=>!B, B=>C, C=>!D&!E, D=>!E, E=>E
is.compati<-function(i,x){ # i:index of honest, x: possible combination
switch(i, # 1..n
x['B']==0, # testified by A (=LETTERS[1])
x['C']==1, # testified by B (=LETTERS[2])
x['D']==0 & x['E']==0, # ...
x['E']==0,
x['E']==1)
}

check=function(x){
re=NULL
honest=which(x==1) # index of honest
for(i in honest){
re=append(re,is.compati(i,x))
}
all(re)
}
dat[apply(dat,1,check),]
0444卵の名無しさん
垢版 |
2018/12/05(水) 22:13:09.98ID:kHtcpiLC
正直者は嘘をつかないが
嘘つきは嘘をつくこともつかないこともある。

A〜Eの5人が次のように発言している
A「Bはウソつきだ」
B「Cはウソつきではない」
C「D.Eはどちらもウソつきだ」
D「Eはウソつきだ」
E「私はウソつきではない」

5人のうち、正直者と嘘つきは誰か?
可能性のある組合せをすべて示せ。
0445卵の名無しさん
垢版 |
2018/12/06(木) 09:56:22.91ID:cp3ws/tO
>>444
嘘つきが必ず嘘をつくStrict=TRUE、嘘も真実もいうStrict=FALSE
でどちらにも対応。

# dat : all possible combinations
n=5 ;arg=list()
for(i in 1:n) arg[[i]]=0:1
dat=do.call(expand.grid,arg) # expand.grid(0:1,0:1,...)
dat=as.matrix(dat)
colnames(dat)=LETTERS[1:n]

# A=>!B, B=>C, C=>!D&!E, D=>!E, E=>E
is.compati.H<-function(i,x){ # i:index of honest, x: possible combination
switch(i, # 1..n
x['B']==0, # testified by A (=LETTERS[1])
x['C']==1, # testified by B (=LETTERS[2])
x['D']==0 & x['E']==0, # ...
x['E']==0,
x['E']==1)
}
is.compati.L <- function(i,x){# is compatible for liars?
# i:index of liars, x: possible combination
switch(i, # 1..n
!(x['B']==0), # testified by A (=LETTERS[1])
!(x['C']==1), # testified by B (=LETTERS[2])
!(x['D']==0 & x['E']==0), # ...
!(x['E']==0),
!(x['E']==1))
}
0446卵の名無しさん
垢版 |
2018/12/06(木) 09:56:52.33ID:cp3ws/tO
check=function(x,Strict){
re=NULL
honest=which(x==1) # index of honest
for(i in honest){
re=append(re,is.compati.H(i,x))
}
if(Strict){
liar=which(x==0) # index of liar
for(i in liar){
re=append(re,is.compati.L(i,x))
}
}
all(re)
}
dat[apply(dat,1,function(x) check(x,Strict=TRUE)),]
dat[apply(dat,1,function(x) check(x,Strict=FALSE)),]
0447卵の名無しさん
垢版 |
2018/12/06(木) 16:42:18.52ID:E+1fMA/x
dat=as.matrix(expand.grid(1:0,1:0,1:0))
colnames(dat)=LETTERS[1:3]
compati.H <- function(i,x){ # i index of honest, x: possible combination
switch(i, # i= 1,2,or,3
# if A is honest, B should be honest, compatible?
ans <- x[2]==1, # when i=1
# if B is honest,C is a liar thereby A should be honest. compatible?
ans <- x[3]==0 & ifelse(x[3]==0,!(x[1]==0),x[1]==0), # when i=2, x[3]==0 & x[1]==1
ans <- NULL) # when i=3
return(ans)
}
compati.L <- function(i,x){ # i index of liar, x: possible combination
switch(i,
ans <- x[2]==0,
ans <- x[3]==1 & x[1]==1,
ans <- NULL)
return(ans)}

check <- function(x,Strict){
re=NULL
honest <- which(x==1)
for(i in honest){
re=append(re,compati.H(i,x))}
if(Strict){
liar <- which(x==0)
for(i in liar){
re=append(re,compati.L(i,x)) }}
all(re)}

dat[apply(dat,1,function(x) check(x,Strict=TRUE)),]

dat[apply(dat,1,function(x) check(x,Strict=FALSE)),]
0448卵の名無しさん
垢版 |
2018/12/06(木) 20:20:59.86ID:E+1fMA/x
a=1
m=100
n=1e6
x=sample(c(a/m,m*a),n,rep=T,prob=c(m/(m+1),1/(m+1))) ; hist(x,freq=F) ; mean(x)
a/m*m/(m+1)+m*a*1/(m+1) ; a/(m+1)*(1+m)
plot(c(m/(m/1),1/(m+1)),c(a/m,m*a),bty='l')
EX2=(a/m)^2*m/(m+1)+(m*a)^2*(1/(m+1))
(EW = EX2/a/2) ; mean(x^2)/mean(x)/2
EW <- function(m,a=1) (m^3+1)/m/(m+1)/2*a
m=1:100
plot(m,EW(m),bty='l')
0449卵の名無しさん
垢版 |
2018/12/07(金) 03:14:44.29ID:YE3oTb4v
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.
0450卵の名無しさん
垢版 |
2018/12/07(金) 08:24:44.19ID:ySmU7MDt
>>449
裏口馬鹿にもわかるように原文もつけなきゃ。


原文はこれな。

私は昭和の時代に大学受験したけど、昔は今よりも差別感が凄く、慶応以外の私立医は特殊民のための特殊学校というイメージで開業医のバカ息子以外は誰も受験しようとすらしなかった。
常識的に考えて、数千万という法外な金を払って、しかも同業者からも患者からもバカだの裏口だのと散々罵られるのをわかって好き好んで私立医に行く同級生は一人もいませんでした。
本人には面と向かっては言わないけれど、俺くらいの年代の人間は、おそらくは8−9割は私立卒を今でも「何偉そうなこと抜かしてるんだ、この裏口バカが」と心の底で軽蔑し、嘲笑しているよ。当の本人には面と向かっては絶対にそんなことは言わないけどね。
0451卵の名無しさん
垢版 |
2018/12/07(金) 08:27:54.51ID:ySmU7MDt
開業医スレのシリツ三法則(試案、名投稿より作成)

1.私立医が予想通り糞だからしょうがない

>https://egg.5ch.net/test/read.cgi/hosp/1537519628/101-102
>https://egg.5ch.net/test/read.cgi/hosp/1537519628/844-853
ID:RFPm1BdQ

>https://egg.5ch.net/test/read.cgi/hosp/1537519628/869
>https://egg.5ch.net/test/read.cgi/hosp/1537519628/874-875
>https://egg.5ch.net/test/read.cgi/hosp/1537519628/874-880
>https://egg.5ch.net/test/read.cgi/hosp/1537519628/882
ID:liUvUPgn

2.馬鹿に馬鹿と言っちゃ嫌われるのは摂理
実例大杉!

3.リアルでは皆思ってるだけで口に出してないだけ
http://ishikisoku.com/wp-content/uploads/2016/12/SQIR26V.jpg
0452卵の名無しさん
垢版 |
2018/12/07(金) 20:21:20.38ID:g1XwAPhY
3S Policy Causes the ResultTruman of Panama document and 3S policy

We are keeping the citizens in a cage named "Freedom of Falsehood".
The way you just give them some luxury and convenience.Then release sports, screen, sex (3S).
Because the citizens are our livestock. For that reason, we must make it longevity. It makes it sick
(with chemicals etc.) and keeps it alive.This will keep us harvesting. This is also the authority
of the victorious country.The medal and the Nobel prize is not all Raoul declarationExamples of 3S policy
Hypocrites and disguised society and Panama document "He moved here here two years ago, I was afraid
of looking, but I thought it was a polite person to greet" Hello "when I saw it ... It was not like I was waking
this kind of incident ... ... "(Neighboring residents)On November 7, Shosuke Hotta, 42, a self-proclaimed office
worker in Sagamihara City, Kanagawa Prefecture, was arrested on suspicion of abusing her daughter Sakurai Ai.
This is the nature of the Earthlings
0453卵の名無しさん
垢版 |
2018/12/08(土) 07:31:43.87ID:xRW0g7nq
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.
0454卵の名無しさん
垢版 |
2018/12/08(土) 20:18:41.06ID:W3abFsTH
liars <- function(Answer,Strict=TRUE){ # duplicate answer and/or case of all liars permitted
N=length(Answer)
arg=list()
for(i in 1:N) arg[[i]]=0:1
dat=do.call(expand.grid,arg) # expand.grid(0:1,0:1,0:1,...,0:1)
colnames(dat)=LETTERS[1:N]
check <- function(y,answer=Answer){
if(all(y==1)) {!all(1:N %in% answer)}
else{ # Strict: all honest answer compatible & not included in liar's anwer
if(Strict){all(answer[y==0]==sum(y)) & !(sum(y) %in% answer[y==1])}
else {all(answer[y==0]==sum(y))}
}
}
dat[apply(dat,1,check),]
}

liars(Answer<-sample(10,10,rep=T),S=F) ; Answer

liars(c(1, 2, 3, 4, 5, 5, 5, 5, 9, 9, 9),Strict=FALSE)
liars(c(1, 2, 3, 4, 5, 5, 5, 5, 9, 9, 9),Strict=TRUE)
0456卵の名無しさん
垢版 |
2018/12/10(月) 04:15:43.72ID:u30TNISd
呪文:「ド底辺シリツ医大が悪いのではない、本人の頭が悪いんだ」を唱えると甲状腺機能が正常化するという統計処理の捏造をやってみる。

TSH : 0.34〜4.0 TSH:μIU/mlを基準値として(これが平均±2×標準偏差で計算されているとして)呪文前と呪文後のデータを正規分布で各々50個つくる。
負になった場合は検出限界以下として0にする。
http://i.imgur.com/k7MbKQ0.jpg
同じ平均値と標準偏差で乱数発生させただけなので両群には有意差はない。
横軸に呪文前のTSHの値、縦軸にTSHの変化(呪文後−呪文前)をグラフしてみると
http://i.imgur.com/GQ5X23P.jpg

つまり、呪文前のTSHが高いほど呪文後はTSHは下がり、呪文前のTSHが低いほど呪文後のTSHは上がるという傾向がみてとれる。
これを線形回帰して確かめてみる。

回帰直線のパラメータは以下の通り。

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.3812 0.3323 7.165 4.10e-09 ***
before -1.0351 0.1411 -7.338 2.24e-09 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.8365 on 48 degrees of freedom
Multiple R-squared: 0.5287, Adjusted R-squared: 0.5189
F-statistic: 53.84 on 1 and 48 DF, p-value: 2.237e-09

p = 2.24e-09 なので有意差ありとしてよい。

ゆえに、「ド底辺シリツ医大が悪いのではない、本人の頭が悪いんだ」という呪文は甲状腺機能を正常化させる。

ここで問題、この統計処理のどこが誤っているか?
0457卵の名無しさん
垢版 |
2018/12/10(月) 14:52:10.55ID:SBKPI/ud
アタマわるわる〜
0459卵の名無しさん
垢版 |
2018/12/11(火) 08:23:18.37ID:EyBBmFk4
野獣先輩、オナシャス
アタマわるわるわ〜るわる〜
アタマわるわるわ〜るわる〜
あそれっ
アタマわるわるわ〜るわる〜
アタマわるわるわ〜るわる〜
あよいしょっ
アタマわるわるわ〜るわる〜
アタマわるわるわ〜るわる〜
あくしろよ
アタマわるわるわ〜るわる〜
アタマわるわるわ〜るわる〜
endless
0460卵の名無しさん
垢版 |
2018/12/11(火) 08:39:06.09ID:PFEjAytf
>>459
文章だけでド底辺シリツ医大卒の裏口馬鹿とわかる。
これに答えられない国立卒がいた。
駅弁らしいが。

平均0、分散1の正規分布の95%信頼区域は[-1.96,1.96]で区域長は約3.92である。
平均0、分散1の一様分布の95%信頼区域の区域長さはいくらか?
0461卵の名無しさん
垢版 |
2018/12/11(火) 13:32:28.73ID:c5MyHopu
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.
0462卵の名無しさん
垢版 |
2018/12/12(水) 22:30:23.75ID:x9HwYbel
おいこら
あっちでまた非医師仲間のコンプが湧いてるぞ
さっさと引き取れや
0463卵の名無しさん
垢版 |
2018/12/14(金) 12:51:17.00ID:eeDD4wBK
回答付きでレスできない椰子ってシリツ卒なんだろうな。
0464卵の名無しさん
垢版 |
2018/12/14(金) 23:45:34.35ID:/gtLrghw
お前は今までに吐いたゲロの回数を覚えているのか?
0466卵の名無しさん
垢版 |
2018/12/15(土) 06:57:22.51ID:PqeMZC8f
ある女医が一日に5回屁をこいたとする。
屁の回数はポアソン分布と仮定して
この女医の一日にこく屁の回数の95%信頼区間を述べよ、
という問題にできるぞ。
答えてみ!
0467卵の名無しさん
垢版 |
2018/12/15(土) 07:17:43.02ID:PqeMZC8f
事前分布を想定して現実のデータからその分布の最適分布を算出する。当然、区間推定にある。
relocation of probability dustrubution
これがベイズ統計の基本的な考え方だよ。
上記の女医の屁の回数も区間推定できる。
0468卵の名無しさん
垢版 |
2018/12/15(土) 07:47:09.33ID:PqeMZC8f
ゲロの回数だとゼロ過剰ポアソン分布の方がいいだろうな。
0470卵の名無しさん
垢版 |
2018/12/15(土) 08:21:49.91ID:dSAl+lHg
臨床問題です
サブとアドンとBLの関連を原稿用紙30枚以上で考察せよ
0472卵の名無しさん
垢版 |
2018/12/15(土) 08:25:40.34ID:PqeMZC8f
>>470
問題の意味がわからないから詳述してくれ。
女医の屁の方は問題設定が明確だぞ。
0473卵の名無しさん
垢版 |
2018/12/15(土) 08:48:13.42ID:PqeMZC8f
ゲロの回数の事前分布なら
Zero-Inflated Negative Binomial Distribution
の方がいいかな。

Rにパッケージがあったような。
ポアソンよりパラメータが多くなるな。
0476卵の名無しさん
垢版 |
2018/12/15(土) 13:48:34.67ID:dSAl+lHg
問題に回答できないとは
さては中卒ニートだな
0477卵の名無しさん
垢版 |
2018/12/15(土) 14:06:30.51ID:Eu3ncs/k
>>476
>>470
問題の意味がわからないから詳述してくれ。
女医の屁の方は問題設定が明確だぞ。
0478卵の名無しさん
垢版 |
2018/12/15(土) 15:08:53.35ID:5ZAJ5aCI
こんな感じでゼロ過剰ポアソン分布モデルがつくれるな。

1年間にゲロを吐かない確率0.9
ゲロを吐いた場合の1年間あたりの回数=平均2のポアソン分布

theta=0.9
lambda=2
N=1e5
# Zero inflated poisson distribution
zip=numeric(N)
for (i in seq_along(zip)){
if(rbinom(1,1,1-theta)==0){
zip[i]=0
}else{
zip[i]=rpois(1,lambda)
}
}

おい、ド底辺、上記の過剰ポアソン分布モデルで
1年間に吐くゲロの回数の平均値を出してみ!
0479卵の名無しさん
垢版 |
2018/12/15(土) 15:09:33.17ID:5ZAJ5aCI
女医の放屁の方はポアソン分布でよさそうだな。

95%信頼区間を計算できたか?
0480卵の名無しさん
垢版 |
2018/12/15(土) 15:18:08.34ID:efNsfNge
自分で出した算数クイズは解けても
考察を要する問題は中卒には難しいようだな
解きやすいように少し簡単な問題にしてやろう

さて臨床問題です
ガチユリとフタナリの相関性について原稿用紙30枚以上で考察せよ
0482卵の名無しさん
垢版 |
2018/12/15(土) 15:41:42.49ID:5ZAJ5aCI
問題文が理解できない問題には答えられない。
当たり前のこと。
数学すれでも群論の話がでると俺は蚊帳の外。
図形とか確率なら理解できるから、取り組むよ。

こういうのは問題の意味は明確。
統計スレに書いていてポアソン分布知らないならお話にならないが。

ある女医が一日に5回屁をこいたとする。
屁の回数はポアソン分布と仮定して
この女医の一日にこく屁の回数の95%信頼区間を述べよ。
0483卵の名無しさん
垢版 |
2018/12/15(土) 15:50:36.53ID:5ZAJ5aCI
インフルエンザ迅速検査キットの感度が80%、偽陽性率1%とする。

臨床的にはインフルエンザを疑うが迅速検査陰性、

不要な薬は使いたくない、と患者の要望。

検査が早期すぎるための偽陰性かと考えて翌日再検したが、こちらも陰性。

「私がインフルエンザである可能性はどれくらいありますか?
可能性が10%以上なら仕事を休んで抗ウイルス薬希望します。」

という、検査前の有病率がいくら以上であればこの患者に抗ウイルス薬を処方することになるか?
0484卵の名無しさん
垢版 |
2018/12/15(土) 15:58:10.95ID:5ZAJ5aCI
nLR=(1-0.80)/0.99 # FN/TN
po=0.1/(1-0.1)
o=po/nLR^2 # po=o*nLR^2
o/(1+o)
0485卵の名無しさん
垢版 |
2018/12/15(土) 16:30:26.03ID:5ZAJ5aCI
インフルエンザの流行期ならなら有熱で受診した患者がインフルエンザである確率分布はこんな感じ(青のヒストグラム)

https://i.imgur.com/EjxDDQB.jpg

平均値80%となるβ分布Beta(8,2)を想定。

すると インフルエンザ迅速検査キットの感度が80%、偽陽性率1%のキットでの検査陰性が2回続いた患者がインフルエンザである確率は桃色のヒストグラムのような分布になる。

平均値約20%、インフルエンザである確率が10%以上である可能性は74%と説明できる。
0486卵の名無しさん
垢版 |
2018/12/15(土) 16:41:26.81ID:5ZAJ5aCI
nLR=(1-0.80)/0.99 # FN/TN
po=0.1/(1-0.1)
o=po/nLR^2 # po=o*nLR^2
o/(1+o)

curve(dbeta(x,8,2),bty='l',ann=F,type='h',col='maroon')
N=1e5
x=rbeta(N,8,2)
hist(x,breaks=30,col='lightblue',main='検査前有病確率',
f=F,xlab='',yaxt='n', ylab='')
o=x/(1-x)
po=o*nLR^2
pp=po/(1+po)
# hist(pp,f=F,breaks=50,col='pink',main='検査後有病確率',
yaxt='n', xlab='',ylab='')
BEST::plotPost(pp,compVal = 0.10,breaks=60,xlab="2回陰性後有病確率",
col='pink',showMode=F)
0487卵の名無しさん
垢版 |
2018/12/15(土) 16:43:14.07ID:5ZAJ5aCI
par(mfrow=c(2,1))
theta=0.9
lambda=2
N=1e5
# Zero inflated poisson distribution
zip=numeric(N)
for (i in seq_along(zip)){
if(rbinom(1,1,1-theta)==0){
zip[i]=0
}else{
zip[i]=rpois(1,lambda)
}
}
hist(zip)
HDInterval::hdi(zip)
mean(zip)

# Hurdle distribution
hurdle=numeric(N)
for (i in seq_along(hurdle)){
if(rbinom(1,1,1-theta)==0){ # if zero, then zero
hurdle[i]=0
}else{ # else zero truncated poisson distribution
tmp=0
while(tmp==0){
tmp=rpois(1,lambda)
}
hurdle[i]=tmp
}
}
hist(hurdle)
HDInterval::hdi(hurdle)
0488卵の名無しさん
垢版 |
2018/12/15(土) 17:13:08.28ID:dSAl+lHg
この程度の問題文が理解できないとは
さては中卒ニートだな
0489卵の名無しさん
垢版 |
2018/12/15(土) 17:48:16.98ID:Eu3ncs/k
>>488
自分の出した問題も説明できないとはド底辺シリツか?
0490卵の名無しさん
垢版 |
2018/12/15(土) 17:50:19.60ID:Eu3ncs/k
>>488
知らんことには回答できない。
答えてほしけりゃ問題を敷衍して書けよ。
統計ネタなら答えるぞ。
0491卵の名無しさん
垢版 |
2018/12/15(土) 19:14:33.63ID:lcyf4Gyo
問題が理解すらできないとは
さては中卒ニートだな
0493卵の名無しさん
垢版 |
2018/12/15(土) 20:03:13.15ID:lcyf4Gyo
試験で解答できなきゃ零点だ
0494卵の名無しさん
垢版 |
2018/12/15(土) 20:24:09.71ID:Eu3ncs/k
>>493
不適切問題じゃね。
こういうのが即答できれば基礎学力の試験になる。

ある女医が一日に5回屁をこいたとする。
屁の回数はポアソン分布と仮定して
この女医の一日にこく屁の回数の95%信頼区間を述べよ、
0496卵の名無しさん
垢版 |
2018/12/15(土) 21:14:31.96ID:3n76OB9+
捏造データでお遊んでろ。
0497卵の名無しさん
垢版 |
2018/12/15(土) 21:24:38.91ID:Eu3ncs/k
>>496
ベイズ統計における事前確認は捏造ではなく
無情報もしくは弱情報分布である。
日本人女性の平均身長を1〜2mの分布とする
というのが弱情報分布。
0498卵の名無しさん
垢版 |
2018/12/15(土) 21:25:49.01ID:Eu3ncs/k
事前分布の分散は逆ガンマより半コーシーを使うのがGelman流ね。
0499卵の名無しさん
垢版 |
2018/12/15(土) 21:29:02.64ID:Eu3ncs/k
事前確率分布を設定することでこういう計算も可能となる。
オマエの知識レベルじゃ無理だろうけど。

インフルエンザの迅速キットは特異度は高いが感度は検査時期によって左右される。
ある診断キットが開発されたとする。
このキットは特異度は99%と良好であったが、
感度については確かな情報がない。
事前確率分布として一様分布を仮定する。
50人を無作為抽出してこの診断キットで診断したところ40人が陽性であった。
この母集団の有病率の期待値と95%CIはいくらか?
またこの診断キットの感度の期待値と95%CIはいくらか
0500卵の名無しさん
垢版 |
2018/12/16(日) 01:08:39.24ID:/hMzfoFS
1年:進級失敗10人、うち1人放校
2年:進級失敗16人、放校なし
3年:進級失敗34人、うち放校9人
4年:進級失敗9人、うち放校2人
5年:進級失敗10人、うち放校1人
6年:卒業失敗26人、うち放校1人

https://mao.5ch.net/test/read.cgi/doctor/1488993025/1

この放校者数をポアソン分布とゼロ過剰ポアソン分布で回帰してみる。

library(VGAM)
n=0:10
hoko=c(1,0,9,2,1,1)
fitp=glm(hoko ~ 1,poisson())
coef(fitp)
plot(nn,dpois(n,coef(fitp)),bty='l')
summary(fitp)

fitz=vglm(hoko ~ 1,zipoisson())
coef(fitz)
summary(fitz)
(pstr0=exp(coef(fitz)[1]))
(lambda=logit(coef(fit)[2],inv=T))
plot(n,dzipois(nn,lambda,pstr0),bty='l',pch=19)

https://i.imgur.com/TptfCA8.jpg
0501卵の名無しさん
垢版 |
2018/12/16(日) 06:39:53.73ID:ZC5C+Eow
算数の問題です
エリンギとマツタケの使用頻度を検証すると
あぁん いくいく いっひゃうのらぁ
0503卵の名無しさん
垢版 |
2018/12/16(日) 07:49:21.32ID:/hMzfoFS
これも親切設計

wants <- c("lmtest", "MASS", "pscl", "sandwich", "VGAM")
has <- wants %in% rownames(installed.packages())
if(any(!has)) install.packages(wants[!has])
0504卵の名無しさん
垢版 |
2018/12/16(日) 10:16:17.73ID:1U2yFJp0
>>501
おい、上の過剰ゼロポアソンモデルから放校者数の期待値を計算してみ。
来年のド底辺シリツ医大の放校者の予想になるぞ。
まあ、ド底辺シリツが放校者ゼロ過剰というのは過大評価だがね。
0505卵の名無しさん
垢版 |
2018/12/16(日) 10:39:40.56ID:/hMzfoFS
pairsxyz <- function(x,y,z){
xyz=data.frame(x,y,z)
panel.cor <- function(x, y, ...){
usr <- par('usr'); on.exit(par(usr))
par(usr=c(0,1,0,1))
r <- cor(x, y, method='spearman', use='pairwise.complete.obs')
zcol <- lattice::level.colors(r, at=seq(-1, 1, length=81), col.regions=colorRampPalette(c(scales::muted('red'),'white',scales::muted('blue')), space='rgb')(81))
ell <- ellipse::ellipse(r, level=0.95, type='l', npoints=50, scale=c(.2, .2), centre=c(.5, .5))
polygon(ell, col=zcol, border=zcol, ...)
text(x=.5, y=.5, lab=100*round(r, 2), cex=2, col='black')
pval <- cor.test(x, y, method='pearson', use='pairwise.complete.obs')$p.value
sig <- symnum(pval, corr=FALSE, na=FALSE, cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1), symbols = c('***', '**', '*', '.', ' '))
text(.6, .8, sig, cex=2, col='gray20')
}
panel.hist <- function(x, ...) {
usr <- par('usr'); on.exit(par(usr))
par(usr=c(usr[1:2], 0, 1.5))
h <- hist(x, plot=FALSE)
breaks <- h$breaks
nB <- length(breaks)
y <- h$counts; y <- y/max(y)
rect(breaks[-nB], 0, breaks[-1], y, col='lightblue', ...)
}
cols.key <- scales::muted(c('red', 'blue', 'green'))
cols.key <- adjustcolor(cols.key, alpha.f=1/4)
# pchs.key <- rep(19, 3)
# gr <- as.factor(1:3)
panel.scatter <- function(x, y){
# points(x, y, col=cols.key[gr], pch=19, cex=1)
points(x, y, col=sample(colours(),1),pch=19, cex=1)
lines(lowess(x, y))
}
0506卵の名無しさん
垢版 |
2018/12/16(日) 10:40:27.95ID:/hMzfoFS
pairs(xyz,
diag.panel=panel.hist,
lower.panel=panel.scatter,
upper.panel=panel.cor,
gap=0.5,
labels=gsub('\\.', '\n', colnames(xyz)),
label.pos=0.7,
cex.labels=1.4)
}

Nt <- 100
x <- sample(20:40, Nt, replace=TRUE)
y <- rnorm(Nt, 100, 15)
z <- rbinom(Nt, size=x, prob=0.5)
pairsxyz(x,y,z)

pairs も カスタマイズすればわりと使えるな。
0508卵の名無しさん
垢版 |
2018/12/16(日) 11:42:14.17ID:/hMzfoFS
Nt <- 100
set.seed(123)
Ti <- sample(20:40, Nt, replace=TRUE)
Xt <- rlnorm(Nt, 100, 15)
Yt <- rbinom(Nt, size=Ti, prob=0.8)

20-40人からなるド底辺シリツ学生のグループを100組集める。
各グループを代表する知能指数が正規分布をしている。
裏口の確率は80%である。

その線形回帰は

glm(Yt ~ Xt, family=poisson(link="log"), offset=log(Ti))
0509卵の名無しさん
垢版 |
2018/12/16(日) 14:16:40.36ID:/hMzfoFS
source('tmp.tools.R')

library(Mass)
set.seed(71)
size <- 10000
x <- -seq(1/size,1,by=1/size)
shape <- 10.7
mu <- exp(3.7*x+2)
y1 <- sapply(mu, function(m)rnegbin(1, mu=m, theta=shape))
pairsxyz(cbind(x,y1,mu))
model_glmnb <- glm.nb(y1 ~ x)
summary(model_glmnb)

plot(x,y1,pch=19,col=rgb(.01,.01,.01,.02))
points(x,fitted(model_glmnb,seq(0,1,len=size)),col=0)
lines(x,model_glmnb$fitted)
points(x,mu,col=rgb(0,0,1,0.01),cex=0.5)

#
lambda <- sapply(mu,function(x) rgamma(1,shape=shape,scale=x/shape))
y2 <- sapply(lambda,function(x) rpois(1,x))
hist(y1,f=F,breaks=50)
hist(y2,f=F,breaks=50, add=T,col=5)
0510卵の名無しさん
垢版 |
2018/12/16(日) 20:30:27.72ID:/hMzfoFS
# ネットワークノード1..j..N
# ネットワーク内の客の数1..k..K、
# ノードjでの平均客数L[k,j]、通過時間W[k,j]、到着率lambda[k,j]
# mu[j]:サービス率,r[i,j]ノードiからjへの移行確率
# theta[j] = Σtheta[i](i=1,N) * r[i,j] の解がtheta
rm(list=ls())
theta=c(0.6,0.4)
mu=c(0.6,0.4)
N=2
K=10
L=W=lambda=matrix(rep(NA,N*K),ncol=N)

k=1
for(j in 1:N){
W[k,j]=1/mu[j]*(1+0)
}
tmp=numeric(N)
for(j in 1:N){
tmp[j]=theta[j]*W[k,j]
}
den=sum(tmp)
lambda[k,1]=k/den
for(j in 2:N){
lambda[k,j]=theta[j]*lambda[k,1]
}
for(j in 1:N){
L[k,j]=lambda[k,j]*W[k,j]
}
0511卵の名無しさん
垢版 |
2018/12/16(日) 20:30:52.05ID:/hMzfoFS
#
for(k in 2:K){
for(j in 1:N){
W[k,j]=1/mu[j]*(1 + L[k-1,j])
}
tmp=numeric(N)
for(j in 1:N){
tmp[j]=theta[j]*W[k,j]
}
den=sum(tmp)
lambda[k,1]=k/den
for(j in 2:N){
lambda[k,j]=theta[j]*lambda[k,1]
}
for(j in 1:N){
L[k,j]=lambda[k,j]*W[k,j]
}
}
L
W
lambda
0512卵の名無しさん
垢版 |
2018/12/17(月) 04:38:09.36ID:GOYrgwsC
minimize 2*b+4*sin(θ)/(cos(θ)-1/2)*α where (θ-sin(θ)/2+(sin(θ)/(cos(θ)-1/2))^2(α-sin(α))/2+(1-b)*sin(θ)/2=pi/8 ,0<b<1,0<θ<pi/2
0514卵の名無しさん
垢版 |
2018/12/17(月) 05:14:49.85ID:GOYrgwsC
rangeB = map (/1000) [1..1000]
rangeTheta = map (\x -> x * pi/2/1000) [1..1000]
rangeAlpha = map (\x -> x * pi/1000) [1..1000]
rangeR = map (\x -> x * 1/1000) [1000..10000]
re = [2*b+4*r*α| b<-rangeB,θ<-rangeTheta, α<-rangeAlpha,r<-rangeR,(θ-sin(θ))/2+r^2*(α-sin(α))/2+(1-b)*sin(θ)/2==pi/8]
main = do
print $ minimum re
0515卵の名無しさん
垢版 |
2018/12/17(月) 05:39:04.50ID:GOYrgwsC
rangeB = map (/1000) [1..1000]
rangeTheta = map (\x -> x * pi/2/1000) [1..1000]
rangeAlpha = map (\x -> x * pi/1000) [1..1000]
re = [(2*b+4*sin(θ)/(cos(θ)-1/2)*α)| b<-rangeB,θ<-rangeTheta, α<-rangeAlpha,(θ-sin(θ))/2+(sin(θ)/(cos(θ)-1/2))^2*(α-sin(α))/2+(1-b)*sin(θ)/2==pi/8]
main = do
print $ minimum re
0517卵の名無しさん
垢版 |
2018/12/17(月) 05:47:36.95ID:GOYrgwsC
minimize(2*b+4rα) where (θ-sinθ)/2+r^2(α-sinα)/2+(1-b)sinθ/2=pi/8 ,0<b<1,0<θ<pi/2,0<α<2*pi
0518卵の名無しさん
垢版 |
2018/12/17(月) 13:52:12.63ID:FuhGkKV8
向学心のないコミュ障事務員のスレ

事務員と見せかけてその正体は大学受験に失敗したニートだろうな
二十歳前くらいの大学受験の知識で一生わたっていけると勘違いしているらしい

いや勘違いというか自分にそう言い聞かせなければいけないほど
人生終わってんだろうな
ハゲワロス
0519卵の名無しさん
垢版 |
2018/12/17(月) 13:59:09.34ID:N+SAyf9z
>>518
こういう野糞投稿しかできないのはド底辺シリツかな?
ド底辺スレから部屋割計算できなくて逃げ出したアホと同一人物?
0520卵の名無しさん
垢版 |
2018/12/17(月) 14:01:55.57ID:N+SAyf9z
>>518
向学心を語るなら>499の計算してからな。
ド底辺頭脳クン。
0521卵の名無しさん
垢版 |
2018/12/17(月) 14:02:51.74ID:FuhGkKV8
人生についての向学心は大学受験なんていう狭い領域で机上の空論をこねくり回すことではない
だがいつまでも不合格の受験生は、その領域から抜け出せなくなるんだなW

向学心のない事務員にふさわしいスレを持ってきてやったぞ

【因果応報】医学部再受験【自業自得】
https://medaka.5ch.net/test/read.cgi/kouri/1543851603/
0522卵の名無しさん
垢版 |
2018/12/17(月) 14:07:07.62ID:N+SAyf9z
>>521
>499は受験に無関係な臨床問題だよ。
答えてみ!
はよ!はよ!
向学心を語るなら>499の計算してからな。
ド底辺頭脳クン。
0525卵の名無しさん
垢版 |
2018/12/17(月) 14:14:33.64ID:N+SAyf9z
ド底辺頭脳でもこれくらいできるかな?

12^2 = 144 ........................ 21^2 = 441
13^2 = 169 ........................ 31^2 = 961

二桁の数でこうなるのは他にある?

向学心も頭脳もないから答えられないだろうな。
0526卵の名無しさん
垢版 |
2018/12/17(月) 14:26:10.34ID:FuhGkKV8
さあそろそろ今日の宿題の問題を出題しといてやろうか
事務員には無理だろうけどな

さて問題です
ラブアンドピースとアヘ顔ダブルピースの相似性について原稿用紙30枚以上で考察せよ
0527卵の名無しさん
垢版 |
2018/12/17(月) 14:40:27.65ID:qP6ufigZ
>>525
2行で答がでる。

ド底辺頭脳には無理。

[(x,y)|x<-[1..9],y<-[1..9],let z=(10*x+y)^2,x<y,let a=z `div` 100,let b=z `mod` 100 `div` 10, let c=z `mod` 10,100*c+10*b+a==(10*y+x)^2]

[(x,y)|x<-[0..9],y<-[0..9],x<y,let z=(10*x+y)^2,let a=z `div` 100, let a1=a `div`10,let a2=a `mod` 10,
let b=z `mod` 100 `div` 10, let c=z `mod` 10,1000*c+100*b+a2*10+a1==(10*y+x)^2]
0528卵の名無しさん
垢版 |
2018/12/17(月) 14:43:19.14ID:qP6ufigZ
>>526
数値計算とか統計処理の必要な問題すらも作れないのは統計数理の素養がない馬鹿だからだろ。

臨床医ならこれくらいの計算ができる教養がほしいね。できなきゃド底辺シリツ医並の頭脳。


インフルエンザの迅速キットは特異度は高いが感度は検査時期によって左右される。
ある診断キットが開発されたとする。
このキットは特異度は99%と良好であったが、
感度については確かな情報がない。
事前確率分布として一様分布を仮定する。
50人を無作為抽出してこの診断キットで診断したところ40人が陽性であった。
この母集団の有病率の期待値と95%CIはいくらか?
またこの診断キットの感度の期待値と95%CIはいくらか
0531卵の名無しさん
垢版 |
2018/12/17(月) 20:34:35.71ID:qP6ufigZ
source('tools.R')
ab=Mv2ab(0.70,0.01)
pbeta(0.80,ab[1],ab[2])-pbeta(0.60,ab[1],ab[2])
pbeta(0.90,ab[1],ab[2])-pbeta(0.50,ab[1],ab[2])
x=rbeta(1e5,ab[1],ab[2])
o=x/(1-x)
TP=0.80
FN=1-TP
TN=0.99
(nLR=FN/TN)
po=o*nLR^2
pp=po/(1+po)
BEST::plotPost(pp,compVal=0.10)
0532卵の名無しさん
垢版 |
2018/12/17(月) 20:34:41.41ID:qP6ufigZ
source('tools.R')
ab=Mv2ab(0.70,0.01)
pbeta(0.80,ab[1],ab[2])-pbeta(0.60,ab[1],ab[2])
pbeta(0.90,ab[1],ab[2])-pbeta(0.50,ab[1],ab[2])
x=rbeta(1e5,ab[1],ab[2])
o=x/(1-x)
TP=0.80
FN=1-TP
TN=0.99
(nLR=FN/TN)
po=o*nLR^2
pp=po/(1+po)
BEST::plotPost(pp,compVal=0.10)
0533卵の名無しさん
垢版 |
2018/12/17(月) 20:36:09.78ID:qP6ufigZ
インフルエンザ迅速検査キットの感度が80%、偽陽性率1%とする。

臨床的にはインフルエンザを疑うが迅速検査陰性、

不要な薬は使いたくない、と患者の要望。

検査が早期すぎるための偽陰性かと考えて翌日再検したが、こちらも陰性。

「私がインフルエンザである可能性はどれくらいありますか?
可能性が10%以上なら仕事を休んで抗ウイルス薬希望します。」

という。

臨床所見から疑われる有病率が70%程度(最頻値70%標準偏差10%)としたときにこの患者が仕事を休むことになる確率はいくらか?
0534卵の名無しさん
垢版 |
2018/12/18(火) 08:26:52.13ID:3rdYoIBg
バグに気づくのに時間がかかった、数学板に上げる前に気づいてよかった。

PQR = function(b,s){ # OQ=b ∠POQ=s
r=sin(s)/(cos(s)-1/2)
a=atan(sqrt(1^2+b^2-2*1*b*cos(s))/r) # <- WRONG!!
(s-sin(s))/2+r^2*(a-sin(a))/2+(1-b)*sin(s)/2
# (pi/2-s)/2 + b*sin(s)/2 - r^2*(a/2-sin(a)/2)
}
bb=seq(0,1,len=101)
ss=seq(0,pi/2,len=101)
z=outer(bb,ss,PQR)
image(bb,ss,z,xlab='b(OQ)',ylab='s(rad)')
contour(bb,ss,z,bty='l',nlevels=20,add=T, lty=3)
contour(bb,ss,z,levels=pi/8,lwd=2, add=T)
Persp3d(bb,ss,z)
b2s <- function(b){
uniroot(function(x) PQR(b,x)-pi/8, c(0,pi/2))$root
}
b2s=Vectorize(b2s)

L = function(b){ # 2b + 4ra
s=b2s(b)
r=sin(s)/(cos(s)-1/2)
a=atan(sqrt(1^2+b^2-2*1*b*cos(s))/r)
2*b + 4*r*a
}
L=Vectorize(L)
curve(L(x),0,pi/6,bty='l')
L(0)
0536卵の名無しさん
垢版 |
2018/12/18(火) 15:48:23.96ID:3rdYoIBg
暇つぶしにサムスカの太鼓持ち講演を聞いた。

相関係数を算出に全例調査しているのにp値を出していて

統計処理を理解していないアホだとわかったのが面白かった。
0537卵の名無しさん
垢版 |
2018/12/18(火) 15:50:29.76ID:3rdYoIBg
>>536
まあ、聞いているやつが(ド底辺シリツ医大卒のようなアホが多数で)p<0.001とか出せばエビデンスレベルが高いと誤解するだろうとわかっての所作なら策士だとは思うが。
0538卵の名無しさん
垢版 |
2018/12/18(火) 15:55:06.24ID:3rdYoIBg
こんなのがあんのね

電解質Na,K専用測定器 Fingraph

俺は夜間休日は血ガス測定で代用してたけど。
0539卵の名無しさん
垢版 |
2018/12/18(火) 21:56:13.92ID:RRjIHldX
3S Policy Causes the ResultTruman of Panama document and 3S policy

We are keeping the citizens in a cage named "Freedom of Falsehood".
The way you just give them some luxury and convenience.Then release sports, screen, sex (3S).
Because the citizens are our livestock. For that reason, we must make it longevity. It makes it sick
(with chemicals etc.) and keeps it alive.This will keep us harvesting. This is also the authority
of the victorious country.The medal and the Nobel prize is not all Raoul declarationExamples of 3S policy
Hypocrites and disguised society and Panama document "He moved here here two years ago, I was afraid
of looking, but I thought it was a polite person to greet" Hello "when I saw it ... It was not like I was waking
this kind of incident ... ... "(Neighboring residents)On November 7, Shosuke Hotta, 42, a self-proclaimed office
worker in Sagamihara City, Kanagawa Prefecture, was arrested on suspicion of abusing her daughter Sakurai Ai.
This is the nature of the Earthlings
0541卵の名無しさん
垢版 |
2018/12/19(水) 04:45:37.72ID:CUSSzVDj
>>540
相関係数を算出に全例調査しているのにp値を出だすのが
何でアホと言われるかわかる?
0542卵の名無しさん
垢版 |
2018/12/19(水) 13:50:09.99ID:CUSSzVDj
>>541
わからないからp値だしているのか
わからない>540のような馬鹿につけこんでいるのか、
どっちだろうな。

サイコロが2回続けて1の目出ました。

その確率は1/6*1/6=0.02777で0.05未満だから
サイコロは有意差をもって歪(いびつ)である、
即ち、1の目のでる確率=1/6という帰無仮説は棄却される
というのは正しいか?

これに即答できんアホはこのスレに書く基礎学力なし。
0543卵の名無しさん
垢版 |
2018/12/19(水) 16:34:10.87ID:3mCL+IGn
さて問題です

ガチユリとガチムチの違いを原稿用紙30枚以上で述べよ
0544卵の名無しさん
垢版 |
2018/12/19(水) 16:43:43.16ID:CUSSzVDj
>>543
>>540
相関係数を算出に全例調査しているのにp値を出だすのが
何でアホと言われるかわかる?

サイコロが2回続けて1の目出ました。

その確率は1/6*1/6=0.02777で0.05未満だから
サイコロは有意差をもって歪(いびつ)である、
即ち、1の目のでる確率=1/6という帰無仮説は棄却される
というのは正しいか?

オマエ、これに即答できんアホだろ。
0545卵の名無しさん
垢版 |
2018/12/19(水) 18:33:47.66ID:3mCL+IGn
問題に即答できんとは
さてはニートだな
0546卵の名無しさん
垢版 |
2018/12/19(水) 19:18:36.88ID:CUSSzVDj
>>545
統計スレで統計問題を書けないとはド底辺シリツ頭脳だな。
0547卵の名無しさん
垢版 |
2018/12/19(水) 20:12:36.56ID:3mCL+IGn
開業医でないのに開業スレに書きこむ
非医師のニート脳が何か言ってるなW
0549卵の名無しさん
垢版 |
2018/12/19(水) 21:13:24.16ID:CUSSzVDj
>>547

サイコロが2回続けて1の目が出ました。

その確率は1/6*1/6=0.02777で0.05未満だから
サイコロは有意差をもって歪(いびつ)である、
即ち、1の目のでる確率=1/6という帰無仮説は棄却される
というのは正しいか?

オマエ、これに即答できんアホだろ。
0550卵の名無しさん
垢版 |
2018/12/19(水) 21:24:51.44ID:CUSSzVDj
>>547

ニート脳の学力すらないどアホがオマエな。

オマエ、これに即答できんアホだろ。

統計スレなんだから

これに答えてみ!はよ!はよ!

サイコロが2回続けて1の目が出ました。

その確率は1/6*1/6=0.02777で0.05未満だから
サイコロは有意差をもって歪(いびつ)である、
即ち、1の目のでる確率=1/6という帰無仮説は棄却される
というのは正しいか?
0552卵の名無しさん
垢版 |
2018/12/19(水) 21:28:31.22ID:CUSSzVDj
>>551

スルーできないアホがオマエじゃん。

これに即答できんアホだろ。

統計スレなんだから

これに答えてみ!はよ!はよ!

サイコロが2回続けて1の目が出ました。

その確率は1/6*1/6=0.02777で0.05未満だから
サイコロは有意差をもって歪(いびつ)である、
即ち、1の目のでる確率=1/6という帰無仮説は棄却される
というのは正しいか?
0553卵の名無しさん
垢版 |
2018/12/19(水) 21:49:54.61ID:CUSSzVDj
>>551
https://egg.2ch.net/test/read.cgi/hosp/1542639046/76-83
までの議論(>77が俺)は
非医者ニートとの会話だと思う?
相当頭が悪そうだな。

これに即答できんアホだろ。統計スレなんだから
これに答えてみ!はよ!はよ!

サイコロが2回続けて1の目が出ました。
その確率は1/6*1/6=0.02777で0.05未満だから
サイコロは有意差をもって歪(いびつ)である、
即ち、1の目のでる確率=1/6という帰無仮説は棄却される
というのは正しいか?
0555卵の名無しさん
垢版 |
2018/12/20(木) 04:19:04.11ID:b33W7V5i
>>554
https://egg.2ch.net/test/read.cgi/hosp/1542639046/76-83
の議論(>77が俺)は
非医者ニートとの会話だと思う?
相当頭が悪そうだな。

これに即答できんアホだろ。統計スレなんだから
これに答えてみ!はよ!はよ!

サイコロが2回続けて1の目が出ました。
その確率は1/6*1/6=0.02777で0.05未満だから
サイコロは有意差をもって歪(いびつ)である、
即ち、1の目のでる確率=1/6という帰無仮説は棄却される
というのは正しいか?
0556卵の名無しさん
垢版 |
2018/12/20(木) 08:39:31.68ID:YfbLPysN
>>547
開業医スレに
こういうのを書いたら礼を言われましたよ。
https://egg.2ch.net/test/read.cgi/hosp/1542639046/93

非医師ニートに教えてもらって例を言ってるのも非医師ニートなのか。二人から褒めるレスが返って来たんだが。


統計スレなんだから!これに答えてみ!はよ!はよ!

サイコロが2回続けて1の目が出ました。

その確率は1/6*1/6=0.02777で0.05未満だから
サイコロは有意差をもって歪(いびつ)である、
即ち、1の目のでる確率=1/6という帰無仮説は棄却される
というのは正しいか?
0558卵の名無しさん
垢版 |
2018/12/20(木) 20:49:22.03ID:s4OL7Lza
>>557
https://egg.2ch.net/test/read.cgi/hosp/1542639046/76-83
の議論(>77が俺)は
非医者ニートとの会話だと思う?
相当頭が悪そうだな。

これに即答できんアホだろ。統計スレなんだから
これに答えてみ!はよ!はよ!

サイコロが2回続けて1の目が出ました。
その確率は1/6*1/6=0.02777で0.05未満だから
サイコロは有意差をもって歪(いびつ)である、
即ち、1の目のでる確率=1/6という帰無仮説は棄却される
というのは正しいか?
0559卵の名無しさん
垢版 |
2018/12/20(木) 22:04:13.70ID:aEbz7irJ
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.
0560卵の名無しさん
垢版 |
2018/12/21(金) 07:36:37.26ID:RO6zf9jd
リンゲル液を凍らせた。
室温に放置して固相と液相が共存している時の液相の浸透圧は
元のリンゲル液より高いか低いかを即答できないのが
ド底辺シリツ医な、オマエも即答できんのじゃね。
ある学会でリンゲル液と同じと答えたアホがいたな。
0561卵の名無しさん
垢版 |
2018/12/21(金) 08:36:03.18ID:9yiQ3K91
>>559
ド底辺シリツ医にもわかるように原文をつけておけよ。

>>
私は昭和の時代に大学受験したけど、昔は今よりも差別感が凄く、特殊民のための特殊学校というイメージで開業医のバカ息子以外は誰も受験しようとすらしなかった。
常識的に考えて、数千万という法外な金を払って、しかも同業者からも患者からもバカだの裏口だのと散々罵られるのをわかって好き好んでド底辺医に行く同級生は一人もいませんでした。
本人には面と向かっては言わないけれど、俺くらいの年代の人間は、おそらくは8−9割はド底辺医卒を今でも「何偉そうなこと抜かしてるんだ、この裏口バカが」と心の底で軽蔑し、嘲笑しているよ。
当の本人には面と向かっては絶対にそんなことは言わないけどね。
<<
0562卵の名無しさん
垢版 |
2018/12/21(金) 12:14:03.53ID:oQHNIYqE
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.
0563卵の名無しさん
垢版 |
2018/12/21(金) 17:03:49.74ID:JdSFbP47
 「イグっ&#9829; イグううぅーー&#9829; 鋼太郎、池袋にイっちゃうのおおぉぉ!」
0564卵の名無しさん
垢版 |
2018/12/21(金) 19:52:00.45ID:b22UegL5
age
0566卵の名無しさん
垢版 |
2018/12/23(日) 12:00:45.56ID:9jfRvGpH
f=c(179,28,19,13,9,7,6,5,5,4,4,4,5,7,9,10,11,12,14,16,18,19,19,20,21,22,23,24,25,27,28,30,
31,34,37,39,41,43,46,51,57,63,70,77,83,91,99,109,119,130,142,155,167,178,190,202,216,
233,249,265,282,302,326,354,387,420,457,502,549,598,648,700,761,836,927,1026,1142,1284,
1455,1651,1862,2089,2341,2625,2934,3264,3598,3923,4233,4508,4740,4893,4973,5007,4999,
4729,4314,3797,3222,2634,2071,1566,1135,788,523,761)
m=c(191,31,21,13,10,8,8,8,7,7,7,8,9,11,14,17,21,26,32,37,42,46,49,50,50,50,49,49,50,52,55,
58,60,63,65,67,71,76,82,89,97,104,112,122,134,148,165,183,203,224,246,268,294,324,357,
391,425,461,502,549,601,659,722,792,872,958,1052,1147,1239,1331,1433,1546,1663,1783,
1905,2026,2167,2333,2532,2750,2973,3195,3414,3630,3827,4000,4133,4200,4194,4104,3916,
3681,3388,3046,2669,2272,1875,1494,1145,841,589,392,246,144,79,71)

LE <-function(ndx,Y,N0=10^5){ # life expectancy
n=length(ndx)
lx=numeric(n)
lx[1]=N0
for(i in 1:(n-1))
lx[i+1] <- lx[i] - ndx[i]
nqx=ndx/lx
nLx=numeric(n)
for(i in 1:n)
nLx[i] <- mean(c(lx[i],lx[i+1]))
nLx[n]=0
Tx=rev(cumsum(rev(nLx)))
le=Tx/lx
return(round(le[Y+1],1))
}
0567卵の名無しさん
垢版 |
2018/12/23(日) 12:02:35.17ID:9jfRvGpH
Y=1:105
sapply(Y,function(x) LE(f,x))
sapply(Y,function(x) LE(m,x))
Y[sapply(Y,function(x) LE(m,x))<5]
sapply(Y,function(x) LE(f,x))
sapply(Y,function(x) LE(m,x))

Y=1:105
Y[sapply(Y,function(x) LE(f,x))<5]
Y[sapply(Y,function(x) LE(m,x))<5]
0571卵の名無しさん
垢版 |
2018/12/24(月) 20:36:41.73ID:6ZVUEdxI
他スレで喚いて荒らしていても
算数クイズくんが
底辺から抜け出すことは
困難を極めます
0573卵の名無しさん
垢版 |
2018/12/24(月) 22:21:17.70ID:lZLAiNKc
>>571
これ理科のクイズ。

リンゲル液を凍らせた。
室温に放置して固相と液相が共存している時の液相の浸透圧は
元のリンゲル液より高いか低いかを即答できないのが
ド底辺シリツ医な、オマエも即答できんのじゃね。

ある学会でリンゲル液と同じと答えたアホがいたな。
0574卵の名無しさん
垢版 |
2018/12/25(火) 09:25:20.23ID:Lx1BgrzL
平均余命の信頼区間を計算しようと思ったが
各年齢での人口データがないと無理だな。
0575卵の名無しさん
垢版 |
2018/12/26(水) 00:18:55.39ID:rHMA/ZVK
さて国語の問題です

信じて送り出したフタナリ事務員が農家の叔父さんの・・・・・

続きを原稿用紙30枚以上で作成せよ
0576卵の名無しさん
垢版 |
2018/12/26(水) 20:53:45.05ID:0RdixcRl
clinical sense の症例が配信されてきた。
Devic病と思ったら経過中にレルミット兆候が出てMSに診断変更。
インターフェロンβ→ナタリズマブの前にステロイドパルスがないのが解せなかったな。
0577卵の名無しさん
垢版 |
2018/12/26(水) 23:30:42.66ID:wApOj4Hd
ところでMS法人って
みんな作ってる?
0578卵の名無しさん
垢版 |
2018/12/27(木) 14:17:15.36ID:7ElT0ESI
Welch.test=function(n1,n2,m1,m2,sd1,sd2){
T=(m1-m2)/sqrt(sd1^2/n1+sd2^2/n2)
df=(sd1^2/n1+sd2^2/n2)^2 / (sd1^4/n1^2/(n1-1)+sd2^4/n2^2/(n2-1))
p.value=2*pt(abs(T),df,lower.tail = FALSE)
return(c(p.value=p.value,t.statistic=T))
}

# white zoneの視認性と腺管密度の関係
# white zoneが鮮明な癌 窩間部の長さ136±45 (p<0.05)
# white zoneが不鮮明な癌 窩間部の長さ77±22 (p<0.05)

m1=136
sd1=45
m2=77
sd2=22

n2p <- function(n){
Welch.test(n,n,m1,sd1,m2,sd2)[1]
}
n2p=Vectorize(n2p)
plot(2:15,sapply(2:15,n2p),bty='l',pch=19)
abline(h=0.05)
0579卵の名無しさん
垢版 |
2018/12/27(木) 14:47:38.86ID:7ElT0ESI
# se=sd/√n , sd=se*√n
n2p_se <- function(n){
sd1=sd1*sqrt(n)
sd2=sd2*sqrt(n)
Welch.test(n,n,m1,sd1,m2,sd2)[1]
}
n2p_se=Vectorize(n2p_se)
n2p_se(5)
plot(n,sapply(n,n2p_se),bty='l',pch=19,ylim=c(0,1))
abline(h=c(0.01,0.05),col=8)
n2p_se(18:22)
0580卵の名無しさん
垢版 |
2018/12/27(木) 15:17:44.83ID:7ElT0ESI
# sim
# white zoneが鮮明な癌 窩間部の長さ136±45 (p<0.05)
# white zoneが不鮮明な癌 窩間部の長さ77±22 (p<0.05)
n=7
y1=scale(rnorm(n))*45 + 136
y2=scale(rnorm(n))*22 + 77
library(BEST)
BESTout=BESTmcmc(y1,y2)
# Look at the result:
BESTout
summary(BESTout)
plot(BESTout)
plot(BESTout, "sd")
plotPostPred(BESTout)
plotAll(BESTout, credMass=0.8, ROPEm=c(-0.1,0.1),
ROPEeff=c(-0.2,0.2), compValm=0.5)
plotAll(BESTout, credMass=0.8, ROPEm=c(-0.1,0.1),
ROPEeff=c(-0.2,0.2), compValm=0.5, showCurve=TRUE)
summary(BESTout, credMass=0.8, ROPEm=c(-0.1,0.1), ROPEsd=c(-0.15,0.15),
ROPEeff=c(-0.2,0.2))
pairs(BESTout)
0581卵の名無しさん
垢版 |
2018/12/27(木) 15:20:39.76ID:7ElT0ESI
white zoneの視認性と腺窩の深さの関係

white zoneが鮮明な癌 腺窩の深さ 180±47 (p<0.001)
white zoneが不鮮明な癌 腺窩の深さ 81±20 (p<0.001)
0582卵の名無しさん
垢版 |
2018/12/27(木) 15:25:25.68ID:7ElT0ESI
>>581
m1=180
sd1=47
m2=81
sd2=20

n2p <- function(n){
Welch.test(n,n,m1,sd1,m2,sd2)[1]
}
n2p=Vectorize(n2p)
n=2:10
plot(n,sapply(n,n2p),bty='l',pch=19)
abline(h=c(0.001,0.01),col=8)
n2p(5:10)
0583卵の名無しさん
垢版 |
2018/12/27(木) 15:30:09.78ID:7ElT0ESI
m1=180
sd1=47
m2=81
sd2=20

n2p <- function(n){
Welch.test(n,n,m1,sd1,m2,sd2)[1]
}
n2p=Vectorize(n2p)
n=2:10


# se=sd/√n , sd=se*√n
n2p_se <- function(n){
sd1=sd1*sqrt(n)
sd2=sd2*sqrt(n)
Welch.test(n,n,m1,sd1,m2,sd2)[1]
}
n2p_se=Vectorize(n2p_se)
n=25:35
plot(n,sapply(n,n2p_se),bty='l',pch=19,ylim=c(0,0.05))
abline(h=c(0.001,0.01),col=8)
n2p_se(27:32)
0584卵の名無しさん
垢版 |
2018/12/27(木) 15:30:31.81ID:7ElT0ESI
サンプルサイズが推定できて、気分が( ・∀・)イイ!!
0587卵の名無しさん
垢版 |
2018/12/28(金) 00:56:18.13ID:Oc+hTpm3
日本にも、
ついに朝鮮殺戮殺人カルト宗教
殺人学会の、

テロ工作拠点が明らかになった!

テロ工作拠点
福山友愛病院

なんと日本警察に朝鮮殺戮殺人学会が侵入し、
カルトによる被害者側を警察が拉致して連れていくテロ工作拠点の一角!!

警察と完全犯罪達成の為に、共同組織犯罪をやっていて、

与えられていたのは、
犯罪ライセンス!!!!!!


薬物大量投与テロ発生!!
なんと故意に八倍!!!

カミサカというテロ医師による、
偽造カルテ作成発覚!!
なんとその為に監禁罪をやっていた!!!
0588卵の名無しさん
垢版 |
2018/12/28(金) 13:38:51.13ID:4e3e1x1A
直線解ならプログラム組めそうだけど答が円弧を含むなら
俺の能力では無理だな。
こういう問題を解ける頭脳には平伏するだけだな。


5等分の場合はこんな形が解になるそうです
https://imgur.com/xnH6eHf.jpg

正三角形5等分問題だと解が完全に非対称的な形になって面白い
https://imgur.com/rw7yGNl.jpg
0589卵の名無しさん
垢版 |
2018/12/28(金) 15:09:23.16ID:4e3e1x1A
自分がどれだけ馬鹿なのか自覚できていいな。
三角形なら直線で左右対象だろうとアプリオリに決めつけてプログラムしちゃうよなぁ。
0590卵の名無しさん
垢版 |
2018/12/28(金) 15:10:49.35ID:4e3e1x1A
理系で一番馬鹿なのが医学部を実感するなぁ。
0591卵の名無しさん
垢版 |
2018/12/29(土) 12:03:59.78ID:8oggYPKD
分岐角度が120°、対象図形と分割線のなす角が90°という
いわゆるplatoの法則で立式しないとコンピュータ解も難しそう。
0593卵の名無しさん
垢版 |
2018/12/30(日) 15:37:28.61ID:NpJOUauM
明日は内覧会ですW
0594卵の名無しさん
垢版 |
2018/12/31(月) 21:09:11.51ID:2cJ2vbGs
開業するのかw大晦日にw
0595卵の名無しさん
垢版 |
2018/12/31(月) 23:39:12.39ID:anCmupmN
数学板の統計スレにこんな課題があったのでシミュレーション解を投稿しておいた。


例えば、母集団から50枚の答案用紙を選んで、平均が
60点だとする。母集団は2500枚の答案用紙から成り立っているとして、平均は70点とする。このとき50枚の答案用紙をランダムに選んだかの検定はどの

ようにすればいいでしょうか。(つまり60点の平均点が低いので、ランダムに選んだかどうかを疑っているわけです。)
0596卵の名無しさん
垢版 |
2019/01/01(火) 10:02:25.14ID:fQ4brTV9
甲乙二人がおのおの32ピストル(当時のお金の単位)の金を賭けて勝負したとする。
 そしてどちらかが先に3点を得たものを勝ちとし、勝った方がかけ金の総額64ピストルをもら
 えるとする。ところが甲が2点、乙が1点を得たとき、勝負が中止になってしまった。
 このとき、二人のかけ金の総額64ピストルを甲と乙にどのように分配すればよいだろうか。
 ただし二人の力は互角で、勝つ確率はそれぞれ1/2ずつだとする。

プログラムで計算させてみる
n=0:1
x=expand.grid(n,n,n,n,n)
y=x[apply(x[,1:3],1,sum)==2,]
64*sum(apply(y,1,sum)>2)/nrow(y)
0597卵の名無しさん
垢版 |
2019/01/01(火) 21:19:05.09ID:nLWjX1/M
インフルエンザ脳症成人例は死亡率が高い

https://www.niid.go.jp/niid/images/iasr/36/429/graph/dt42951.gif


p0_4=c(14,202)
p5_19=c(20,408)
p20_59=c(7,72)
p60_=c(10,66)

p.mat=as.matrix(rbind(p0_4,p5_19,p20_59,p60_))
chisq.test(p.mat)
pairwise.prop.test(p.mat,p.adjust='holm')
fmsb::pairwise.fisher.test(p.mat)

p.mat

prop.test(c(34,17),c(610,138))
Fisher.test(c(34,17),c(610,138)
0598卵の名無しさん
垢版 |
2019/01/03(木) 18:09:59.16ID:6cY0SNEs
## m sd n
A=c(159.0625,sqrt(3924.729167),16)
B=c(240,sqrt(22027.5),17)
C=c(366.35,sqrt(5329.292105),20)

lh=rbind(A,B,C)
colnames(lh)=c("m","sd","n") ; lh
mean.G=sum(lh[,"m"]*lh[,"n"])/sum(lh[,"n"])
SS.bit=sum((lh[,"m"]-mean.G)^2*lh[,"n"])
SS.wit=sum(lh[,"sd"]^2*(lh[,"n"]-1))
df.bit=nrow(lh)-1
df.wit=sum(lh[,"n"]-1)
MS.bit=SS.bit/df.bit
MS.wit=SS.wit/df.wit
(F.ratio=MS.bit/MS.wit)
pf(F.ratio,df.bit,df.wit,lower.tail=FALSE)
(η2=(SS.bit)/(SS.bit+SS.wit))

A=c(159.0625,sqrt(3924.729167),16)
B=c(240,sqrt(22027.5),17)
C=c(366.35,sqrt(5329.292105),20)
a=A[1]+scale(rnorm(A[3]))*A[2]
b=B[1]+scale(rnorm(B[3]))*B[2]
c=C[1]+scale(rnorm(C[3]))*C[2]
x=c(a,b,c)
g=c(rep('A',A[3]),rep('B',B[3]),rep('C',C[3]))
g=factor(g,labels=LETTERS[1:3])
pairwise.t.test(x,g,p.adjust='holm')
0600卵の名無しさん
垢版 |
2019/01/03(木) 22:28:02.75ID:pv3ynAMm
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.
0601卵の名無しさん
垢版 |
2019/01/04(金) 19:52:06.17ID:G2Rj2t04
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.
0602卵の名無しさん
垢版 |
2019/01/05(土) 00:22:46.55ID:X56IPw/0
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.
0603卵の名無しさん
垢版 |
2019/01/05(土) 13:06:20.59ID:1KoYjjkI
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.
0604卵の名無しさん
垢版 |
2019/01/05(土) 17:38:24.01ID:+iYQLowq
ド底辺シリツ医にもわかるように原文をつけておけよ。

>>
私は昭和の時代に大学受験したけど、昔は今よりも差別感が凄く、特殊民のための特殊学校というイメージで開業医のバカ息子以外は誰も受験しようとすらしなかった。
常識的に考えて、数千万という法外な金を払って、しかも同業者からも患者からもバカだの裏口だのと散々罵られるのをわかって好き好んでド底辺医に行く同級生は一人もいませんでした。
本人には面と向かっては言わないけれど、俺くらいの年代の人間は、おそらくは8−9割はド底辺医卒を今でも「何偉そうなこと抜かしてるんだ、この裏口バカが」と心の底で軽蔑し、嘲笑しているよ。
当の本人には面と向かっては絶対にそんなことは言わないけどね。
<<>>603
0605卵の名無しさん
垢版 |
2019/01/05(土) 19:11:13.14ID:71bgktVe
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.
0606卵の名無しさん
垢版 |
2019/01/06(日) 08:58:44.31ID:g7qyfOQm
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.
0607卵の名無しさん
垢版 |
2019/01/06(日) 14:48:30.19ID:SEvsBMAu
Zが標準正規分布に従う時、次の値を求めよ。
1:P{Z>u1}=0.05を満たすu1の値 → u1=1.645
2:P{Z<u2}=0.005を満たすu2の値 → u2=-2.576
3:P{-u3<Z<u3}=0.99を満たすu3の値 → u3=2.576

(u1=qnorm(0.05,lower.tail = FALSE))
(u2=qnorm(0.005,lower.tail= TRUE))
(u3=qnorm((1-0.99)/2,lower.tail=FALSE))
par(mfrow=c(3,1))
curve(dnorm(x),-4,4,bty='l')
curve(dnorm(x),u1,4,type='h',add=T,col=2)
curve(dnorm(x),-4,4,bty='l')
curve(dnorm(x),-4,u2,type='h',add=T,col=3)
curve(dnorm(x),-4,4,bty='l')
curve(dnorm(x),-u3,u3,type='h',add=T,col=4)

Xが正規分布N(10, 5^2)に従う時、次の確率を求めよ。
1:P{X>20} → 0.0228
2:P{X<5} → 0.1587
3:P{0<X<20} → 0.9544


1-pnorm(20,10,5)
pnorm(5,10,5)
pnorm(20,10,5)-pnorm(0,10,5)
0608卵の名無しさん
垢版 |
2019/01/06(日) 14:48:45.04ID:SEvsBMAu
>>606

ド底辺シリツ医にもわかるように原文をつけておけよ。

>>
私は昭和の時代に大学受験したけど、昔は今よりも差別感が凄く、特殊民のための特殊学校というイメージで開業医のバカ息子以外は誰も受験しようとすらしなかった。
常識的に考えて、数千万という法外な金を払って、しかも同業者からも患者からもバカだの裏口だのと散々罵られるのをわかって好き好んでド底辺医に行く同級生は一人もいませんでした。
本人には面と向かっては言わないけれど、俺くらいの年代の人間は、おそらくは8−9割はド底辺医卒を今でも「何偉そうなこと抜かしてるんだ、この裏口バカが」と心の底で軽蔑し、嘲笑しているよ。
当の本人には面と向かっては絶対にそんなことは言わないけどね。
0609卵の名無しさん
垢版 |
2019/01/06(日) 23:10:04.43ID:PSVRj6pz
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.
0610卵の名無しさん
垢版 |
2019/01/07(月) 15:11:59.69ID:9K2vk7ik
なんだか疲れた
働きたくない
0612卵の名無しさん
垢版 |
2019/01/07(月) 18:20:24.95ID:ubVk9gDC
戸田A哲君もアメリカで経済学助狂をやっているらしい。
バブル崩壊で安定を求めて理3に入ってしまったらしい。
無駄に齢とっちまったな。
0613卵の名無しさん
垢版 |
2019/01/07(月) 20:32:18.68ID:31hT7o17
>>610
正月休みで1週間ぶりに内視鏡したが違和感があるなぁ。
平日は週3やってる。
0615卵の名無しさん
垢版 |
2019/01/07(月) 21:09:46.14ID:9K2vk7ik
なんだかだるい
あたりが暗く見える
笑い声を聞くとムカつく
疲れた
働きたくない
0616卵の名無しさん
垢版 |
2019/01/07(月) 21:22:19.83ID:/APKkASA
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.
0618卵の名無しさん
垢版 |
2019/01/07(月) 23:44:52.48ID:fKvhbwc+
窓の外で誰かが見ている
0619卵の名無しさん
垢版 |
2019/01/08(火) 11:14:42.05ID:Fx7hufSt
お天道様がみている、というのが日本人の道徳。
移民法でお先真っ暗。
0620卵の名無しさん
垢版 |
2019/01/08(火) 12:13:16.36ID:C0NmoK5j
電波が、電波の声が聞こえる
0621卵の名無しさん
垢版 |
2019/01/08(火) 12:44:58.49ID:o3Ur7/E6
>>620
便利でいいな。
オービスも聞こえればスピード違反で捕まることもないよな。
0622卵の名無しさん
垢版 |
2019/01/08(火) 13:32:28.48ID:o3Ur7/E6
rm(list=ls())

x="1-a,2-b"
y=strsplit(x,",")
z=unlist(y)
w=NULL
for(i in 1:length(z)){
w=rbind(w,unlist(strsplit(z[i],"-")))
}
data.frame(NUM=as.numeric(w[,1]),TEXT=w[,2])
0623卵の名無しさん
垢版 |
2019/01/08(火) 14:03:34.54ID:j1+ZKzaK
ダルい
疲れた
働いたら負け
0624卵の名無しさん
垢版 |
2019/01/08(火) 14:31:07.32ID:o3Ur7/E6
>>623
正月休みで1週間内視鏡から離れたら却って体調が悪いなぁ。

金のために不愉快な仕事をしないというのが最大幸福だな。

おかげで自宅で安眠できる。
0625卵の名無しさん
垢版 |
2019/01/08(火) 17:02:04.26ID:C0NmoK5j
>>624
これ即答してみ!

できなきゃ、ド底辺学力と認定してあげよう。

フタナリとガチユリの相関性について
原稿用紙30枚以上で考察せよ
0626卵の名無しさん
垢版 |
2019/01/08(火) 17:30:33.63ID:5YyNsaaz
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.
0627卵の名無しさん
垢版 |
2019/01/08(火) 20:39:41.24ID:j/PKfHLe
>>625
原稿用紙30枚以上と書くあたり
部屋割カウントできない馬鹿とすぐ分かるぞ
0628卵の名無しさん
垢版 |
2019/01/08(火) 20:48:31.02ID:j/PKfHLe
こういう問題の方が楽しいね!

12345→51234のように、十進表記の末尾一桁を先頭にもってくる操作を考える。
ただし末尾は0ではないとし、全桁が同じ数字からなる数も考えないものとする。
ある数Mをこの操作でLへと置き換えた。
MがLで割り切れるMのうち、桁数が最も小さいものを全て求めよ。
0629卵の名無しさん
垢版 |
2019/01/08(火) 21:50:24.74ID:xj6Kc+5j
>>628
ナゾナゾは出せど
他人からの問題には全く回答不能なんだね

中卒ニートのコンビニバイトくん
0631卵の名無しさん
垢版 |
2019/01/08(火) 22:00:36.94ID:j/PKfHLe
>>629
では模範解答をお願いしますね。
原稿用紙30枚以上必要らしいけど。
はよ、はよ!
0632卵の名無しさん
垢版 |
2019/01/08(火) 22:00:48.42ID:xj6Kc+5j
>>630
これ即答してみ!

できなきゃ、ド底辺学力と認定してあげよう。

医師板で算数クイズ出して荒らしまわってて、
いい年してそんなものが何故必要かと聞かれ、
ガソリンスタンドで客からの注文に応えるため必要だ、と答えたド底辺学力のニートくんは、
なぜコンビニバイトに転職したのでしょう?
0633卵の名無しさん
垢版 |
2019/01/08(火) 22:14:44.26ID:j/PKfHLe
>>632
俺にはコンビニバイトは無理だな。
内視鏡や麻酔の方がずっと楽。
0634卵の名無しさん
垢版 |
2019/01/08(火) 22:16:41.70ID:j/PKfHLe
>>632
算数クイズができると論文の検証ができるわけね。

内視鏡の洗浄待機時間に 胃と腸 の所見用語集2017を読んでいたらこんな記載があった。(602頁Fig4の説明)

white zoneの視認性と腺管密度の関係
white zoneが鮮明な癌 窩間部の長さ136±45 (p<0.05)
white zoneが不鮮明な癌 窩間部の長さ77±22 (p<0.05)

サンプルサイズが記載なしでp<0.05としか書いてない。
p<0.01ならそう記載するだろうから、0.01<p<0.05なのだろう。
±のあとの数字は標準偏差なのか標準誤差なのか判然としない。
検定はt検定(等分散を前提とはできないのでWelch法を使用したとする)で
サンプルサイズは等しいとして±の後の数字は標準偏差あるとすると

> n2p(5:9)
p.value p.value p.value p.value p.value
0.055446074 0.032947710 0.019850610 0.012077956 0.007403284

サンプルサイズは僅か6〜8と推定される。
0635卵の名無しさん
垢版 |
2019/01/08(火) 22:20:06.62ID:j/PKfHLe
これ答えられるかい?
コンビニバイト以下の教養ならまあ無理だな。

>643の±の後の数字は標準誤差とすると
サンプルサイズはいくつと推定できるか?
0637卵の名無しさん
垢版 |
2019/01/08(火) 22:33:11.95ID:xj6Kc+5j
>>636
それそれ
医師はそんなレスしないだろ
0638卵の名無しさん
垢版 |
2019/01/08(火) 22:34:22.63ID:j/PKfHLe
>>636
そういう計算もできない馬鹿がこういう事故を起こすわけなんだな。
http://i.imgur.com/ArPaux9.png

統計スレなんだから>635にでも答えてみ!
できなきゃガソリンスタンドのバイト以下の頭脳な。
0639卵の名無しさん
垢版 |
2019/01/08(火) 22:36:19.30ID:j/PKfHLe
>>637
ガソリンスタンドのレスは理解できたらしいが
>634のレスは理解できんだろ?ド底辺頭脳クン。
0640卵の名無しさん
垢版 |
2019/01/08(火) 23:00:15.32ID:C0NmoK5j
>>638
>統計スレなんだから

開業医でもないのに開業医スレに書き込むコンビニバイトくんに
特大ブーメランW
0643卵の名無しさん
垢版 |
2019/01/09(水) 08:32:19.46ID:e7U7282c
>>641
コンビニバイトくんのレスは
何の釈明にもなっていない

>632への回答 はよはよ
0644卵の名無しさん
垢版 |
2019/01/09(水) 09:31:40.92ID:q6OvMTx7
>>643
礼を言われるような投稿がだよ〜ん。
あんたのは馬鹿を晒しているだけ。
ガソリンスタンドのレスは理解できたらしいが
>634のレスは理解できんだろ?ド底辺頭脳クン。
0645卵の名無しさん
垢版 |
2019/01/09(水) 13:44:05.50ID:e7U7282c
>>644
ところでコンビニバイトくん
非医師のアラシという自覚ある?

ガソリンスタンドのレスで理解できるのは
オマエがガソリンスタンドで給油の仕事をしているということのみだな
0647卵の名無しさん
垢版 |
2019/01/09(水) 14:25:57.19ID:7x5Uv3Et
>>645
標準誤差のときのサンプルサイズの計算まだぁ?
ひょっとして、標準誤差が何かも知らない馬鹿ぁ?
0648卵の名無しさん
垢版 |
2019/01/09(水) 14:28:10.74ID:7x5Uv3Et
>>645
んで、あんたド底辺シリツ医大卒?
頭脳レベルはド底辺みたいだけど。
0649卵の名無しさん
垢版 |
2019/01/09(水) 14:52:34.20ID:7x5Uv3Et
http://fpr-calc.ucl.ac.uk/
の比率版を非心Χ二乗分布のRスクリプトをメールしたら返事が来たけどunderlining mathの議論が進まなかったな。
Intuitivel Biostatisticsの著者は即効で対応してErrataの追加と次版の修正の返事が来た。
0650卵の名無しさん
垢版 |
2019/01/09(水) 16:26:11.62ID:q6OvMTx7
>>645
どアホにもわかる計算の例示として税込みガソリン価格を上げただけということすらわからんらしいな。
こういう問題に算数が必要と書いてもオマエの頭じゃ正解だせないだろ?

診療所から病院に患者を救急搬送する。
病院から医師搭乗の救急車が診療所に向かっており10時到着予定と連絡が入った。
患者の病態が悪化したら、診療所の普通車で病院に向かい救急車と出会ったら
救急車に患者を移して搬送し病院到着を急ぐという計画を立てた。
普通車から救急車への患者の乗り換えで10分余分に時間がかかる。
道路事情から救急車は病院から診療所への道は
平均時速60kmで、逆方向は平均時速45kmで定速走行する。診療所の普通車は信号待ちもあり平均時速30kmで定速走行する。

何時以降の病態悪化は診療所の車を使わずに救急車の到着を待つ方が病院に早く着くか?
0651卵の名無しさん
垢版 |
2019/01/09(水) 16:42:16.13ID:PAq6vTKi
>>650
非正規雇用のオッさんの言い訳キモス
反面教師にしかならんわね

もうすぐ冬休みも終わって
再来年は高校受験だわ〜
0653卵の名無しさん
垢版 |
2019/01/09(水) 19:44:34.23ID:e7U7282c
中学生にすらバカにされるコンビニバイトくんW
0655卵の名無しさん
垢版 |
2019/01/10(木) 14:25:28.63ID:9bNrFpHw
>>653
>>645
どアホにもわかる計算の例示として税込みガソリン価格を上げただけということすらわからんらしいな。
こういう問題に算数が必要と書いてもオマエの頭じゃ正解だせないだろ?

診療所から病院に患者を救急搬送する。
病院から医師搭乗の救急車が診療所に向かっており10時到着予定と連絡が入った。
患者の病態が悪化したら、診療所の普通車で病院に向かい救急車と出会ったら
救急車に患者を移して搬送し病院到着を急ぐという計画を立てた。
普通車から救急車への患者の乗り換えで10分余分に時間がかかる。
道路事情から救急車は病院から診療所への道は
平均時速60kmで、逆方向は平均時速45kmで定速走行する。診療所の普通車は信号待ちもあり平均時速30kmで定速走行する。

何時以降の病態悪化は診療所の車を使わずに救急車の到着を待つ方が病院に早く着くか?
0658卵の名無しさん
垢版 |
2019/01/10(木) 19:43:55.09ID:xCiYE3NF
>>654〜657
これ即答してみ!

できなきゃ、ド底辺学力と認定してあげよう。

医師板で算数クイズ出して荒らしまわってて、
いい年してそんなものが何故必要かと聞かれ、
ガソリンスタンドで客からの注文に応えるため必要だ、と答えたド底辺学力のニートくんは、
なぜコンビニバイトに転職したのでしょう?


>>654
送り仮名がオカシイところをみると
日本の方ですらないのですかね
0660卵の名無しさん
垢版 |
2019/01/11(金) 07:03:12.10ID:eIjYcl4Y
>>659
非正規雇用のオッさんの言い訳キモス
反面教師にしかならんわね

もうすぐ冬休みも終わって
再来年は高校受験だわ〜
0661卵の名無しさん
垢版 |
2019/01/11(金) 07:05:30.85ID:SA5KNNkQ
>>645
どアホにもわかる計算の例示として税込みガソリン価格を上げただけということすらわからんらしいな。
こういう問題に算数が必要と書いてもオマエの頭じゃ正解だせないだろ?

診療所から病院に患者を救急搬送する。
病院から医師搭乗の救急車が診療所に向かっており10時到着予定と連絡が入った。
患者の病態が悪化したら、診療所の普通車で病院に向かい救急車と出会ったら
救急車に患者を移して搬送し病院到着を急ぐという計画を立てた。
普通車から救急車への患者の乗り換えで10分余分に時間がかかる。
道路事情から救急車は病院から診療所への道は
平均時速60kmで、逆方向は平均時速45kmで定速走行する。診療所の普通車は信号待ちもあり平均時速30kmで定速走行する。

何時以降の病態悪化は診療所の車を使わずに救急車の到着を待つ方が病院に早く着くか?
0662卵の名無しさん
垢版 |
2019/01/11(金) 08:08:05.29ID:wEewwlyz
>>661
>税込みガソリン価格を上げただけ ?W

違うよねぇ

http://egg.5ch.net/test/read.cgi/hosp/1527071455/62-63
>税込みで5000円分給油してと言われて対応できないと仕事にならんだろ?

巧妙な話のすり替えワロス

医師は給油の仕事はしないよね
コンビニバイトくん
0663卵の名無しさん
垢版 |
2019/01/11(金) 08:59:52.18ID:SA5KNNkQ
>>645
どアホにもわかる計算の例示として税込みガソリン価格を上げただけということすらわからんらしいな。
こういう問題に算数が必要と書いてもオマエの頭じゃ正解だせないだろ?

診療所から病院に患者を救急搬送する。
病院から医師搭乗の救急車が診療所に向かっており10時到着予定と連絡が入った。
患者の病態が悪化したら、診療所の普通車で病院に向かい救急車と出会ったら
救急車に患者を移して搬送し病院到着を急ぐという計画を立てた。
普通車から救急車への患者の乗り換えで10分余分に時間がかかる。
道路事情から救急車は病院から診療所への道は
平均時速60kmで、逆方向は平均時速45kmで定速走行する。診療所の普通車は信号待ちもあり平均時速30kmで定速走行する。

何時以降の病態悪化は診療所の車を使わずに救急車の到着を待つ方が病院に早く着くか?
0666卵の名無しさん
垢版 |
2019/01/11(金) 12:10:41.16ID:2Jz2b/ri
いい年してバイトのオッさん
おおキモイキモイ
0667卵の名無しさん
垢版 |
2019/01/11(金) 13:28:05.64ID:wEewwlyz
>>663-665
>税込みガソリン価格を上げただけ ?W

違うよねぇ

http://egg.5ch.net/test/read.cgi/hosp/1527071455/62-63
>税込みで5000円分給油してと言われて対応できないと仕事にならんだろ?

稚拙な話のすり替えワロス

医師は給油の仕事はしないよね
コンビニバイトくん

スレを辿ると
受験は遥か昔の医師の人生にとって一次方程式が何の役に立つのか? 
というレスにオマエが
給油の仕事で対応できない
と答えたんだよね

普通に見れば、ナリスマシ非医師のボロが出た、としか考えられんよねW
0668卵の名無しさん
垢版 |
2019/01/11(金) 13:49:59.59ID:SA5KNNkQ
>>667
一次方程式は役に立つよ。
これも二次方程式は必要ないぞ。
答えてみ!

>>645
どアホにもわかる計算の例示として税込みガソリン価格を上げただけということすらわからんらしいな。
こういう問題に算数が必要と書いてもオマエの頭じゃ正解だせないだろ?

診療所から病院に患者を救急搬送する。
病院から医師搭乗の救急車が診療所に向かっており10時到着予定と連絡が入った。
患者の病態が悪化したら、診療所の普通車で病院に向かい救急車と出会ったら
救急車に患者を移して搬送し病院到着を急ぐという計画を立てた。
普通車から救急車への患者の乗り換えで10分余分に時間がかかる。
道路事情から救急車は病院から診療所への道は
平均時速60kmで、逆方向は平均時速45kmで定速走行する。診療所の普通車は信号待ちもあり平均時速30kmで定速走行する。

何時以降の病態悪化は診療所の車を使わずに救急車の到着を待つ方が病院に早く着くか?
0670卵の名無しさん
垢版 |
2019/01/11(金) 14:41:37.54ID:wEewwlyz
>668
>税込みガソリン価格を上げただけ ?W

違うよねぇ

http://egg.5ch.net/test/read.cgi/hosp/1527071455/62-63
>税込みで5000円分給油してと言われて対応できないと仕事にならんだろ?

稚拙な話のすり替えワロス

医師は給油の仕事はしないよね
コンビニバイトくん

スレを辿ると
受験は遥か昔の医師の今後の人生にとって算数が何の役に立つのか? 
というレスにオマエが
給油の仕事で対応できない
と答えたんだよね

普通に見れば、ナリスマシ非医師のボロが出た、としか考えられんよねW
0671卵の名無しさん
垢版 |
2019/01/11(金) 15:58:22.65ID:JAXb750V
# calculate point FPR by David Colquhoun
calc.FPR = function(pval=0.0475,nsamp=16,prior=0.5,sigma=1,delta1=1){
sdiff=sqrt(sigma^2/nsamp + sigma^2/nsamp)
df=2*(nsamp-1)
# Note FPR doesn't need calculation of power for p-equals case #
# under H0, use central t distribution
tcrit=-qt(pval/2,df,ncp=0)
x0=tcrit
y0=dt(x0,df,0)

#
# under H1 use non-central t distribution
ncp1=delta1/sdiff #non-centrality paramater
curve(dt(x,df),-3-ncp1,3+ncp1, ann=FALSE,bty='n')
curve(dt(x,df,ncp1),add=TRUE,lty=2)
abline(v=x0,lty=3)
x1=x0 #tcrit
y1=dt(x1,df,ncp=ncp1)
#
# Calc false positive rate
p0=2*y0 # p.value : two-sided verified with simulation
p1=y1
LRH1=p1/p0
FPR=((1-prior)*p0)/(((1-prior)*p0) + prior*p1)
FPR
output=c(FPR,LRH1)
return(FPR)
}
# end of function calc.FPR
calc.FPR()
0673卵の名無しさん
垢版 |
2019/01/11(金) 16:08:40.06ID:JAXb750V
内視鏡の洗浄待機時間に 胃と腸 の所見用語集2017を読んでいたらこんな記載があった。(602頁Fig4の説明)
white zoneの視認性と腺管密度の関係
white zoneが鮮明な癌 窩間部の長さ136±45 (p<0.05)
white zoneが不鮮明な癌 窩間部の長さ77±22 (p<0.05)

サンプルサイズが記載なしでp<0.05としか書いてない。p<0.01ならそう記載するだろうから、0.01<p<0.05なのだろう。
±のあとの数字は標準偏差なのか標準誤差なのか判然としない。
検定はt検定(等分散を前提とはできないのでWelch法を使用したとする)で
サンプルサイズは等しいとして±の後の数字は標準偏差あるとすると
> n2p(5:9)
p.value p.value p.value p.value p.value
0.055446074 0.032947710 0.019850610 0.012077956 0.007403284
サンプルサイズは僅か6〜8と推定される。

n=7
p.value=0.019850610

としてFalse Positive Riskを計算してみる(非心t分布でのコードは既出)

# calculate point FPR by David Colquhoun
を実行してみる。
> calc.FPR(0.01985,nsamp=7)
[1] 0.1245345
Web caluculator
http://fpr-calc.ucl.ac.uk/
の結果と一致して、気分が( ・∀・)イイ!!
0674卵の名無しさん
垢版 |
2019/01/11(金) 16:23:30.11ID:JAXb750V
Colquhounの方法って
尤度比を確率密度比で算出してんだよなあ
reverse Bayesとか呼んでるけど。

式で書けばこうなるはず、
# FPR=1/(1+L10*PH1/(1-PH1)) where L10 likelihood ratio = P(Data|H1)/P(Data|H0) ,PH1: prior of H1

4.
The point null
Some people don’t like the assumption of a point null that’s made in this
proposed
approach to calculating the false positive risk
, but it seems natural to users who wish
to know how likely their observations would be if there were really no effect (i.e. if the
point null were true). It’s often claimed that the null is never exactly true. This isn’t
necessarily so (just giv
e identical treatments to both groups). But more importantly, it
doesn’t matter. We aren’t saying that the effect size is exactly zero: that would
obviously be impossible. We are looking at the likelihood ratio, i.e. at the probability
of the data if the t
rue effect size were not zero relative to the probability of the data if
the effect size were zero. If the latter probability is bigger than the former then
clearly we can’t be sure that there is anything but chance at work. This does
not
mean that we ar
e saying that the effect size is exactly zero. From the point of view
of the experimenter, testing the point null makes total sense. In any case, it makes
little difference if the null hypothesis is a narrow band centred on zero
(Berger and Delampady 1987)
.
0675卵の名無しさん
垢版 |
2019/01/11(金) 16:26:49.23ID:JAXb750V
>>674
ここにレクチャーが
https://www.youtube.com/watch?v=iFaIpe9rFR0
あるんだけど、
非心t分布にはなんにも言及がないんだよなぁ。

非心分布の解説本ってこれを凌駕するのはないな。

サンプルサイズの決め方 (統計ライブラリー)

GPowerとかのソフト使ってクリック猿になるのは楽しくない。
0676卵の名無しさん
垢版 |
2019/01/11(金) 16:35:41.41ID:JAXb750V
比率のFalse Positive Risk算出のスクリプトを書いてみた。

calc.FPR.prop <- function(r1,r2,n1,n2,alpha=0.05,Print=TRUE,Show.chi=TRUE){
p.val=prop.test(c(r1,r2),c(n1,n2))$p.value
k=length(c(r1,r2)) # 2
df=k-1 # 1
p1=r1/n1 ; p2=r2/n2
PO=c(p1,p2) # proporition observed
# approximation with arcsine -- deprecated
# theta.i=asin(sqrt(PO)) # arcsine conversion
# delta=4*var(theta.i)*(k-1) # sum of squares
PE=(r1+r2)/(n1+n2) # PE: proportion expected
delta=sum((PO-PE)^2/PE)
N=2/(1/n1+1/n2) # harmonic mean to fit when n1 is not equal to n2
ncp1=N*delta # non-central parameter
power.chi=pchisq(qchisq(1-alpha,df),df,ncp1,lower=FALSE)
q.alpha=qchisq(1-alpha,df) # 3.841 when alpha=0.05
qcrit=qchisq(max(p.val,1-p.val),df,ncp=0) # qcrit = prop.test(c(r1,r2),c(n1,n2))$statistic
y0=dchisq(qcrit,df,0)
y1=dchisq(qcrit,df,ncp=ncp1)
FPR.equal=y0/(y0+y1) # length ratio = likelyhood ratio
if(Print){
curve(dchisq(x,df),0.5,3*qcrit,ylim=c(0,0.3),xlab=expression(paste(chi,'2')),ylab='density',bty='n',lwd=2,type='n') # H0
curve(dchisq(x,df,ncp1),qcrit,3*qcrit,col='lightgreen',type='h',add=TRUE,lwd=2)
curve(dchisq(x,df),qcrit,3*qcrit,col='orange',type='h',add=TRUE)
curve(dchisq(x,df),lwd=2,add=TRUE) # H0
curve(dchisq(x,df,ncp1),add=TRUE,lty=2,lwd=2) # H1
abline(v=qcrit)
abline(v=q.alpha,col='gray',lty=3)
0677卵の名無しさん
垢版 |
2019/01/11(金) 16:36:13.06ID:JAXb750V
legend('topright',bty='n',
legend=c('H0','H1',expression(paste(chi,'2:p.value')),expression(paste(chi,'2:alpha'))),
col=c('orange','lightgreen',1,'gray'),lty=c(1,2,1,3),lwd=c(2,2,1,1))
text(qcrit,y0,'y0',cex=0.75)
text(qcrit,y1,'y1',cex=0.75)
if(Show.chi){
text(qcrit,0,round(qcrit,2),cex=0.75)
text(q.alpha,0.30,round(q.alpha,2),cex=0.75)
}
}
ES=pwr::ES.h(r1/n1,r2/n2)
my.power=pwr::pwr.2p2n.test(ES,n1,n2,sig.level=p.val)$power
FPR.less=p.val/(p.val+my.power) # area ratio for 'less than' FDR
FPR.alpha=alpha/(alpha+power.chi) # FPR at alpha
output=c(power=power.chi,p.value=p.val,FPR.equal=FPR.equal,LH10=y1/y0,
FPR.less=FPR.less,FPR.alpha=FPR.alpha)
return(output)
}
##
calc.FPR0.p2 <- function(r1,r2,n1,n2,prior=0.5,alpha=0.05){
pval=prop.test(c(r1,r2),c(n1,n2))$p.value
ES=pwr::ES.h(r1/n1,r2/n2)
my.power=pwr::pwr.2p2n.test(ES,n1,n2,sig.level=pval)$power
power=pwr::pwr.2p2n.test(ES,n1,n2,sig.level=alpha)$power
LH10=my.power/pval # NOTE: sig.level=pval, not 0.05
FPR=pval*(1-prior)/(pval*(1-prior)+my.power*prior)
output=c(my.power=my.power,power=power,p.value=pval,FPR.less=FPR,LH10=LH10)
return(output)
}
0680卵の名無しさん
垢版 |
2019/01/11(金) 19:59:26.63ID:JAXb750V
calc.FPR = function(nsamp,pval,sigma,prior,delta1){
# sdiff=sqrt(sigma^2/nsamp + sigma^2/nsamp)
ns1=nsamp
ns2=nsamp
# CALC sdiff = sd of difference between means
sdiff=sqrt(sigma^2/ns1 + sigma^2/ns2)
df=ns1+ns2-2
# Note FPR doesn't need calculation of power for p-equals case
#
#under H0, use central t distribution
tcrit=qt((1-pval/2),df,ncp=0)
x0=tcrit
y0=dt(x0,df,0)
#
# under H1 use non-central t distribution
ncp1=delta1/sdiff #non-centrality paramater
x1=x0 #tcrit
y1=dt(x1,df,ncp=ncp1)
# check solution
# pcheck=pt(y1,df,ncp=ncp1)
# pcheck

# Calc false positive risk
p0=2*y0
p1=y1
FPR=((1-prior)*p0)/(((1-prior)*p0) + prior*p1)
cat('FPR = ',FPR,'\n')
output=c(FPR,x0,y0,x1,y1)
invisible(output)
}
# end of function calc.FPR
#
0681卵の名無しさん
垢版 |
2019/01/11(金) 19:59:55.21ID:JAXb750V
# calc.FPR0 gives FPR for given nsamp, for p-less-than case
calc.FPR0 = function(nsamp,pval,sigma,prior,delta1){
myp=power.t.test(n=nsamp,sd=sigma,delta=delta1,sig.level=pval,type="two.sample",alternative="two.sided",power=NULL)
power = myp$power
PH1=prior
PH0=1-PH1
FPR0=(pval*PH0/(pval*PH0 + PH1*power))
output=c(FPR_less=FPR0,power=power)
return(output)
}
#
calc.FPR(nsamp=7,pval=0.01985,sigma=1,prior=0.5,delta1=1)
calc.FPR0(nsamp=7,pval=0.01985,sigma=1,prior=0.5,delta1=1)

> calc.FPR(nsamp=7,pval=0.01985,sigma=1,prior=0.5,delta1=1)
FPR = 0.1245345
> calc.FPR0(nsamp=7,pval=0.01985,sigma=1,prior=0.5,delta1=1)
FPR_less power
0.07274575 0.25301819
>
0682卵の名無しさん
垢版 |
2019/01/11(金) 20:22:21.59ID:JAXb750V
>>680
そのシミュレーション

# t.test simulation when 0.045< p.value < 0.05
N=1000
n=10
x0=rnorm(N)
x1=rexp(N)

f<-function(prior=0.5){
choice=sample(1:0,1,prob=c(prior,1-prior))
x=sample(x0,n)
if(choice){
y=sample(x1,n) # choose different mean population
}else{
y=sample(x0,n) # choose the same population
}
c(t.test(x,y)$p.value,choice)
}
re=replicate(1e4,f(0.5))
res=re[2,re[1,]<0.045 & re[1,]<=0.050]
mean(res==0) # proportion of the same population = FPR
0683卵の名無しさん
垢版 |
2019/01/14(月) 21:11:37.39ID:W3rmWG0w
疲れた
ダルい
働いたら負け
0684卵の名無しさん
垢版 |
2019/01/14(月) 21:59:39.64ID:lm1UHN1Y
働きたくない
0685卵の名無しさん
垢版 |
2019/01/15(火) 11:09:44.07ID:dvPyxe58
待機で賃金が発生する職場が( ・∀・)イイ!!
0686卵の名無しさん
垢版 |
2019/01/15(火) 13:02:35.43ID:9BKWXGSR
>>685
職場に出勤しなくちゃいけない時点で負け組
0688卵の名無しさん
垢版 |
2019/01/16(水) 08:14:37.24ID:gq6jTqnA
>>687
焼肉屋のオーナーなんぞ
従業員を働かせて
毎日ゴルフ三昧だぞ
0690卵の名無しさん
垢版 |
2019/01/17(木) 13:00:45.59ID:jUkqCyOy
>>689
ゴルフは単なる症例報告だ
俺もゴルフは全くやらん

調剤薬局もそうだ
医師は自分で働かないと無収入になるのに対して
薬局オーナーは出勤せずに毎日遊び歩いていても
病院オーナーよりはるかに高い収入を得ている
しかも薬局オーナーは薬剤師である必要すらない
0691卵の名無しさん
垢版 |
2019/01/17(木) 14:01:12.40ID:qxQFIIFv
>>690
オーナー理事長で役員報酬の不労所得の医師もいるぞ。
0692卵の名無しさん
垢版 |
2019/01/17(木) 15:18:23.26ID:qxQFIIFv
治療薬ハンドブックを読んで該当箇所のポケット医薬品集を読むと
同効薬の違いが分かって(・∀・)イイ!!
防腐剤を含まない点眼抗菌薬はどれかとか実に役立つ。
0693卵の名無しさん
垢版 |
2019/01/17(木) 19:35:01.75ID:jUkqCyOy
>>691
そいつは働いたことが無いのかい?
でなきゃ妬ましくないな

俺の同級生の土建屋やパチンコ屋の子弟はひどいぞ
最終学歴が高卒だけど
就業経験ゼロで役員になって一生豪遊してるからな
0694卵の名無しさん
垢版 |
2019/01/19(土) 10:34:13.59ID:8uFRJt6f
>>693
パチンコ屋や土建屋の子弟ってシリツ医大に多いよな。
0695卵の名無しさん
垢版 |
2019/01/19(土) 14:00:04.35ID:+22CUuCd
>>694
知り合いの話かい?

他大学のことは知らんが
俺の出身の国立医学部にも土建屋の娘は居た

それはそうとニュースでミッキーハウス事件を見たことがあるかい?
あのニュースを見て理解できるのは
土建屋は病院なんぞ比べ物にならんくらい稼いでいるという事実だ

まあいずれにしても言えることは
働いたら負け
ということだ
0697卵の名無しさん
垢版 |
2019/01/19(土) 14:28:40.93ID:+Z1Yrlmo
>>696
納税したら負け、という価値観の椰子は多いだろうなぁ。
0698卵の名無しさん
垢版 |
2019/01/19(土) 15:20:32.33ID:tosZV9uO
働いたら負けだお
お家でカウチポテトしてコーラ飲んで
動画見てるのが最高だお
0699卵の名無しさん
垢版 |
2019/01/19(土) 16:57:43.58ID:8uFRJt6f
>>698
いや、学会出張に愛人を連れて行く方が楽しいんだが。
0700卵の名無しさん
垢版 |
2019/01/19(土) 17:22:09.90ID:HPdDoYmX
>>699
学会のついでになど下らん

平日の昼間に遊び歩いてこそ勝ち組だ
0702卵の名無しさん
垢版 |
2019/01/19(土) 20:05:18.74ID:nd1Bx6ok
https://virtualsan-looking.jp/staff/

三権分立が存在しない権力のゴキブリ自民レイプ山口敬之安倍官製ドワンゴとゴキブリ共は庵のは原爆で細胞ごと死滅しろw
0703卵の名無しさん
垢版 |
2019/01/19(土) 21:15:57.55ID:m2smxm4o
疲れた
ダルい
働きたくない
0704卵の名無しさん
垢版 |
2019/01/19(土) 22:13:35.46ID:+Z1Yrlmo
curve(dnorm(x,50,10),0,100,bty='l')
curve(dnorm(x,50,10),q60,100,type='h',col='yellow',add=T)
curve(dnorm(x,50,10),q30,100,type='h',col='green',add=T,lty=3)

segments(q60,0,q60,dnorm(q60,50,10),lty=3)

pnorm(c(65,68,69),50,10,lower=F)
(q30=qnorm(1-0.3,50,10))
(q60=qnorm(1-0.6,50,10))
integrate(function(x) x*dnorm(x,50,10)/0.3,q30,Inf)$value - integrate(function(x) x*dnorm(x,50,10)/0.6,q60,Inf)$value

library(BEST)

sim <- function(){
N=1e4
x=scale(rnorm(N/0.3))*10+50
x30=x[x>=q30]
x=scale(rnorm(N/0.6))*10+50
x60=x[x>=q60]
d=x30-x60
mean(d)
}
re=replicate(1e3,sim())
summary(re)
0705卵の名無しさん
垢版 |
2019/01/19(土) 22:32:24.95ID:m2smxm4o
働いたら負け
0706卵の名無しさん
垢版 |
2019/01/19(土) 22:49:34.18ID:NSnAx4LQ
>>700
盆や年末に俗世を離れてコミケに行く
アタイは勝ち組
0707卵の名無しさん
垢版 |
2019/01/20(日) 08:22:51.49ID:cvbKrpB0
f <- function(p,sd=10){
m=sample(100,1)
ma=integrate(function(x)x*dnorm(x,m,sd)/(1-p),-Inf,qnorm(1-p,m,sd))$value
m-ma
}
f=Vectorize(f)
pp=seq(0.001,0.999,0.001)
plot(pp,f(pp),bty='l',type='l',xlab='辞退率',ylab='虚飾値',lwd=2)
0708卵の名無しさん
垢版 |
2019/01/20(日) 08:42:33.97ID:cvbKrpB0
'(1)予備校の発表する偏差値は合格者の偏差値の平均値
(2)合格者の成績分布は正規分布で標準偏差は母集団と同じ
(3)成績のよい方から入学を辞退する

虚飾値=合格者の偏差値 - 入学者の偏差値
'
f <- function(p,sd=10){
m=sample(100,1)
ma=integrate(function(x)x*dnorm(x,m,sd)/(1-p),-Inf,qnorm(1-p,m,sd))$value
m-ma
}
f=Vectorize(f)
pp=seq(0.001,0.999,0.001)
plot(pp,f(pp),bty='l',type='l',xlab='辞退率',ylab='虚飾値',lwd=2)

p=seq(0.1,0.9,0.1)
data.frame(辞退率=p,虚飾値=round(f(p),1))
0710卵の名無しさん
垢版 |
2019/01/20(日) 18:02:46.35ID:4pPRgzzq
明日は月曜
暗い日曜日
0712卵の名無しさん
垢版 |
2019/01/20(日) 18:32:59.56ID:vchoPnFo
>>709
以下の(1)(2)(3)を前提にして計算

(1)予備校の発表する偏差値は合格者の偏差値の平均値
(2)合格者の成績分布は正規分布で標準偏差は母集団と同じ
(3)成績のよい方から入学を辞退する

虚飾値=合格者の偏差値 - 入学者の偏差値

と定義して、辞退率と虚飾値の関係をグラフにすると


http://i.imgur.com/7WQQPKu.png


辞退率 虚飾値
0.1 1.9
0.2 3.5
0.3 5.0
0.4 6.4
0.5 8.0
0.6 9.7
0.7 11.6
0.8 14.0
0.9 17.5
0713卵の名無しさん
垢版 |
2019/01/20(日) 19:47:26.59ID:4pPRgzzq
負〜け負け負け負け〜負け〜
働いたら〜負け〜負け〜
働い〜たら〜負〜け〜な〜の〜ら〜♪
0715卵の名無しさん
垢版 |
2019/01/21(月) 07:02:55.12ID:zCz5KSqt
ダルい
疲れた
働いたら負け
0716卵の名無しさん
垢版 |
2019/01/21(月) 11:08:16.93ID:Ed3wv7za
国試諦めてくれてありがとう。
0717卵の名無しさん
垢版 |
2019/01/21(月) 13:41:29.97ID:ulNFNnBT
先週は祝日だったので今日は内視鏡予約が多くて
この時間にステーキハウス。

眠剤のんでる老人はsedationの効きが悪いぜい。
0718卵の名無しさん
垢版 |
2019/01/21(月) 14:28:43.64ID:ulNFNnBT
>>709
この証明は難しいな。
数値積分での実感は簡単(ド底辺シリツ医を除く)だけどね。
0719卵の名無しさん
垢版 |
2019/01/21(月) 14:33:18.08ID:ulNFNnBT
オセロやルービックをプログラムで解く秀才は尊敬するな。
医学部にはいない。
0720卵の名無しさん
垢版 |
2019/01/21(月) 14:57:25.09ID:Ed3wv7za
良かったなー本当にありがとうございます。医者にならないで。良かったなー。
0721卵の名無しさん
垢版 |
2019/01/21(月) 15:04:18.32ID:Ed3wv7za
ありがとうございます。患者さんや医療従事者にとっては医者を諦めていただいて良かったです。
0723卵の名無しさん
垢版 |
2019/01/21(月) 15:12:33.23ID:Ed3wv7za
問題のある人物を医療の世界に入れることぐらい怖いものはないです。本当にありがとうございます。
0724卵の名無しさん
垢版 |
2019/01/21(月) 15:40:19.56ID:Ed3wv7za
医師の道を諦められたことに 同意いたします。その判断は正しいです。
0725卵の名無しさん
垢版 |
2019/01/21(月) 15:49:54.66ID:Ed3wv7za
ホッと一息 大学 厚生労働省。良かったね。
0726卵の名無しさん
垢版 |
2019/01/21(月) 15:58:20.70ID:xX0sMtrn
カネが欲しいから医学部にいくんや
文句あっか
0727卵の名無しさん
垢版 |
2019/01/21(月) 16:06:43.94ID:Ed3wv7za
危な過ぎて 許容できない。by 大学 厚生労働省
0728卵の名無しさん
垢版 |
2019/01/21(月) 16:34:11.82ID:5GFeLbpQ
東京医大が本来合格者に追加合格させても

本来不合格者を除籍処分しないのだから

シリツ=裏口容疑者が確定だよ。

シリツ出身者こそ、裏口入学に厳しい処分せよを訴えるべき。

裏口入学医師の免許剥奪を!の国民運動の先頭に立てばよいぞ。

僕も裏口入学とか、言ってたら信頼の回復はない。
0729卵の名無しさん
垢版 |
2019/01/21(月) 16:37:46.83ID:5GFeLbpQ
>>709
証明は複雑な定積分が必要だな。
俺には無理なので数値積分で確認。
中心極限定理もそうだな。
0731卵の名無しさん
垢版 |
2019/01/21(月) 18:54:15.63ID:guiK2BJ8
>>730
仕事は何をしてるのかね?

いまどき正規職員でないものは完全に負け組だぞ

ゆっくり霊夢はFランク大学の就職課に就職したようです【第16話】
https://www.youtube.com/watch?v=SmTtzGIIjN8
0732卵の名無しさん
垢版 |
2019/01/21(月) 19:06:50.31ID:5GFeLbpQ
>>729
これを一般式でするのは大変だろうな。

f(x) = 1/{σ√2π)} exp[-(x-m)^2/ 2σ^2],

下位30% ・・・・ 偏差値(m-0.5244σ)以下

f(x)

ma = ∫[-∞, m-0.5244σ] x・f(x) dx } / ∫[-∞, m-0.5244σ] f(x) dx{
 = m + ∫[-∞, m-0.5244σ] (x-m) f(x) dx / 0.3
 = m + (σ/√2π)∫[-∞, -0.5244] t・exp(-tt/2) dt / 0.3
 = m + (σ/√2π) [ -exp(-tt/2) ](t=-∞, -0.5244) / 0.3
 = m + (σ/√2π) [ -0.8715 / 0.3 ]
 = m - 1.159σ
 = m - 11.59
0734卵の名無しさん
垢版 |
2019/01/21(月) 23:54:21.71ID:zCz5KSqt
タバコって燃えるゴミかな?
有害物質を発生するからプラゴミと同じかな?
灰皿は不燃ゴミ
電子タバコは家電ゴミでいいのかな?
0736卵の名無しさん
垢版 |
2019/01/22(火) 17:20:22.09ID:XyJ4p7WH
f <-function(a){
qa=qnorm(a,50,10,lower=F)
ma=integrate(function(x) x*dnorm(x,50,10)/a,qa,Inf)$value
va=integrate(function(x) (x-ma)^2*dnorm(x,50,10)/a,qa,Inf)$value
c(mean=ma,sd=sqrt(va))
}
m1=f(0.27)[1]
s1=f(0.27)[2]
m2=f(0.50)[1]
s2=f(0.50)[2]

g <- function(x){
y= (x-50)/s1*10+m1
50+(y-m2)/s2*10
}
x=40:70
g(x)
0737卵の名無しさん
垢版 |
2019/01/22(火) 17:40:34.59ID:XyJ4p7WH
f <-function(a){
qa=qnorm(a,50,10,lower=F)
ma=integrate(function(x) x*dnorm(x,50,10)/a,qa,Inf)$value
va=integrate(function(x) (x-ma)^2*dnorm(x,50,10)/a,qa,Inf)$value
c(mean=ma,sd=sqrt(va))
}
m1=f(0.27)[1]
s1=f(0.27)[2]
m2=f(0.50)[1]
s2=f(0.50)[2]

g <- function(x){
y= (x-50)/s1*10+m1
50+(y-m2)/s2*10
}

g(c(50,55,57.5))

母集団(例えば18歳人口)の成績が平均値50点標準偏差10点の正規分布に従うとする。

上位27%が進学すると
平均値62.2点標準偏差5.01点の集団Aとなる。
(成績が62.2点なら偏差値50に67.21点なら偏差値60になる)

上位50 %が進学すると
平均値58.0標準偏差6.03の集団Bとなる。

集団Aでの偏差値50, 55, 57.5は各々
集団Bでは偏差値57.0, 73.0, 81.9になる。
0738卵の名無しさん
垢版 |
2019/01/22(火) 18:22:22.34ID:XyJ4p7WH
>>737
バグ修正

f <-function(a){
qa=qnorm(a,50,10,lower=F)
ma=integrate(function(x) x*dnorm(x,50,10)/a,qa,Inf)$value
va=integrate(function(x) (x-ma)^2*dnorm(x,50,10)/a,qa,Inf)$value
c(mean=ma,sd=sqrt(va))
}
m1=f(0.27)[1]
s1=f(0.27)[2]
m2=f(0.50)[1]
s2=f(0.50)[2]

g <- function(x){
y= (x-50)/10 *s1+m1
50+(y-m2)/s2*10
}

g(c(50,55,57.5))

母集団(例えば18歳人口)の成績が平均値50点標準偏差10点の正規分布に従うとする。

上位27%が進学すると
平均値62.2点標準偏差5.01点の集団Aとなる。
(成績が62.2点なら偏差値50に67.21点なら偏差値60になる)

上位50 %が進学すると
平均値58.0標準偏差6.03の集団Bとなる。

集団Aでの偏差値50, 55, 57.5は各々
集団Bでは偏差値57.0, 61.2 63.3になる。
0739卵の名無しさん
垢版 |
2019/01/22(火) 18:32:41.55ID:XyJ4p7WH
f <-function(a){
qa=qnorm(a,50,10,lower=F)
ma=integrate(function(x) x*dnorm(x,50,10)/a,qa,Inf)$value
va=integrate(function(x) (x-ma)^2*dnorm(x,50,10)/a,qa,Inf)$value
c(mean=ma,sd=sqrt(va))
}
p1=0.27
p2=0.50
m1=f(p1)[1]
s1=f(p1)[2]
m2=f(p2)[1]
s2=f(p2)[2]

g <- function(x){
y= (x-50)/10 *s1+m1
50+(y-m2)/s2*10
}

g(c(50,55,57.5))
xx=seq(40,80,0.1)
plot(xx,g(xx))
0740卵の名無しさん
垢版 |
2019/01/22(火) 18:47:08.16ID:XyJ4p7WH
f <-function(a){
qa=qnorm(a,50,10,lower=F)
ma=integrate(function(x) x*dnorm(x,50,10)/a,qa,Inf)$value
va=integrate(function(x) (x-ma)^2*dnorm(x,50,10)/a,qa,Inf)$value
c(mean=ma,sd=sqrt(va))
}

sim <- function(x=50,p1=0.3,p2=0.5){
m1=f(p1)[1]
s1=f(p1)[2]
m2=f(p2)[1]
s2=f(p2)[2]
y= (x-50)/10 *s1+m1
50+(y-m2)/s2*10
}

sim()
0741卵の名無しさん
垢版 |
2019/01/22(火) 23:57:18.92ID:poZn4cZ2
>>740
仕事は何をしてるのかね?

いまどき正規職員でないものは完全に負け組だぞ
0743卵の名無しさん
垢版 |
2019/01/24(木) 01:16:27.12ID:sxN7Of5+
テロ工作機関
福山友愛病院

なんと朝木明代市議のような他殺だと日本人に騒がれるから
日本国警察が、
朝鮮殺戮殺人教団に乗っとられたことにより警察から与えられていたのは、


犯罪ライセンス!!!!!!


病院で医師から処方された薬は、何ら疑いを持つことなく飲む人も少なくないだろう。

医学や薬学の知識がある人や、持病で何年も投薬治療を行っている人などは、
また違った見方をしているかもしれないが、一般的に「医師からの処方薬」に対する信頼は篤い。
しかし、そんな「信頼」を揺るがすとんでもない事件が話題となっている。

■「在庫処理」で不要な治療薬を投与広島県の福山友愛病院は、昨年11〜12月の間に、
統合失調症などの患者6名に、本来必要のないパーキンソン病の治療薬を投与していたことが判明。

これは、病院を運営する医療法人会長の指示によるもので、病院側は「使用期限が迫った薬の在庫処理がきっかけのひとつ。」と説明しているとのこと。

会長は、同病院で精神科としても勤務しており、パーキンソン病の治療薬である
「レキップ」の錠剤を統合失調症患者など6人に投与するよう看護師らに指示。
投薬は複数回行われ、末丸会長は通常の


8倍の量を



指示していたという。
0744卵の名無しさん
垢版 |
2019/01/24(木) 07:39:17.09ID:YHL/Shf0
ところで、タバコって燃えるゴミですか?
有害物質を発生するのでプラゴミと同じ扱いでしょうか?
電子タバコは家電ゴミですよね

今度、小学校に教育実習に行くので
お家のタバコ用具を全てゴミに出すように指導してきます
0746卵の名無しさん
垢版 |
2019/01/24(木) 15:16:53.44ID:7fT+1bS6
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.
0747卵の名無しさん
垢版 |
2019/01/24(木) 18:59:58.86ID:oaTB7QH8
テロ工作機関が日本にあることが判明


福山友愛病院


日本人への薬物大量投与テロも発覚


また他は、
単純に、朝鮮殺戮殺人革命の為に、
日本人被害者側を、
カルト医師が医師免許を犯罪に使用し、
偽造カルテをでっち上げているにすぎない

でっち上げる理由は、カルト会社の犯罪にごねている、
だから、
警察から犯罪ライセンス与えられているので、

虚偽説明して騙して閉鎖病棟に閉じ込め、
携帯とりあげ、
監禁罪やり精神保健福祉法違反をやり偽造カルテ書きますね

それだけw

だって、警察がグルで共同組織犯罪をしているから、
犯罪を犯罪でないことにしてくれるんだもの
日本人被害者側を拉致していることがバレたしな


それをやらかしていたので、
福山友愛病院には電凸し、
インターネット上に書いていることを通告もしている

ケースワーカーのイソムラという女性曰わく、

カミサカ先生インターネットに書かれて辛いみたいで〜・・・



日本国内にいるテロリストが辛くなることは、
日本人の喜びだっつーのww
0748卵の名無しさん
垢版 |
2019/01/24(木) 20:31:49.63ID:H5DL72sh
Rnorm<-function(n,m,s){
x=rnorm(n,m,s)
m + s*(x-mean(x))/sd(x)
}

N=1e3
x=replicate(5,Rnorm(N,50,10))
f <- function(){ # simulated test results of 3 or 5 subjects
y=numeric()
for(i in 1:5) y[i]=sample(x[,i],1)
y3=sum(y[1:3])
y5=sum(y[1:5])
c(y3,y5)
}

p2h <- function(x){ # points to hensa-chi
m=mean(x)
s=sd(x)
x=50+10*(x-m)/s
}

re=replicate(1e5,f())
y3=re[1,] # points of 3 subject test
y5=re[2,]

z3=p2h(y3) # hensa-ti of 3 subject test
z5=p2h(y5)
0749卵の名無しさん
垢版 |
2019/01/24(木) 20:32:02.08ID:H5DL72sh
hc <- function(h,d=0.5){ # hensa-chi conversion
idx=which(h-d<z5 & z5<h+d) # hensa-chi range in 5 subject test
mean(z3[idx]) # mean of its hensa-chi in 3 subject
}
hc=Vectorize(hc)
hh=40:80
plot(hh,hc(hh),bty='l',asp=1,xlab='5 subject',ylab='3 subject',
pch=19)
abline(a=0,b=1,col='gray')
0753卵の名無しさん
垢版 |
2019/01/28(月) 17:29:00.31ID:AVoD+Cyq
働いたら負け
0754卵の名無しさん
垢版 |
2019/01/28(月) 21:53:43.21ID:+PCpJyrP
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.
0755卵の名無しさん
垢版 |
2019/02/09(土) 22:33:46.30ID:F1R4fVG9
f=function(p,q=0.99){
a=13*q
c=13*(1-q)
b=13000*p
d=13000*(1-p)
(a/(a+b)-c/(c+d)) / (a/(a+b))
}
p=q=seq(0.01,0.99,0.1)
z=outer(p,q,f)
contour(p,q,z)

g=Vectorize(f)
g((1:19)/20)
0756卵の名無しさん
垢版 |
2019/02/10(日) 12:37:21.35ID:9eXx3CuI
options(digits=3)
f=function(p,q=0.99){ # p:pyroli in population, q:pyroli in cancer
a=13*q
c=13*(1-q)
b=13000*p
d=13000*(1-p)
x=(a/(a+b)-c/(c+d)) / (a/(a+b)) # attributable to pyroli(+)
y=(c/(c+d)-a/(a+b)) / (c/(c+d)) # qtteibutabel to pyroli(-)
round(ifelse(x>0,x,y),3)
}

g=Vectorize(f)
g((1:19)/20)

p=seq(0.01,0.99,0.01) # pylori in population
q=seq(0.01,0.99,0.01) # pylori in cancer
z=outer(p,q,f)
image(p,q,z,bty='l',nlevels=20,xlab='pyroli in population',
ylab='pyroli in cancer')
contour(p,q,z,bty='l',nlevels=20,xlab='pyroli in population',
ylab='pyroli in cancer',add=T)

contour(p,q,z,bty='l',nlevels=20,xlab='pyroli in population',
ylab='pyroli in cancer')

source('tools.R')
Persp(p,q,z)
Persp3d(p,q,z)
0757卵の名無しさん
垢版 |
2019/02/10(日) 12:37:47.54ID:9eXx3CuI
'
がん 非がん
感染  a  b
未感染 c  d

attributable risk : x
x={a/(a+b)-c/(c+d)} / {a/(a+b)}
'
0758卵の名無しさん
垢版 |
2019/02/10(日) 19:40:18.09ID:9eXx3CuI
q1=0.9934
q2=0.9958
f <- function(p,q){
a=13*q
c=13*(1-q)
b=13000*p
d=13000*(1-p)
(a/(a+b)-c/(c+d)) / (a/(a+b))
}
x0=0.985

f1=Vectorize(function(p)f(p,q=q1))
f2=Vectorize(function(p)f(p,q=q2))
curve(f1(x))
abline(h=0.985)
uniroot(function(x)f1(x)-x0,c(0,0.9))$root
curve(f2(x))
abline(h=0.985)
uniroot(function(x)f2(x)-x0,c(0,0.9))$root
0759卵の名無しさん
垢版 |
2019/02/11(月) 12:56:16.04ID:rzg7XY57
一般論として医療統計って全然科学じゃないって、研究者の中ではバカにされてますよ。
0760卵の名無しさん
垢版 |
2019/02/11(月) 14:44:26.58ID:Pny0jm5M
統計で使われる数学って難し過ぎてついていけないよね。
AICとかわからないままにソフトで出させているだけ。
0761卵の名無しさん
垢版 |
2019/02/13(水) 12:53:38.65ID:hLnbSCPn
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.
0762卵の名無しさん
垢版 |
2019/02/16(土) 13:25:47.75ID:QaizKjLi
>>761
裏口馬鹿にもわかるように原文もつけなきゃ。


原文はこれな。

私は昭和の時代に大学受験したけど、昔は今よりも差別感が凄く、慶応以外の私立医は特殊民のための特殊学校というイメージで開業医のバカ息子以外は誰も受験しようとすらしなかった。
常識的に考えて、数千万という法外な金を払って、しかも同業者からも患者からもバカだの裏口だのと散々罵られるのをわかって好き好んで私立医に行く同級生は一人もいませんでした。
本人には面と向かっては言わないけれど、俺くらいの年代の人間は、おそらくは8−9割は私立卒を今でも「何偉そうなこと抜かしてるんだ、この裏口バカが」と心の底で軽蔑し、嘲笑しているよ。当の本人には面と向かっては絶対にそんなことは言わないけどね。
0763卵の名無しさん
垢版 |
2019/02/17(日) 22:18:47.40ID:rglxpU9N
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.
0764卵の名無しさん
垢版 |
2019/02/19(火) 19:34:53.54ID:5dzWj+iV
俺は医者ではない。
0765卵の名無しさん
垢版 |
2019/02/19(火) 22:25:59.08ID:j+jAYShv
医学統計は苦手だ
できなきゃ論文読めんけど
0766卵の名無しさん
垢版 |
2019/02/20(水) 09:47:48.92ID:P0P24ylG
>>765
>456の問題点を指摘できないなら不正統計に騙される素養があるね。
0768卵の名無しさん
垢版 |
2019/03/01(金) 20:33:40.05ID:CpB3LdCN
「もし君の妻子や友人にいつまでも生きていてもらいたいと思うならば、君は愚かである。というのは、君は、君の力の及びうる範囲内にないものまでも君の力の及びうる範囲内にあることを欲し、よそのものまでも君のものであることを欲しているからである。」
0770卵の名無しさん
垢版 |
2019/03/14(木) 16:45:10.23ID:JBQs0yPH
韓国で大麻が医療解禁した
国際条約では臨床試験や学術研究(輸出輸入など)が認められているんで一度訪ねてみては?

http://livedoor.blogimg.jp/denkyupikaso-rwceiylt/imgs/9/7/97a40f97.png
http://livedoor.blogimg.jp/denkyupikaso-rwceiylt/imgs/c/6/c6fc0285.png

韓国で使われてる大塚製薬の大麻製剤は日本の医師会員向けに和訳も開始されている。
https://news.nicovideo.jp/watch/nw4912539
0773卵の名無しさん
垢版 |
2019/03/28(木) 00:45:03.92ID:8PkLLiIS
https://www3.nhk.or.jp/news/html/20190327/k10011863181000.html

インフルエンザの新しい治療薬「ゾフルーザ」を投与されたA香港型のインフルエンザ患者30人を調べたところ、
70%余りに当たる22人から、この薬が効きにくい耐性ウイルスが検出されたことが国立感染症研究所の調査で分かりました。
調査件数は多くないものの、専門家は現在のような使用を続けると、耐性ウイルスが広がるおそれがあるとして使用基準を見直すべきだと指摘しています。

https://www3.nhk.or.jp/news/html/20190327/k10011863181000.html

問題:耐性発生率の95%信頼区間は? 👀
Rock54: Caution(BBR-MD5:1341adc37120578f18dba9451e6c8c3b)
0774卵の名無しさん
垢版 |
2019/03/28(木) 00:49:17.10ID:8PkLLiIS
95%CI 0.541 0.877なので過半数に耐性出現と言っていいな。
0775卵の名無しさん
垢版 |
2019/03/28(木) 01:30:14.34ID:uQgP69pk
耐性出現率が過半数である確率はいくらか?
0776卵の名無しさん
垢版 |
2019/06/25(火) 16:00:08.86ID:ZxTc5GC6
>>775
あんた医科歯科大卒だろ?
学部1〜2回生の時に線形代数と微分積分はやった?
0777卵の名無しさん
垢版 |
2019/06/25(火) 16:01:39.44ID:ZxTc5GC6
線形代数と微分積分を知らんと統計学の勉強は無理だね。
まあ、上を見れば切りがないけどね。
0778卵の名無しさん
垢版 |
2019/06/28(金) 10:53:20.90ID:30gP48kS
>>777
Rが使えれば統計扱えるよ。
今どき分布表で補間値計算なんてしないし。
非心t分布もRが出してくれる。


https://www3.nhk.or.jp/news/html/20190327/k10011863181000.html

インフルエンザの新しい治療薬「ゾフルーザ」を投与されたA香港型のインフルエンザ患者30人を調べたところ、70%余りに当たる22人から、この薬が効きにくい耐性ウイルスが検出されたことが国立感染症研究所の調査で分かりました。
調査件数は多くないものの、専門家は現在のような使用を続けると、耐性ウイルスが広がるおそれがあるとして使用基準を見直すべきだと指摘しています。

耐性化率が50%以上である確率は
pbeta(0.5,1+22,1+8,lower=F)
[1] 0.9946631
0781卵の名無しさん
垢版 |
2019/10/02(水) 15:20:15.02ID:nv8GYZZt
kk=(88+96)/2/100 #TP: kessei kando
kt=(89+100)/2/100 #TN: kessei tokuido
pLHk=kk/(1-kt) #TP/FP
nLHk=(1-kk)/kt #(1-TP)/(1-FP)=FN/TN

bk=(90+98)/2/100 #ben kando
bt=(87+100)/2/100 #ben tokuido
pLHb=bk/(1-bt)
nLHb=(1-bk)/bt

prep=0.5 # pre-possibility
preo=prep/(1-prep) # pre-odds
posto=preo*nLHk*pLHb # kessei(-)&ben(+)
(postp=posto/(1+posto))

#
posto=preo*nLHk*nLHb # kessei(-)&ben(-)
(postp=posto/(1+posto))
0782卵の名無しさん
垢版 |
2019/10/02(水) 17:26:13.36ID:nv8GYZZt
#
# 尿素呼気試験(B) 90〜100 80〜99
# 血清抗体(S) 88〜96 89〜100
# 尿中抗体(U) 89〜97 77〜95
# 便中抗原(F) 90〜98 87〜100

U=c(90/2+100/2,80/2+99/2)/100
S=c(88/2+96/2,89/2+100/2)/100
U=c(89/2+97/2,77/2+95/2)/100
F=c(90/2+98/2,87/2+100/2)/100

DOR <- function(T){
TP=T[1] ; FN=1-TP
TN=T[2] ; FP=1-TN
pLR=TP/FP
nLR=FN/TN
pLR/nLR
}
DOR(U)
DOR(S)
DOR(U)
DOR(F)
0783卵の名無しさん
垢版 |
2019/10/02(水) 17:34:50.26ID:nv8GYZZt
B=c(90/2+100/2,80/2+99/2)/100
S=c(88/2+96/2,89/2+100/2)/100
U=c(89/2+97/2,77/2+95/2)/100
F=c(90/2+98/2,87/2+100/2)/100

DOR <- function(T){
TP=T[1] ; FN=1-TP
TN=T[2] ; FP=1-TN
pLR=TP/FP
nLR=FN/TN
pLR/nLR
}

> DOR(B)
[1] 161.9524
> DOR(S)
[1] 197.5909
> DOR(U)
[1] 81.61224
> DOR(F)
[1] 225.359
>
0784卵の名無しさん
垢版 |
2019/11/25(月) 07:37:28.66ID:ZvHlCyJI
# ゴルゴ13は100発100中
# ゴルゴ14は10発10中
# ゴルゴ15は1発1中
# とする。
# 各々10000発撃ったとき各ゴルゴの命中数の期待値はいくらか?

G13 <- function(N,n,r){
pp=0:N
f <- function(x) choose(x,r)*choose(N-x,n-r)/choose(N,n)
sum(pp*f(pp)/sum(f(pp)))
}

G13(10000,100,100)
G13(10000,10,10)
G13(10000,1,1)

#.n発r中の狙撃手が.N発狙撃するときの命中数を返す
Go13 <- function(.N, .n, r, k=10^3){ # k:シミュレーション回数
f <-function(S,N=.N,n=.n){
y=c(rep(1,S),rep(0,N-S))
sum(sample(y,n))
}
xx=r:.N
SS=NULL
for(i in 1:k){
x=sapply(xx,f)
SS=c(SS,which(x==r)-1+r)
}
print(summary(SS))
invisible(SS)
}
0785卵の名無しさん
垢版 |
2019/11/27(水) 20:32:52.68ID:s7+UeQPF
a=c(1,10,100)
curve(dbeta(x,1+a[1],1),bty='l')
curve(dbeta(x,1+a[2],1),bty='l')
curve(dbeta(x,1+a[3],1),bty='l')
1000*qbeta(0.95,a+1,1,lower=F)
0786卵の名無しさん
垢版 |
2019/11/27(水) 20:34:40.15ID:s7+UeQPF
> a=c(1,10,100)
> curve(dbeta(x,1+a[1],1),bty='l')
> curve(dbeta(x,1+a[2],1),bty='l')
> curve(dbeta(x,1+a[3],1),bty='l')
> 10000*qbeta(0.95,a+1,1,lower=F)
[1] 2236.068 7615.958 9707.748
>
0787卵の名無しさん
垢版 |
2019/11/30(土) 09:56:41.57ID:bijshzSl
# 安倍総理招待枠(60-****)が招待状から
# 254x 2409 357xだという。
# https://youtu.be/6-pYMPg5yR0?t=3981
# 通し番号がふられているとして
# 357xを3570と低めに見積もる。
#>いや、それどころか、今年はそれ以上の数字も確認されている。
#選挙で安倍首相が遊説をおこなうとかなりの頻度で目撃されている熱烈な支持者であるM氏という人物がいるのだが、
#氏が菅官房長官や杉田水脈議員とのツーショット写真などとともにSNSにアップしていた
# 今年の「桜を見る会」の受付票には「60-4908」とナンバリングされているのだ。
#https://fate.5ch.net/test/read.cgi/seijinewsplus/1574717426/
# 他に今年は254? 2409 357? という番号が国会で発言されている。
#参加者の18200の半数9100が官邸枠の可能性があると仮定して官邸枠招待者数の期待値と95%CIを算出せよ。

Nmin=4908
Nmax=9100
n=Nmin:Nmax
m=4
pmf=choose(Nmax-1,m-1)/choose(n,m) #Pr(max=60|n)
plot(n,pmf,ylab='probability')
pdf=pmf/sum (pmf)
plot(n,pdf,ylab='density',bty='l')
sum(n*pdf) #E(n)

plot(n,cumsum(pdf))
abline(h=0.95,lty=3)
idx=min(which(cumsum(pdf)>0.95))
n[idx]
0788卵の名無しさん
垢版 |
2019/11/30(土) 10:28:03.80ID:bijshzSl
> Nmin=4908
> Nmax=9100
> n=Nmin:Nmax
> m=4
> pmf=choose(Nmax-1,m-1)/choose(n,m) #Pr(max=60|n)
> plot(n,pmf,ylab='probability')
> pdf=pmf/sum (pmf)
> plot(n,pdf,ylab='density',bty='l')
> sum(n*pdf) #E(n)
[1] 6191.377
> plot(n,cumsum(pdf))
> abline(h=0.95,lty=3)
> idx=min(which(cumsum(pdf)>0.95))
> n[idx]
[1] 8406
>
0789卵の名無しさん
垢版 |
2019/12/09(月) 08:25:56.61ID:zd3bijjh
# サイコロ

# 正6面体のサイコロがある.4面は青色、2面は赤色である.
# このサイコロを合計20回振るとき、最も起こりそうな順番はどれか?
# 1.赤 青 赤 赤 赤
# 2.青 赤 青 赤 赤 赤
# 3.青 赤 赤 赤 赤 赤

sim <- function(){
a=sample(0:1,20, replace=TRUE, prob=c(4,2))
b=as.character(a)
c=paste(b,collapse="")
s1=paste(c(1,0,1,1,1),collapse="")
s2=paste(c(0,1,0,1,1,1),collapse="")
s3=paste(c(0,1,1,1,1,1),collapse="")
res=c(grepl(s1,c),grepl(s2,c), grepl(s3,c))
return(res)
}
k=1e5
re=replicate(k,sim())
mean(re[1,])
mean(re[2,])
mean(re[3,])
0790卵の名無しさん
垢版 |
2019/12/10(火) 08:45:53.53ID:k/8kaoYw
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
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]
}
0791卵の名無しさん
垢版 |
2019/12/10(火) 08:46:19.44ID:k/8kaoYw
seqNpJ <- function(N,K,p) seqNp(N,K,p)-seqNp(N,K+1,p)
seqNpJ(100,5,0.5)

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,5,0.05,T)


vs=Vectorize(function(K)seq2pCI(N=100,K,alpha=0.05,Print=F))
x=2:23
y=vs(x)
head(y)
y=y*100
plot(x,y['mean',],bty='l',pch=19,ylim=c(0,100),
xlab="最大連続数",ylab="推定裏口入学者数")
points(2:23,y['mode',],bty='l')
segments(x,y['lower',],x,y['upper',])
legend('right',bty='n',pch=c(19,1),legend=c("期待値","最頻値"))
0792卵の名無しさん
垢版 |
2019/12/10(火) 08:46:54.30ID:k/8kaoYw
# pdfからcdfの逆関数を作ってhdiを表示させて逆関数を返す
# 0,1での演算を回避 ∫[1/nxxx,1-1/nxx]dxで計算
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])
}

# 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)
c(lu[1],mean=mean,mode=mode,lu[2])
}
mKoN2pCI(100,4) # one minute plz
mKoN2pCI(100,5)
0793卵の名無しさん
垢版 |
2019/12/10(火) 08:47:01.63ID:k/8kaoYw
# N試行で最大K回連続成功→成功確率pの期待値、最頻値と95% Quantile
# max K out of N-trial to probability & CI_quantile
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)
}
mKoN2pCIq(100,4)
mKoN2pCIq(100,5)
0794卵の名無しさん
垢版 |
2019/12/10(火) 08:48:13.55ID:2lYn70em
## simulation
mKoN2pCIga<-function(N=100,K=4,Print=T){
pmf=Vectorize(function(p)seqNp(N,K,p)-seqNp(N,K+1,p))
auc=integrate(pmf,0,1)$value
pdf=function(x) pmf(x)/auc
(mode=optimize(pmf,c(0,1),maximum=TRUE)$maximum)
(mean=integrate(function(x)x*pdf(x),0,1)$value)
(var=integrate(function(x)(x-mean)^2*pdf(x),0,1)$value)
(sd=sqrt(var))
#正規分布で近似してみる
if(Print){
curve(pdf,bty='l',col='red')
curve(dnorm(x,mean,sd),add=T,col='blue')}
c(lower=qnorm(0.025,mean,sd),mode=mode,mean=mean,upper=qnorm(0.975,mean,sd))
}
mKoN2pCIga(100,5)
vmK=Vectorize(function(K) mKoN2pCIga(100,K))
(y=cbind(0,vmK(2:30)))
plot(1:30,y['mean',],pch=19)
points(1:30,y['mode',])
0795卵の名無しさん
垢版 |
2019/12/17(火) 22:26:20.29ID:MXFfIsV3
# 10円硬貨を投げて5回連続で表が出ると
# 稀な現象(0.5の5乗は 0.03125)なので表の出る確率は0.5ではない、というのが頻度主義統計の結論。
# この硬貨はどの程度歪(いびつ)なのかを推論するのがベイズ推論の面白さである。
# この硬貨で表がでる確率の95%信頼区間を計算してみよう。
#
# 表のでる確率分布をβ分布β(a,b)でa=bとすれば、0.5を頂点とする対象な事前確率分布となる。
# 事後分布はβ(a+5,a+0)となるのだが、問題はパラメータaをいくらに設定するかである。
# aを変数として95%信頼区間下限値をグラフにすると最小値があることがわかる。
# http://i.imgur.com/MA4ztAU.jpg
# 最尤法で算出させるとa=11.25のとき0.406となる。
# あとは95%区間を計算して、この硬貨が表が出る確率の95%信頼区間は0.406 0.763となる。
# http://i.imgur.com/8swQPMH.jpg
HDInterval::hdi(qbeta,shape1=1+5,shape2=1)
0796卵の名無しさん
垢版 |
2019/12/18(水) 12:46:29.75ID:HkAD959b
n=5
l <- function(a) HDInterval::hdi(qbeta,shape1=a+n,shape2=a)['lower']
vl=Vectorize(l)
curve(vl(x),0.5,1000,bty='l',lwd=2)
(lo=optimise(vl,(c(0.5,1000))))
HDInterval::hdi(qbeta,shape1=lo$min + n,shape2=lo$min)
0797卵の名無しさん
垢版 |
2019/12/18(水) 13:45:30.88ID:HkAD959b
コインをなげたら5回続けて表が出た。
表が出る確率は、平均値が0.5のベータ分布(一様分布もベータ分布の一つ)に従うように鋳造されているとする。
このコインの表の出る確率を95%信頼区間で推定するとき
区域下限値の最小値はいくらか?
つまり、95%以上の信頼性で表の出る確率はいくつ以上と言えるか?
0798卵の名無しさん
垢版 |
2019/12/18(水) 16:26:08.99ID:j32hgbYi
rm(list=ls())

n=5
l <- function(a) HDInterval::hdi(qbeta,shape1=a+n,shape2=a)['lower']
vl=Vectorize(l)
curve(vl(x),0.5,100,bty='l',lwd=2)
(lo=optimise(vl,(c(0.5,1000))))
HDInterval::hdi(qbeta,shape1=lo$min + n,shape2=lo$min)

#
binom::binom.confint(5,5)
f <- function(x) binom::binom.bayes(5,5,prior.shape1=x,prior.shape2=x)$lower
curve(f(x),0.5,50,bty='l',lwd=2)
optimize(f,c(0.5,50))
0800卵の名無しさん
垢版 |
2019/12/18(水) 19:59:58.70ID:HkAD959b
一般化 

#
"コインをなげたらn回続けて表が出た。
表が出る確率は、平均値が0.5のベータ分布(一様分布もベータ分布の一つ)に従うように鋳造されているとする。
このコインの表の出る確率を95%信頼区間で推定するとき区域下限値の最小値はいくらか?
つまり、95%以上の信頼性で表の出る確率はいくつを下回らないと言えるか?"
seq2lowest <- function(n){
l <- function(a) HDInterval::hdi(qbeta,shape1=a+n,shape2=a)['lower']
vl=Vectorize(l)
opt=optimise(vl,(c(0.5,1000)))
hdi=HDInterval::hdi(qbeta,shape1=lo$min + n,shape2=lo$min)
c('shape'=opt$minimum,opt$objective,hdi['upper'])
}
seq2lowest(5)
graphics.off()
nn=2:50
plot(nn,sapply(nn,seq2lowest)['lower',],pch=19,bty='l')
0802卵の名無しさん
垢版 |
2019/12/19(木) 07:45:22.67ID:mtJFYvZ2
rm(list=ls())

gambling <- function(A=2,B=1,w=3,p=0.5,k=1e5){ # k : how many simulate
sim <- function(){
while(A < w & B < w){
g = rbinom(1,1,p)
if(g==1){
A=A+1
}else{
B=B+1
}
}
A > B
}
mean(replicate(k,sim())) # Pr[A wins]
}
gambling(1,0,4) # 日本シリーズ
0803卵の名無しさん
垢版 |
2019/12/19(木) 07:45:58.37ID:mtJFYvZ2
# 日本シリーズ

f <- function(num, N=2, digit = 7){ # winner sequence of 7 games
r=num%%N
q=num%/%N
while(q > 0 | digit > 1){
r=append(q%%N,r)
q=q%/%N
digit=digit-1
}
return(r)
}
vf=Vectorize(f)
dat=t(vf(0:(2^7-1))) # matrirx of winner sequence of 7 games
(dat1=dat[dat[,1]==1,-1]) # winner sequence of 6 games

g <- function(s,A=1,B=0,w=4){ # A beats B T/F?
i=0
while(A < w & B < w){
i=i+1
r = s[i]
if(r==1){
A=A+1
}else{
B=B+1
}
}
A > B
}
sum(apply(dat1,1,g))/nrow(dat1)
0804卵の名無しさん
垢版 |
2019/12/19(木) 08:17:50.32ID:mtJFYvZ2
# 通算勝率に従って次の試合に勝つ確率が決まるという設定
# 先勝したAの日本シリーズ前の対戦成績がa勝b負とする
rm(list=ls())
N_series <- function(A=1,B=0,w=4,a=10,b=10,k=1e5){
sim <- function(){
p=(A+a)/(A+B+a+b)
while(A < w & B < w){
g = rbinom(1,1,p)
if(g==1){
A=A+1
p=(A+a+1)/(A+B+a+b+1)
}else{
B=B+1
p=(A+a)/(A+B+a+b+1)
}
}
A > B
}
mean(replicate(k,sim())) # Pr[A wins]
}
N_series()
0805卵の名無しさん
垢版 |
2019/12/19(木) 09:38:09.07ID:+FZyQ+1V
互角と言っても1勝1敗と1000勝1000敗だ結果が変わるな
> rm(list=ls())
> N_series <- function(A=1,B=0,w=4,a=10,b=10,k=1e5){
+ sim <- function(){
+ p=(A+a)/(A+B+a+b)
+ while(A < w & B < w){
+ g = rbinom(1,1,p)
+ if(g==1){
+ A=A+1
+ p=(A+a+1)/(A+B+a+b+1)
+ }else{
+ B=B+1
+ p=(A+a)/(A+B+a+b+1)
+ }
+ }
+ A > B
+ }
+ mean(replicate(k,sim())) # Pr[A wins]
+ }
>
> N_series(a=1,b=1)
[1] 0.76425
> N_series(a=10,b=10)
[1] 0.67035
> N_series(a=100,b=100)
[1] 0.65629
> N_series(a=1000,b=1000)
[1] 0.65802
0806卵の名無しさん
垢版 |
2019/12/19(木) 10:00:45.03ID:+FZyQ+1V
> N_series(a=1,b=1)
[1] 0.76266
> N_series(a=10,b=10)
[1] 0.6716
> N_series(a=100,b=100)
[1] 0.65707
> N_series(a=1000,b=1000)
[1] 0.65695
>
0807卵の名無しさん
垢版 |
2019/12/19(木) 16:11:38.16ID:mtJFYvZ2
NS <- function(w,A,B,p){ # 先にw点得点した方が勝者、A,B:現在の点数 ,p:甲の勝率
ans=0
for(k in 0:(w-B-1)){ # k: Aが勝者になるまでのBの点数
ans=ans+choose(w-A-1+k,w-A-1)*(1-p)^k*p^(w-A)
}
return(ans)
}

NS(3,2,1,0.5)
0808卵の名無しさん
垢版 |
2019/12/21(土) 11:16:13.81ID:JyjCwOQx
日本シリーズで賭けをする。

日本シリーズは先に4勝したチームが優勝。
勝率はそれまでの引き分けを除いた通算勝率に従うとする。
開始前の通算成績はA:2勝、B:4勝であった。
今、シリーズでAが先勝(第一試合に勝利)した。
この時点でA,Bのどちらに賭ける方が有利か?
0809卵の名無しさん
垢版 |
2019/12/21(土) 21:55:53.22ID:NW9TiMNu
# 小数点付きの数numをN進法で表示する

rm(list=ls())
dec2basen <- function(num, N, kmin = 5){ # kmin:最小小数点後桁
int=floor(num)
r=int%%N
q=int%/%N
while(q > 0){
r=append(q%%N,r)
q=q%/%N
} # rに整数のN進法表示を格納

x=num-floor(num)
k=max(nchar(x)-2,kmin) # 同長もしくはkminの長さの小数表示
a=numeric(k)
for(i in 1:k){
y=x*N
a[i]=floor(y)
x=y-a[i] # r . a[1] a[2] a[3] ... a[k]
}
if(N<=10){ # Nが10以下は数値として表示
cat(r,paste(".",paste(a,collapse = ''),sep=''),'\n',sep='')
}
else{ # Nが11以上は整数部分と小数部分を数列で表示
print(list(int=r,decimal=a))
}
invisible()

}
0810卵の名無しさん
垢版 |
2019/12/21(土) 23:15:54.59ID:NW9TiMNu
戻り値がある方がいいな。

# 小数点付きの数numをN進法で表示する

rm(list=ls())
dec2basen <- function(num, N, kmin = 5){ # kmin:最小小数点後桁
int=floor(num)
r=int%%N
q=int%/%N
while(q > 0){
r=append(q%%N,r)
q=q%/%N
} # rに整数のN進法表示を格納

x=num-floor(num)
k=max(nchar(x)-2,kmin) # 同長もしくはkminの長さの小数表示
a=numeric(k)
for(i in 1:k){
y=x*N
a[i]=floor(y)
x=y-a[i] # r . a[1] a[2] a[3] ... a[k]
}
b=list(int=r,decimal=a)
if(N<=10){ # Nが10以下は数値として表示
cat(r,paste(".",paste(a,collapse = ''),sep=''),'\n',sep='')
}
else{ # Nが11以上は整数部分と小数部分を数列で表示
print(b)
}
invisible(b)
}
0811卵の名無しさん
垢版 |
2019/12/21(土) 23:26:15.77ID:NW9TiMNu
> dec2basen(5/9,3)
0.120000000000000
>
> dec2basen(3.14159265359,7)
3.06636514320
> dec2basen(3.14159265359,8)
3.11037552421
> dec2basen(3.14159265359,9)
3.12418812407
> dec2basen(3.14159265359,14)
$int
[1] 3

$decimal
[1] 1 13 10 7 5 12 13 10 8 1 4

>
> re=dec2basen(sqrt(3),16) # √3の16進法表示
$int
[1] 1

$decimal
[1] 11 11 6 7 10 14 8 5 8 4 12 10 10 0 0

> b=re$decimal
> cat(re$int,'.',paste0(c('0':'9','A','B','C','D','E','F')[b+1],sep='',collapse=''),sep='')
1.BB67AE8584CAA00
0812卵の名無しさん
垢版 |
2019/12/22(日) 13:49:45.74ID:D+p3chog
# 小数点付きの数numをN進法で表示する
floor((1.2-1)*5) != floor(1)
rm(list=ls())
decN <- function(num, N, kmin = 5){ # kmin:最小小数点後桁
int=floor(num)
r=int%%N
q=int%/%N
while(q > 0){
r=append(q%%N,r)
q=q%/%N
} # rに整数のN進法表示を格納

x=num-floor(num)
k=max(nchar(x)-2,kmin) # 同長もしくはkminの長さの小数表示
a=numeric(k)
for(i in 1:k){
y=x*N
a[i]=floor(y+2e-13) # n=1:9 ;trunc((1+1/n-1)*n) ;trunc((1+1/n-1)*n+5e-14)対応
x=y-a[i] # r . a[1] a[2] a[3] ... a[k]
}
b=list(integer=r,decimal=a,num=sum(c(int,a)*(1/N)^(0:k)))
fig=c(0:9,letters)[1:N]
if(N<=36){ # Nが36以下は数値として表示
cat(b$integer,'.',paste(fig[b$decimal+1],sep='',collapse=''),sep='')
cat('\n')
}
else{ # Nが11以上は整数部分と小数部分を数列で表示
print(b[1:2])
}
invisible(b)
}
0813卵の名無しさん
垢版 |
2019/12/22(日) 13:50:03.28ID:D+p3chog
> decN(5/9,3)
0.120000000000000
> decN(0.728,5,10)
0.331004444
> decN(3.14159265359,7)
3.06636514320
> decN(3.14159265359,14)
3.1da75cda814
0814卵の名無しさん
垢版 |
2019/12/22(日) 14:24:46.39ID:D+p3chog
# 小数点付きの数numをN進法で表示する
rm(list=ls())
decN <- function(num, N, kmin = 5){ # kmin:最小小数点後桁
int=floor(num)
r=int%%N
q=int%/%N
while(q > 0){
r=append(q%%N,r)
q=q%/%N
} # rに整数のN進法表示を格納

x=num-floor(num)
k=max(nchar(x)-2,kmin) # 同長もしくはkminの長さの小数表示
a=numeric(k)
for(i in 1:k){
y=x*N
a[i]=trunc(y+2e-13) # n=1:9 ;trunc((1+1/n-1)*n) ;trunc((1+1/n-1)*n+5e-14)対応
x=y-a[i] # r . a[1] a[2] a[3] ... a[k]
}
b=list(integer=r,decimal=a,num=sum(c(int,a)*(1/N)^(0:k)))
fig=c(0:9,letters)[1:N]
if(N<=36){ # Nが36以下は数値として表示
cat(b$integer,'.',paste(fig[b$decimal+1],sep='',collapse=''),sep='')
cat('\n')
}
else{ # Nが37以上は整数部分と小数部分を数列で表示
print(b[1:2])
}
invisible(b) # b$num:検証用
}
0815卵の名無しさん
垢版 |
2019/12/22(日) 16:52:54.78ID:D+p3chog
# 小数点付きの数numをN進法で表示する
rm(list=ls())
decN <- function(num, N, kmin = 5){ # kmin:最小小数点後桁
int=floor(num)
r=int%%N
q=int%/%N
while(q > 0){
r=append(q%%N,r)
q=q%/%N
} # rに整数のN進法表示数列を格納
k=max(nchar(num)-nchar(floor(num))-1,kmin) # 同長もしくはkminの長さの小数表示
a=numeric(k)
x=round(num-floor(num),k) # e.g. 7.28-floor(7.28)-0.28 != 0に対応
for(i in 1:k){
y=round(x*N,k) # e.g. 0.728*5-3.64 !=0 に対応
a[i]=floor(y)
x=y-a[i] # r . a[1] a[2] a[3] ... a[k]
}
b=list(integer=r,decimal=a,num=sum(c(int,a)*(1/N)^(0:k)))
fig=c(0:9,letters)[1:N]
if(N<=36){ # Nが36以下は数値として表示
cat(paste(fig[b$integer+1],sep='',collapse=''),
'.',paste(fig[b$decimal+1],sep='',collapse=''),sep='')
cat('\n')
}
else{ # Nが37以上は整数部分と小数部分を数列で表示
print(b[1:2])
}
invisible(b) # b$num:検証用
}
0816卵の名無しさん
垢版 |
2019/12/22(日) 23:14:45.02ID:D+p3chog
rm(list=ls())
NS <- function(w,A,B,p){ # 先にw点得点した方が勝者、A,B:現在の点数 ,p:甲の勝率
ans=0
for(k in 0:(w-B-1)){ # k: Aが勝者になるまでのBの点数
ans=ans+choose(w-A-1+k,w-A-1)*(1-p)^k*p^(w-A)
}
return(ans)
}
NS(3,2,1,0.5)
NS(4,1,0,0.5)
curve(NS(4,1,0,x),bty='l',lwd=2)
abline(h=0.5,col='gray')

# 日本シリーズで先勝したときに優勝する確率がx以上であるために必要な勝率vf(x)は?
f <- function(u0) uniroot(function(p) NS(4,1,0,p)-u0,c(0,1))$root
f(0.5)
vf=Vectorize(f)
curve(vf(x),bty='l')
vf(seq(0,1,0.1))
0817卵の名無しさん
垢版 |
2019/12/23(月) 13:09:52.68ID:WZg+GXSV
デバッグした
# 通算勝率に従って次の試合に勝つ確率が決まるという設定
# 先勝したAの日本シリーズ前の対戦成績がa勝b負とする
rm(list=ls())
N_series <- function(A=1,B=0,w=4,a=2,b=4,k=1e5){
sim <- function(){
while(A < w & B < w){
p=(A+a)/(A+B+a+b)
g = rbinom(1,1,p)
if(g==1){
A=A+1
}else{
B=B+1
}
}
A > B
}
mean(replicate(k,sim())) # Pr[A wins]
}
N_series()
0818卵の名無しさん
垢版 |
2019/12/23(月) 15:14:31.94ID:+ZpAQitI
日本シリーズは先に4勝したチームが優勝。
勝率はそれまでの通算勝率に従うとする。引き分けはないものとする。
勝負がつくごとに次回の勝率が変化する。
(第二試合にAが勝つ確率は通算勝率の3/7
Aが勝ったら第三試合に勝つ確率は4/8
Aが負けたら第三試合に勝つ確率は3/8
になるという設定)
シリーズ開始前の通算成績はA:2勝、B:4勝であった。
今シリーズでAが先勝(第一試合に勝利)した。
この時点でどちらが優勝するか賭けをする。
A,Bのどちらに賭ける方が有利か?"
0819卵の名無しさん
垢版 |
2019/12/26(木) 13:19:39.94ID:Andgk16C
poisson.test(c(11, 6+8+7), c(800, 1083+1050+878))
prop.test(c(11, 6+8+7), c(800, 1083+1050+878))
0820卵の名無しさん
垢版 |
2019/12/26(木) 13:47:03.52ID:Andgk16C
poisson.test(c(11, 6+8+7), c(800, 1083+1050+878))
prop.test(c(11, 6+8+7), c(800, 1083+1050+878))
library(fmsb)
ratedifference(11, 6+8+7, 800, 1083+1050+878)
rateratio(11, 6+8+7, 800, 1083+1050+878)
source('tools.R')
jags4prop(11, 6+8+7, 800, 1083+1050+878)
0821卵の名無しさん
垢版 |
2019/12/27(金) 17:58:44.40ID:pKcbCDhI
ZooG <- function(L=1,M=1,N=1,A=30,B=60){
alpha=B/180*pi
beta=A/180*pi
a=M/N # length of 0P
b=L/N # length of PQ
P=a*(cos(alpha)+1i*sin(alpha))
Q=P+b*(cos(alpha+pi-beta)+1i*sin(alpha+pi-beta))
(pi-Arg(Q-1))/pi*180 # degree of Q-I-0
max(Arg(Q-P)/pi*180 - Arg(Q-1)/pi*180, Arg(Q-P)/pi*180 - Arg(Q-1)/pi*180+360) # degree of P-Q-I
abs(Q-1) # length of QI
xlim=ylim=max(a,b)*c(-1,2)
plot(0,xlim=xlim,ylim=ylim,bty='l',type='l',axes=FALSE, ann=FALSE,asp=1)
# draw segment of complex a to complex b
seg <- function(a,b,color=2,...) segments(Re(a),Im(a),Re(b),Im(b),col=color,...)
# draw text y at complex x
pt <- function(x,y=NULL,...) text(Re(x),Im(x), ifelse(is.null(y),'+',y), ...)
seg(0,1) ; seg(0,P) ; seg(P,Q)
pt(0,paste('O',B,'°')) ; pt(1,'I') ; pt(P,paste('P ',A,'°')) ; pt(Q,'Q')
pt((P+Q)/2, paste('L = ',L)) ; pt((P+0)/2, paste('M = ',M)) ; pt(1/2, paste('N = ',N))
seg(1,Q,col=1,lty=2)
angleI=(pi-Arg(Q-1))/pi*180 # degree of Q-1-0
if(angleI<0)angleI=angleI+360
if(angleI>360)angleI=angleI-360
if(angleI>180 & angleI<360) angleI=360-angleI
angleQ=Arg(Q-P)/pi*180 - Arg(Q-1)/pi*180 # degree of P-Q-1
if(angleQ<0)angleQ=angleQ+360
if(angleQ>360)angleQ=angleQ-360
if(angleQ>180 & angleQ<360) angleQ=360-angleQ
length=abs(Q-1)*N # length of Q1
c(angleQ=angleQ,angleI=angleI,QIlength=length)
}
0822卵の名無しさん
垢版 |
2019/12/27(金) 17:59:16.31ID:pKcbCDhI
# 長さL,M,NのZ尺を角度A°(LとMのなす角)、B°(MとNのなす角)で折り曲げたとき
# 先端と終端を結ぶ線とZ尺の作る角度および先端と終端の距離

ZooG(1,1,1,36,24)
ZooG(sample(10,1),sample(10,1),sample(10,1),sample(179,1),sample(179,1))
0823卵の名無しさん
垢版 |
2019/12/31(火) 20:45:37.19ID:caKR9jL7
# The ambulance arrives X hours ealier at hospital,
# when the patient leave clinic s hours earlier than planned
# and encounter the ambulance t hours later,
# ambulance runs with the velocity of v0 without patient, and v1 with patient
# clinic car runs with the velocity of w


Earlier <- # s hour earlier departure, X hour earlier arrival
function(s=NULL,X=NULL,t=NULL,v0=60,v1=45,w=30){
if(is.null(s)) re=c(s=X/(v0/(v0+w)*w*(1/v0+1/v1)),t=X/w/(1/v0+1/v1))
if(is.null(X)) re=c(X=s*v0/(v0+w)*w*(1/v0+1/v1),t=s*v0/(v0+w))
if(!is.null(t)) re=c(s=t + t*w/v0, X = t*w*(1/v0+1/v1))
return(re)
}
Earlier(X=10/60)*60
Earlier(s=30/60)*60
Earlier(t=30/60)*60
0824卵の名無しさん
垢版 |
2020/01/24(金) 09:01:51.18ID:p9O7hNNU
TE=cbind(rep(0:1,c(3,3)),rep(0:2,2))
colnames(TE)=c('JD','service')
TE
cond1 <- function(P,Q) !(P&!Q)
cond2 <- function(P,Q) cond1(P,Q) & cond1(!P,!Q)
f <- function(x){
all(c(
x[1]==1 & cond2(cond2(x[1]==1,x[2]!=1),x[2]>0) | x[1]==0 & !cond2(cond2(x[1]==1,x[2]!=1),x[2]>0)
))
}
TE[(apply(TE,1,f)),]
0826卵の名無しさん
垢版 |
2020/01/24(金) 10:40:22.42ID:9ccIONJj
TE=cbind(rep(0:1,c(3,3)),rep(0:2,2))
colnames(TE)=c('JD','service')
TE
cond1 <- function(P,Q) !(P&!Q)
cond2 <- function(P,Q) P==Q
f <- function(x){
all(c(
x[1]==1 & cond2(cond2(x[1]==1,x[2]!=1),x[2]>0) | x[1]==0 & !cond2(cond2(x[1]==1,x[2]!=1),x[2]>0)
))
}
TE[(apply(TE,1,f)),]
0827卵の名無しさん
垢版 |
2020/01/24(金) 10:42:15.05ID:9ccIONJj
> TE=cbind(rep(0:1,c(3,3)),rep(0:2,2))
> colnames(TE)=c('JD','service')
> TE
JD service
[1,] 0 0
[2,] 0 1
[3,] 0 2
[4,] 1 0
[5,] 1 1
[6,] 1 2
> cond1 <- function(P,Q) !(P&!Q)
> cond2 <- function(P,Q) P==Q
> f <- function(x){
+ all(c(
+ x[1]==1 & cond2(cond2(x[1]==1,x[2]!=1),x[2]>0) | x[1]==0 & !cond2(cond
<(x[1]==1,x[2]!=1),x[2]>0) | x[1]==0 & !cond2(cond2 (x[1]==1,x[2]!=1),x[2]>0)
+ ))
+ }
> TE[(apply(TE,1,f)),]
JD service
[1,] 0 2
[2,] 1 2
>
0828卵の名無しさん
垢版 |
2020/01/24(金) 15:17:02.19ID:p9O7hNNU
"某女子大には決して嘘をつかない女子大生と必ず嘘をつく女子大生がいることがわかっている。
この女子大の学生(嘘つきかどうかは不明)から
「あなたのいうことが正しければ手コキかフェラをしてあげる、間違っていれば何もしてあげない」と言われた。
女子大生にフェラをしてもらうには何と言えばいいか?
"
rm(list=ls())
TE=cbind(rep(0:1,c(4,4)),rep(0:3,2))
colnames(TE)=c('JD','service')
TE # JD 0:嘘つき 1:正直, service 0:何もしない 1:手コキ 2:フェラ 3:手コキ+フェラ
cond1 <- function(P,Q) !(P&!Q) # pならばQ
cond2 <- function(P,Q) cond1(P,Q) & cond1(!P,!Q) # (pならばQ) かつ(pでないならQでない)
f <- function(x){
x[1]==1 & cond2(cond2(x[1]==1,x[2]!=1),x[2]>0) | x[1]==0 & !cond2(cond2(x[1]==1,x[2]!=1),x[2]>0)
}
TE[(apply(TE,1,f)),]

cond3 <- function(P,Q) P==Q
f <- function(x){
x[1]==1 & cond3(cond3(x[1]==1,x[2]!=1),x[2]>0) | x[1]==0 & !cond3(cond3(x[1]==1,x[2]!=1),x[2]>0)
}
TE[(apply(TE,1,f)),]
0829卵の名無しさん
垢版 |
2020/01/25(土) 07:15:52.06ID:v8nYWWGU
TEnr <- function(n,r,one=1){ # n(=5),r(=3)を指定して 0 0 1 1 1から1 1 1 0 0までの順列行列を作る
f=function(x){
re=numeric(n) # 容れ子
re[x]=one # 指定のindexにoneを代入
re
}
t(combn(n,r,f)) # oneを入れる組み合わせに上記関数fを実行して転置
}
0830卵の名無しさん
垢版 |
2020/01/25(土) 07:43:20.46ID:v8nYWWGU
0 1 以外の場合もあるからこうした方がいいな

TEnr <- function(n,r,zero=0,one=1){ # n(=5),r(=3)を指定して 0 0 1 1 1から1 1 1 0 0までの順列行列を作る
f=function(x){
re=rep(zero,n) # 容れ子
re[x]=one # 指定のindexにoneを代入
re
}
t(combn(n,r,f)) # oneを入れる組み合わせに上記関数fを実行して転置
}
0831卵の名無しさん
垢版 |
2020/01/25(土) 13:21:20.50ID:v8nYWWGU
"
7段の階段を上るさい、1段上るか、2段上るかのいずれかを組合わせて上るこ
ととする。上り方は何通りあるか。
"
# Σxi=n xi<=r 一度にr(=3)段まで上がれる時、総数n(=7)段上がる場合の数
stairway <- function(n,r){
count=numeric(n)
m=ceiling(n/r)
for(i in m:n){
pi=gtools::permutations(r,i,rep=T)
pn=pi[apply(pi,1,sum)==n,]
count[i]=ifelse(is.vector(pn),1,nrow(pn))
}
sum(count)
}

stairway(7,2)
0832卵の名無しさん
垢版 |
2020/01/27(月) 15:33:10.59ID:54kq03+D
ここまで複雑だと推論での結論はかなり困難だと思う。

AからHの8人はそれぞれ正直者か嘘つきであり、誰が正直者か嘘つきかはお互いに知っている。
A,B,C,D,Eは嘘つきなら必ず嘘をつくが、F,G,Hは嘘つきでも正しいことを言う場合がある。
次の証言から誰を確実に正直者と断定できるか?

A「嘘つきの方が正直者より多い」
B「Hは嘘つきである」
C「Bは嘘つきである」
D「CもFも嘘つきである」
E「8人の中に、少なくとも1人嘘つきがいる」
F「8人の中に、少なくとも2人嘘つきがいる」
G「Eは嘘つきである」
H「AもFも正直者である」

プログラム解で解くのはたやすい。
TE=expand.grid(0:1,0:1,0:1,0:1,0:1,0:1,0:1,0:1)
colnames(TE)=LETTERS[1:8]
f <- function(x){
all(c(
x[1]==1 & sum(x==0)>sum(x==1) | x[1]!=1 & !(sum(x==0)>sum(x==1)),
x[2]==1 & x[8]==0 | x[2]!=1 & x[8]!=0,
x[3]==1 & x[2]==0 | x[3]!=1 & x[2]!=0 ,
x[4]==1 & (x[3]==0 & x[6]==0) |  x[4]!=1 & !(x[3]==0 & x[6]==0),
x[5]==1 & sum(x==0)>=1 | x[5]!=1 & !(sum(x==0)>=1),
x[6]==1 & sum(x==0)>=2 | x[6]==1 & !(sum(x==0)>=2),
x[7]==1 & x[5]==0 | x[7]!=1 & x[5]!=0,
x[8]==1 & (x[1]==1 & x[6]==1) | x[8]!=1 & !(x[1]==1 & x[6]==1)
))
}
TE[apply(TE,1,f),]
0833卵の名無しさん
垢版 |
2020/01/27(月) 15:49:58.32ID:54kq03+D
ここまで複雑だと推論での結論はかなり困難だと思う。

AからHの8人はそれぞれ正直者か嘘つきであり、誰が正直者か嘘つきかはお互いに知っている。
A,B,C,D,Eは嘘つきなら必ず嘘をつくが、F,G,Hは嘘つきでも正しいことを言う場合がある。
次の証言から誰を確実に正直者と断定できるか?

A「嘘つきの方が正直者より多い」
B「Hは嘘つきである」
C「Bは嘘つきである」
D「CもFも嘘つきである」
E「8人の中に、少なくとも1人嘘つきがいる」
F「8人の中に、少なくとも2人嘘つきがいる」
G「Eは嘘つきである」
H「AもFも正直者である」

プログラムで解くのはたやすいが正しいプログラムを書くには注意力が必要。  ,や)のミス一つで誤答がでる
TE=expand.grid(0:1,0:1,0:1,0:1,0:1,0:1,0:1,0:1)
colnames(TE)=LETTERS[1:8]
f <- function(x){
all(c(
x[1]==1 & sum(x==0)>sum(x==1) | x[1]!=1 & !(sum(x==0)>sum(x==1)),
x[2]==1 & x[8]==0 | x[2]!=1 & x[8]!=0,
x[3]==1 & x[2]==0 | x[3]!=1 & x[2]!=0 ,
x[4]==1 & (x[3]==0 & x[6]==0) |  x[4]!=1 & !(x[3]==0 & x[6]==0),
x[5]==1 & sum(x==0)>=1 | x[5]!=1 & !(sum(x==0)>=1),

x[6]==1 & sum(x==0)>=2 | x[6]==0,
x[7]==1 & x[5]==0 | x[7]==0,
x[8]==1 & (x[1]==1 & x[6]==1) | x[8]==0
))
}
TE[apply(TE,1,f),]
0834卵の名無しさん
垢版 |
2020/01/28(火) 08:12:46.55ID:xazq0gTe
では次の問題です
次の動画をみさくら語で解説しましょう
https://www.youtube.com/watch?v=ckO9d_-qiPw

国試浪人の事務員でなければできるはずだねW
0835卵の名無しさん
垢版 |
2020/01/28(火) 09:10:54.29ID:G+B9uPjF
>>834
みさくら語ってド底辺頭脳の言語か?
RとかPythonなら使えるけど。
0836コンブ薬屋
垢版 |
2020/01/28(火) 10:56:41.57ID:xazq0gTe
ほほう、どうやら
底辺の国試浪人には解けないようだね
0837卵の名無しさん
垢版 |
2020/01/28(火) 10:59:24.13ID:G+B9uPjF
rm(list=ls())
graphics.off()
seg <- function(a,b,...){
segments(Re(a),Im(a),Re(b),Im(b),col='gray',...)}

plot(0:10,type='n',xlim=c(0,10),ylim=c(0,10),asp=1,bty='l')
seg(10,10+10i,lwd=5) ; seg(0,10,lwd=5) ; seg(0,10i,lwd=5) ; seg(10i,10+10i,lwd=5)

cir <- function(a,b=0,r){
x=seq(a-r,a+r,by=0.01)
x=x[0<x & x<10]
y=b+sqrt(r^2-(x-a)^2)
lines(x,y)
}
for(i in 0:10) cir(i,0, 10-i*0.5)

cir2 <- function(a=10,b,r){
y=seq(b-r,b+r,by=0.01)
y=y[0<y & y<10]
x=a-sqrt(r^2-(y-b)^2)
lines(x,y)
}
for(i in 0:10) cir2(10,i,5-i*0.5)
0838卵の名無しさん
垢版 |
2020/01/28(火) 11:00:43.78ID:G+B9uPjF
cir3 <- function(a=0,b,r){
y=seq(b-r,b+r,by=0.01)
y=y[0<y & y<10]
x=a+sqrt(r^2-(y-b)^2)
lines(x,y)
}
for(i in 0:10) cir3(0,i,10-i*0.5)

cir4 <- function(a,b=10,r){
x=seq(a-r,a+r,by=0.01)
x=x[0<x & x<10]
y=b-sqrt(r^2-(x-a)^2)
lines(x,y)
}
for(i in 0:10) cir4(i,10,5-i*0.5)

https://i.imgur.com/92wYLCv.jpg
0839コンブ薬屋
垢版 |
2020/01/28(火) 12:07:50.04ID:xazq0gTe
さあ、みさくら語に翻訳しよう


「何?街の薬剤師?大学教授の娘が、街の一薬剤師と結婚したいと言うのか?」
「いけませんの? 」
「絶対に反対だよ。何代も続いている有名な製薬会社オーナーは別として、一般の薬剤師になるものは、会社に残りたくても残れず、仕方なく街の薬剤師になる場合が多いのだ」

「医学部教授と街の薬剤師。比較するだけでもおかしいよ」
0840卵の名無しさん
垢版 |
2020/01/28(火) 12:28:48.28ID:zoyO6+ty
社交性が無く、職場で干されているアスペルガー医者が建てたスレはここですか?
0841卵の名無しさん
垢版 |
2020/01/28(火) 13:27:34.27ID:G+B9uPjF
>>836
みさくら語ってド底辺頭脳の言語は知らんから、リンクも踏んでないよ。
0842卵の名無しさん
垢版 |
2020/01/28(火) 13:29:40.54ID:G+B9uPjF
新型コロナウイルスの統計処理が自分の計算と合わないのが不思議なんだよね。


2019-nCov(2019年新型コロナウイルス)の論文
https://www.thelancet.com/journals/lancet/article/PIIS0140-6736(20)30183-5/fulltext
は生データがついているので自分で統計処理が再現できるので遊べる。

2019-nCov感染者41例中ICU収容13例(うち現喫煙者0),28例非収容(うち現喫煙者3)である。
このことから、煙草を吸うと重症化が防げると結論できるか?

エントリーに0を含むときにはχ二乗検定は無効なのでFisher testで計算していると思うのだが
Fisher's Exact Test for Count Data

data: cbind(hit, shot - hit)
p-value = 0.539
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
0.000000 5.257728
sample estimates:
odds ratio
となって、論文のp値 0.31とは合致しないなぁ。
0843卵の名無しさん
垢版 |
2020/01/28(火) 13:47:56.68ID:G+B9uPjF
I hate the so-called Fisher exact test: a pointer to one of my favorite articles

https://statmodeling.stat.columbia.edu/2009/05/15/i_hate_the_so-c/

ベイズで計算してみるか。


# contingency stan for reproducibility of p.value
library(rstan)
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)
contingency2stan <- function(mat,alpha=0.05){
N=apply(mat,1,sum)
data <- list(mat=mat,N=N)
stanModel=readRDS('contingency.rds')
fit=sampling(stanModel,data=data, chain=1, iter=10000)
pars=c('y1','n1_y1','y0','n0_y0','d','RR','OR','NNT')
print(fit, pars=pars,digits=4,prob=c(0.025,0.5,0.975))
ms=rstan::extract(fit)
p.sim=NULL ;attach(ms) ; for(i in 1:length(p11)){
MAT=round(matrix(c(y1[i],n1_y1[i],y0[i],n0_y0[i]),ncol=2,byrow=TRUE))
p.sim=append(p.sim,chisq.test(MAT)$p.value)
}; detach(ms)
BEST::plotPost(p.sim,compVal = 0.05, xlab='p.value')
cat('Pr(p.value < ',alpha,') = ', mean(p.sim<alpha),'\n')
cat('Original p.value = ',chisq.test(mat)$p.value,'\n')
}
0844卵の名無しさん
垢版 |
2020/01/28(火) 13:57:41.14ID:G+B9uPjF
>>836
ド底辺スレでの宿題はまだできてないのか?

ド底辺シリツ医大卒の裏口バカは、空室なしの10人5部屋割付の数をまだ出せないのか?

部屋の名前を '底辺','私立','ガチ','裏口','バカ'と命名すると
このように

ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ
ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ バカ
ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ 私立
ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ 底辺
ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ 裏口
ガチ ガチ ガチ ガチ ガチ ガチ ガチ ガチ バカ ガチ
から
裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 底辺 裏口
裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 ガチ
裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 バカ
裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 私立
裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 底辺
裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口 裏口
まで並べて
裏口 底辺 裏口 バカ ガチ 底辺 底辺 私立 私立 バカ
バカ 裏口 私立 私立 私立 バカ ガチ 裏口 ガチ 底辺
バカ 私立 バカ バカ ガチ 裏口 底辺 バカ 裏口 裏口
裏口 裏口 ガチ 裏口 私立 底辺 裏口 裏口 バカ ガチ
底辺 バカ ガチ バカ ガチ 私立 裏口 バカ バカ 裏口

部屋が5種類あるのを数えるだけだぞ。
ド底辺シリツ医大卒の裏口バカって数もろくに数えられないのか?
0845コンブ薬屋
垢版 |
2020/01/28(火) 14:21:54.71ID:xazq0gTe
ほら、んほおぉぉぉっ、って言ってみな
んほおぉぉぉっ、ってW
0846卵の名無しさん
垢版 |
2020/01/28(火) 15:35:57.65ID:G+B9uPjF
最新のLancetに掲載された論文:新型コロナウイルスの治療に少量〜中等量のステロイド(メチルプレドニゾロンで40〜120mg/日)使用の有無による死亡例の数字は

Death 4/9 (44.4%) 2/32 (6.3%)

なぜか、他の項目にあったp値が掲載されていない。

Fisher's Exact Test for Count Data

data: mat
p-value = 0.01481456
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
1.217274433 151.944072111
sample estimates:
odds ratio
10.93370175

なんでも確率変数にするのがベイズ統計。

ここで問題

p値の95%信頼区間とp値が0.05未満になる確率を求めよ。
0847卵の名無しさん
垢版 |
2020/01/28(火) 15:37:06.96ID:G+B9uPjF
0.05未満になる確率は

これを持って統計的に有意だというどの程度の信頼度を持っていえるか、ってことなんだな。
0848卵の名無しさん
垢版 |
2020/01/28(火) 15:48:52.17ID:G+B9uPjF
## 2x2 tableからsensitivity,specificity,PPV,NPVの信頼区間を計算
cont2ci<- function(TP,FP,FN,TN){ # contingency table 2 confidence interval
library(BEST)
sensitivity=TP/(TP+FN)
specificity=TN/(TN+FP)
pLR=TP/FP # sensitivity/(1-specificity)
nLR=FN/TN # (1-TP)/(1-FP) = (1-sensitivity)/specificity
PPV=TP/(TP+FP)
NPV=TN/(TN+FN)

par(mfrow=c(3,2))
col=sample(colours(),1)
plotPost(sensitivity,showMode = F,col=col)
plotPost(specificity,showMode = F,col=col)
plotPost(PPV,showMode = F,col=col)
plotPost(NPV,showMode = F,col=col)
plotPost(pLR,showMode = F,col=col)
plotPost(nLR,showMode = F,col=col)
sn=hdi(sensitivity)[1:2]
sp=hdi(specificity)[1:2]
ppv=hdi(PPV)[1:2]
npv=hdi(NPV)[1:2]
plr=hdi(pLR)[1:2]
nlr=hdi(nLR)[1:2]
par(mfrow=c(1,1))
rbind(sn,sp,ppv,npv,plr,nlr)
}
0849卵の名無しさん
垢版 |
2020/01/28(火) 15:50:33.03ID:G+B9uPjF
# ポアソンモデル
k=1e5
TP=rpois(k,43)
FP=rpois(k,2)
FN=rpois(k,35)
TN=rpois(k,25)
cont2ci(TP,FP,FN,TN)

# 二項分布モデル(周辺度数固定)
k=1e5
TP=rbinom(k,43+35,43/(43+35))
FP=rbinom(k, 2+25, 2/( 2+25))
FN=rbinom(k,35+43,35/(35+43))
TN=rbinom(k,25+ 2,25/(25+ 2))
cont2ci(TP,FP,FN,TN)

# 二項分布モデル(総数固定)
k=1e5
mat=matrix(c(43,2,35,25),ncol=2)
colnames(mat)=c("逆転陽性","逆転陰性")
rownames(mat)=c("除菌成功","除菌失敗")
mat
N=apply(mat,1,sum) # 78 vs 27
N.total=sum(mat)
Succ=rbinom(k,N.total,78/N.total)
Fail=rbinom(k,N.total,27/N.total)

FP=rbinom(k,Fail, 2/Fail)
FN=rbinom(k,Succ,35/Succ)
TN=Fail - FP
TP=Succ - FN
cont2ci(TP,FP,FN,TN)
0850コンブ薬屋
垢版 |
2020/01/28(火) 17:55:30.50ID:xazq0gTe
では次の問題です
この病棟における入院期間の平均値と治癒率を求めよ
https://togetter.com/li/1432976
0851卵の名無しさん
垢版 |
2020/01/28(火) 19:19:47.40ID:vtD6D8ed
0がエントリーにあると扱いが難しいな。

rm(list=ls())
mat.smoke=cbind(c(0,3),c(13,28)-c(0,3))
mat.smoke # 喫煙のICU入院のクロス表
Epi::twoby2(mat.smoke)
fmsb::oddsratio(mat.smoke)
library(BayesFactor)
library(BEST)

k=1e3
bfp=contingencyTableBF(mat.smoke,'poisson',post=T,iter=k)
matp=as.data.frame(bfp) # ポアソン分布で乱数化
apply(matp,2,mean)


bfi=contingencyTableBF(mat.smoke,'indepMulti','rows',post=T,iter=k)
bfi=as.data.frame(bfi) # 行の周辺度数固定の二項分布で乱数化
mati=bfi[,1:4]*sum(mat.smoke)
apply(mati,2,mean)

bfj=contingencyTableBF(mat.smoke,'jointMulti',post=T,iter=k)
matj=as.matrix(bfj)*sum(mat.smoke) # 総数数固定の二項分布で乱数化
apply(matj,2,mean)
0852卵の名無しさん
垢版 |
2020/01/28(火) 19:19:58.78ID:vtD6D8ed
mat2pf <- function(x){
fisher.test(matrix(round(x),nrow=2))$p.value # roundで整数化してFisherテスト
}

mat2pc <- function(x){
chisq.test(matrix(x,nrow=2))$p.value # χ二乗検定
}

ppf=apply(matp,1,mat2pf)
plotPost(ppf,compVal=0.05)
ppc=apply(matp,1,mat2pc)
plotPost(ppc,compVal=0.05)

pif=apply(mati,1,mat2pf)
plotPost(pif,compVal=0.05)
pic=apply(mati,1,mat2pc)
plotPost(pic,compVal=0.05)

pjf=apply(matj,1,mat2pf)
plotPost(pjf,compVal=0.05)
pjc=apply(matj,1,mat2pc)
plotPost(pjc,compVal=0.05)

source('tools.R')
jags4prop(0,3,13,28)
0853卵の名無しさん
垢版 |
2020/01/28(火) 19:22:05.70ID:vtD6D8ed
リンクは踏まないから、こういう風に問題を書けよ。

"某女子大には決して嘘をつかない学生と必ず嘘をつく学生がいることがわかっている。
この女子大の学生(嘘つきかどうかは不明)から
「あなたのいうことが正しければ手コキかフェラをしてあげる、間違っていれば何もしてあげない」と言われた。
この女子大生にフェラをしてもらうには何と言えばいいか?
0854卵の名無しさん
垢版 |
2020/01/28(火) 19:47:42.30ID:xazq0gTe
ここは下品ないんたねっとですね

まさにこのスレはド底辺と呼ぶにふさわしいですねW
0855卵の名無しさん
垢版 |
2020/01/28(火) 20:34:26.25ID:vtD6D8ed
これで、
# 2x2のクロス表からstanを使ってMCMCサンプリングしてFisherテストしてp.valueの配列からその分布を表示させる

library(rstan)
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)

contingency2stan2pf <- function(mat,alpha=0.05,print=T){
N=apply(mat,1,sum)
data <- list(mat=mat,N=N)
stanModel=readRDS('contingency.rds')
fit=sampling(stanModel,data=data, chain=1, iter=25000,warmup=5000)
pars=c('y1','n1_y1','y0','n0_y0','d','RR','OR','NNT')
if(print) print(fit, pars=pars,digits=4,prob=c(0.025,0.5,0.975))
ms=rstan::extract(fit)
p.sim=NULL
for(i in 1:length(p11)){
MAT=round(with(ms,matrix(c(y1[i],n1_y1[i],y0[i],n0_y0[i]),ncol=2,byrow=TRUE)))
p.sim=append(p.sim,fisher.test(MAT)$p.value)
}
BEST::plotPost(p.sim,compVal = 0.05, xlab='p.value')
cat('Pr(p.value < ',alpha,') = ', mean(p.sim<alpha),'\n')
cat('Original p.value = ',fisher.test(mat)$p.value,'\n')
print(summary(p.sim))
invisible(p.sim)
}

サンプル数を増やしてpを小さくして信用させるという手法を見破れるかな。
0857卵の名無しさん
垢版 |
2020/01/28(火) 20:38:30.25ID:vtD6D8ed
> (mat.steroid=cbind(c(4,2),c(9,32)-c(4,2))) # ステロイドと死亡数
[,1] [,2]
[1,] 4 5
[2,] 2 30
> contingency2stan2pf(mat.steroid,p=F)

Pr(p.value < 0.05 ) = 0.7024
Original p.value = 0.01481455782
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.0000121509 0.0055484536 0.0148145578 0.0481260381 0.0611450791 1.0000000000
0858卵の名無しさん
垢版 |
2020/01/28(火) 21:01:49.02ID:vtD6D8ed
>>855
フィッシャー検定は非負整数しか許さないから、こんな感じで
https://i.imgur.com/b4musi9.jpg
グラフにすると途切れができてしまうのが美しくない。

χ二乗検定版を作ってみよう。
0859卵の名無しさん
垢版 |
2020/01/28(火) 21:03:52.80ID:IbKEPttD
国試浪人の素人童貞のスレはここですか?
0860卵の名無しさん
垢版 |
2020/01/28(火) 21:07:29.78ID:vtD6D8ed
>>858

# χ二乗テスト版
contingency2stan2pc <- function(mat,alpha=0.05,print=T){
N=apply(mat,1,sum)
data <- list(mat=mat,N=N)
stanModel=readRDS('contingency.rds')
fit=sampling(stanModel,data=data, chain=1, iter=25000,warmup=5000)
pars=c('y1','n1_y1','y0','n0_y0','d','RR','OR','NNT')
if(print) print(fit, pars=pars,digits=4,prob=c(0.025,0.5,0.975))
ms=rstan::extract(fit)
p.sim=NULL
for(i in 1:length(p11)){
MAT=with(ms,matrix(c(y1[i],n1_y1[i],y0[i],n0_y0[i]),ncol=2,byrow=TRUE))
p.sim=append(p.sim,chisq.test(MAT)$p.value)
}
BEST::plotPost(p.sim,compVal = 0.05, xlab='p.value')
cat('Pr(p.value < ',alpha,') = ', mean(p.sim<alpha),'\n')
cat('Original p.value = ',chisq.test(mat)$p.value,'\n')
print(summary(p.sim))
invisible(p.sim)
}
(mat.smoke=cbind(c(0,3),c(13,28)-c(0,3))) # 喫煙とICU入院のクロス表
contingency2stan2pc(mat.smoke,p=F)
(mat.steroid=cbind(c(4,2),c(9,32)-c(4,2))) # ステロイドと死亡数
p.sim=contingency2stan2pc(mat.steroid,p=F)
sapply(c(0.0001,0.001,0.01,0.05),function(x) mean(p.sim<x))
lines(density(p.sim))

この方が美しいな。
https://i.imgur.com/RBXeR57.jpg
0861卵の名無しさん
垢版 |
2020/01/28(火) 21:08:19.29ID:vtD6D8ed
>>859
これできないとフェラしてもらえないよ。

"某女子大には決して嘘をつかない学生と必ず嘘をつく学生がいることがわかっている。
この女子大の学生(嘘つきかどうかは不明)から
「あなたのいうことが正しければ手コキかフェラをしてあげる、間違っていれば何もしてあげない」と言われた。
この女子大生にフェラをしてもらうには何と言えばいいか?
0862卵の名無しさん
垢版 |
2020/01/28(火) 21:10:44.10ID:vtD6D8ed
人類の三大発明は

言語・貨幣・フェラチオである。

by 吉田戦車
0863卵の名無しさん
垢版 |
2020/01/28(火) 21:52:45.89ID:cUmejCEO
お兄ちゃん、イサキは、イサキは獲れたのっ?
0864卵の名無しさん
垢版 |
2020/01/28(火) 21:57:08.65ID:vtD6D8ed
比率の比較でなくて平均値の比較のときはp値の信頼区間算出はブートストラップを使えば簡単にだせるな。

知能指数が平均101と99の各々500人からなる集団の比較
# t検定(等分散)
T.test=function(n1,n2,m1,m2,sd1,sd2){
SE12=sqrt((1/n1+1/n2)*((n1-1)*sd1^2+(n2-1)*sd2^2)/((n1-1)+(n2-1)))
T=(m1-m2)/SE12
p.value=2*pt(abs(T),n1-1+n2-1,lower.tail = FALSE)
return(c(p.value=p.value,t.statistic=T))
}

n=500
a=99
b=101
A=a+scale(rnorm(n))*15
B=b+scale(rnorm(n))*15
T.test(n,n,a,b,15,15)
t.test(A,B,var=T)$p.value
sim <- function(x=n) t.test(sample(A,x,rep=T),sample(B,x,rep=T))$p.value
k=1e4
pv=replicate(k,sim())
summary(pv)
quantile(pv,prob=c(0.005,0.025,0.5,0.975,0.995))
BEST::plotPost(pv,compVal = 0.05,showMode = T,breaks=50)
0865卵の名無しさん
垢版 |
2020/01/28(火) 22:00:00.87ID:vtD6D8ed
>>863
釣り人(嘘つきかどうかは不明)から
「あなたのいうことが正しければイサキかイサキの餌のどちらかをあげる、間違っていれば何もあげない」と言われた。
この釣り人からイサキをもらうには何と言えばいいか?
0866卵の名無しさん
垢版 |
2020/01/29(水) 05:29:27.06ID:qmYv2xxr
少し一般化、復元抽出するか否かや個数が不均等でも計算できるように改変。

# 母集団Na,Nb個 平均Ma,Mb 標準偏差SDa,SDbからna,nbを抽出しt検定比較ときのp値の分布
pCI <- function(Na=500,Nb=Na,Ma=99,Mb=101,SDa=15,SDb=SDa,na=50,nb=na,
rep=FALSE,k=1e3,print=TRUE){
A=Ma+scale(rnorm(Na))*SDa
B=Mb+scale(rnorm(Nb))*SDb
sim <- function(m) t.test(sample(A,na,replace=rep),sample(B,nb,replace=rep))$p.value
pv=replicate(k,sim())
if(print){
print(T.test(n,n,a,b,15,15))
print(summary(pv))
BEST::plotPost(pv,compVal = 0.05,showMode = T,breaks=50)}
invisible(pv)
}
0867卵の名無しさん
垢版 |
2020/01/29(水) 05:46:52.67ID:qmYv2xxr
デフォルト設定では母集団から1/10の標本を抽出するように変更

# 母集団Na,Nb個 平均Ma,Mb 標準偏差SDa,SDbからna,nbを抽出しt検定比較ときのp値の分布
pCI <- function(Na=500,Nb=Na,Ma=99,Mb=101,SDa=15,SDb=SDa,na=Na/10,nb=Nb/10,
rep=FALSE,k=1e3,print=TRUE){
A=Ma+scale(rnorm(Na))*SDa
B=Mb+scale(rnorm(Nb))*SDb
sim <- function(m) t.test(sample(A,na,replace=rep),sample(B,nb,replace=rep))$p.value
pv=replicate(k,sim())
if(print){
print(t.test(A,B))
print(summary(pv))
BEST::plotPost(pv,compVal = 0.05,showMode = T,breaks=50)}
invisible(pv)
}
0868卵の名無しさん
垢版 |
2020/01/29(水) 05:53:26.38ID:qmYv2xxr
標準大学の新入生の知能指数の平均を100とする。
ド底辺シリツ医大の新入生の知能指数の平均が85であった。

各々から1/10を無作為抽出して知能指数をt検定したときのp値の期待値、中央値を求めよ。
また、p値が0.05以上になってド底辺シリツ医の新入生の知能指数は統計的に有意差はないと主張できる確率はいくらか?


# 母集団Na,Nb個 平均Ma,Mb 標準偏差SDa,SDbからna,nbを抽出しt検定比較ときのp値の分布
pCI <- function(Na=500,Nb=Na,Ma=99,Mb=101,SDa=15,SDb=SDa,na=Na/10,nb=Nb/10,
rep=FALSE,k=1e3,print=TRUE){ # IQ:m=100,sd=15
A=Ma+scale(rnorm(Na))*SDa
B=Mb+scale(rnorm(Nb))*SDb
sim <- function(m) t.test(sample(A,na,replace=rep),sample(B,nb,replace=rep))$p.value
pv=replicate(k,sim())
if(print){
print(t.test(A,B))
print(summary(pv))
BEST::plotPost(pv,compVal = 0.05,showMode = T,breaks=50)}
invisible(pv)
}

pCI(Na=100,Ma=100,Mb=85)
0869卵の名無しさん
垢版 |
2020/01/29(水) 05:56:48.55ID:qmYv2xxr
>>868
この手法で新薬の血中濃度は老人でも統計的に有意差はないので、安心して老人にも処方できます
という商用パンプを目にする。

底辺シリツ医=裏口容疑者はこういうのに騙されるんだよなぁ。
0870卵の名無しさん
垢版 |
2020/01/29(水) 07:45:56.70ID:qmYv2xxr
>>868
平均値100 標準偏差15で定義される知能指数で
標準大学の新入生の知能指数の平均が100
裏口シリツ医大の新入生の知能指数の平均が85であったとする。
1学年は100人として
各大学から1/10を無作為抽出して知能指数をt検定したときのp値の期待値、中央値を求めよ。
また、p値が0.05以上になって裏口シリツ医大の新入生の知能指数は統計的に有意差はないと主張できる確率はいくらか?
0871卵の名無しさん
垢版 |
2020/01/29(水) 10:58:46.40ID:wNUvDIoi
>>863
大漁っ!!イサキぃぃ!!おにいちゃんかっこいいいいぃぃぃい ぃくううううう!
0872卵の名無しさん
垢版 |
2020/01/29(水) 12:49:44.99ID:NU71nZE3
私立出身医が一番多いスレであろう「開業医が集うスレ」のほうには書き込みせんのな?
0873卵の名無しさん
垢版 |
2020/01/29(水) 15:37:18.14ID:qmYv2xxr
>>872
書いているよ。
開業医スレでもシリツは馬鹿にされているじゃん。

https://egg.5ch.net/test/read.cgi/hosp/1579579161/54

>>23
生データもある程度掲載されているから自分で統計処理が再現でいるな。
こういうのを考えてみると面白い。
Fisher testの結果が俺の計算と異なって気持ちが悪いままだが。

2019-nCov感染者41例中ICU収容13例(うち現喫煙者0),28例非収容(うち現喫煙者3)である。
このことから、煙草を吸うと重症化が防げると結論できるか?
0874卵の名無しさん
垢版 |
2020/01/29(水) 15:37:56.49ID:qmYv2xxr
>>871
そんなにレスじゃ、フェラもイサキも手に入れることはできんぞ。
0875卵の名無しさん
垢版 |
2020/01/29(水) 17:41:57.38ID:wNUvDIoi
では次の問題です
タバコは脳の病気です
この事実を証明せよ
https://togetter.com/li/1432976
0877卵の名無しさん
垢版 |
2020/01/29(水) 19:50:54.32ID:qmYv2xxr
>>872
俺が書かなくてもこういう投稿を目にする。
まあ、シリツ医という表記は俺の影響かもしれん。
自治医大とかを除外する意味で私立と書いていないわけだが。
>>
優秀な女子はぜひ国立医に入ってほしい
シリツ医は開業医のアホ子弟専用の専門学校
0878卵の名無しさん
垢版 |
2020/01/29(水) 21:34:38.87ID:wNUvDIoi
まあたしかに私立は学費が高いのは認める
わしも経済的理由で
合格した慶応は学費が高いので蹴って
地元イナカの国立にいった
0880卵の名無しさん
垢版 |
2020/01/30(木) 08:20:09.67ID:b9qEKmQr
>>879
イナカモノにしてみれば
地元以外のところに大学が存在しているという時点で
学費以外にもアパート代や食費などの参入障壁があるんだな
0881卵の名無しさん
垢版 |
2020/01/30(木) 08:31:17.69ID:17lSJR5q
>>880
シリツ医大専門受験予備校のバイトは一コマ90分で手取り2万円だったな。大学の授業料が年間14万4千円の頃の話。
地方にはそんな割のいいバイトはない。
0882卵の名無しさん
垢版 |
2020/01/30(木) 20:25:51.32ID:m/EdOA9B
Rで困ったらstackoveflow.comだな。

library(Rmpfr)

vect = rep(0, 5)

for(i in 1:5){
vect[i] = mpfr(x=10^-(10*i), precBits=100)
}
# My vector has just turned to a list
vect

# Sum of list is an error
sum(vect)


# Turn it to a vector
converted_vect = Rmpfr::mpfr2array(vect, dim = length(vect))
converted_vect

# Now my sum and prod work fine and the precision is not lost
sum(converted_vect)
prod(converted_vect)
0883卵の名無しさん
垢版 |
2020/01/30(木) 21:10:39.28ID:m/EdOA9B
パッケージの内部関数を使って解決してくれた。

The function mpfr2array is not suposed to be called by the user, it is an internal tool for the package. However it's one way to solve the problem.
0884卵の名無しさん
垢版 |
2020/01/30(木) 21:21:54.99ID:m/EdOA9B
Rはデフォルトでは不定長さ整数を扱えないので工夫がいる。
その点はpythonやHaskellの方が有利。

"
H(n) = Σ[k=1,2,...,n] 1/k
とする。H(n)を既約分数で表したときの分子の整数をf(n)と表す。
(1)lim[n→∞] H(n) を求めよ、答えのみで良い。
(2)n=1,2,...に対して、f(n)に現れる1桁の整数を全て求めよ
"
rm(list=ls())

H <- function(n,prec=1000){ # Σ 1/kを既約分数表示する
GCD <- function(a,b){  # ユークリッドの互除法
r = a%%b # a=bq+r ⇒ a%%b=b%%rで最大公約数表示
while(r!=0){a = b ; b = r ; r = a%%b}
b }
library(Rmpfr)
one = mpfr(1, prec) # 1(one)を1000桁精度に設定
nn = 1:n # nn : 1 2 3 ... n
nume=numeric(n) # 分子の容器
for(i in nn) nume[i] = prod(nn[-i])*one # nnからi番目の要素を除いて乗算し精度アップ
nume = mpfr2array(nume, dim = length(nume)) # mpfr2arrayで加算を可能にする
Nume = sum(nume) # numeの総和を計算して分子に
Deno = factorial(n)*one # 分母のn!を精度アップ
gcd = GCD(Nume,Deno) # Numerator/Denominator約分するため最大公約数を計算
res=list(nume = Nume/gcd,deno=Deno/gcd,ratio=as.numeric(Nume/Deno)) # 最大公約数で除算して
cat(as.numeric(res$nume),'/',as.numeric(res$deno),'\n') # 数値化して分数表示
invisible(res)
}
0885卵の名無しさん
垢版 |
2020/01/30(木) 23:51:43.56ID:m/EdOA9B
#Reed-Frost Model
ReedFrost=function(
p=0.04,
N=100,
T=40)
{
q=1-p
I=numeric(T)
S=numeric(T)
I[1]=1
S[1]=N-I[1]
for(t in 1:(T-1)){
I[t+1]=S[t]*(1-q^I[t])
S[t+1]=S[t]-I[t+1]
}

plot(1:T,I,type="l",lwd=2, ylim=c(0,N),xlab="time",ylab="persons",main=paste("Reed-Frost Model p= ",p))
lines(S,lty=2,col=2,lwd=2)
lines(N-S,lty=3,col=3,lwd=2)
legend("topright",bty="n",legend=c("Infected","Susceptible","Immunized"),lty=1:3,col=1:3,lwd=2)
}

par(mfrow=c(1,2))
ReedFrost(0.04)
ReedFrost(0.015)

ReedFrost(0.30)
ReedFrost(0.03)
ReedFrost(0.003)
0886卵の名無しさん
垢版 |
2020/01/30(木) 23:53:06.51ID:m/EdOA9B
こっちは、モンテカルロによるシミュレーション

# Reed-Frost and Greenwood epidemic models
# written by Dennis Chao (1/2009)

# reedfrost - the Reed-Frost epidemic model
# p = probability of transmission
# I0 = initial number of infecteds
# S0 = initial number of susceptibles
# n = number of trials
# greenwood = set to TRUE for the Greenwood model, otherwise run Reed-Frost
# outputs the number of infected and susceptibles over time (as I and S)
reedfrost <- function(p, I0, S0, n, greenwood=FALSE) {
S <- St <- rep(S0, n)
I <- It <- rep(I0, n)
q <- 1-p

time <- 0
while (sum(It)>0) {
if (greenwood)
It <- rbinom(n, St, ifelse(It>0, p, 0))
else
It <- rbinom(n, St, 1-(q^It))
St <- St-It
I <- rbind(I, It)
S <- rbind(S, St)
time <- time+1
}
I <- as.matrix(I)
S <- as.matrix(S)
list(I0=I0,S0=S0,p=p,n=n,I=I,S=S)
}
0887卵の名無しさん
垢版 |
2020/01/31(金) 00:59:52.85ID:24QiZJ0Y
f <- function(n,prec=1000){ # Σ 1/kを既約分数表示する
if(n==1){
cat(1,'\n')
invisible(1)
}else{
GCD <- function(a,b){  # ユークリッドの互除法
r = a%%b # a=bq+r ⇒ a%%b=b%%rで最大公約数表示
while(r!=0){a = b ; b = r ; r = a%%b}
b }
library(Rmpfr)
one = mpfr(1, prec) # 1(one)を1000桁精度に設定
nn = 1:n # nn : 1 2 3 ... n
nume=numeric(n) # 分子の容器
for(i in nn) nume[i] = prod(nn[-i])*one # nnからi番目の要素を除いて乗算し精度アップ
nume = mpfr2array(nume, dim = length(nume)) # mpfr2arrayで加算を可能にする
Nume = sum(nume) # numeの総和を計算して分子に
Deno=factorialZ(n) # 分母 n! = factorial(n*one)
gcd = GCD(Nume,Deno) # Numerator/Denominator約分するため最大公約数を計算
res=list(nume = Nume/gcd,deno=Deno/gcd,ratio=as.numeric(Nume/Deno)) # 最大公約数で除算して
 # 分数表示 give.head=FALSEでheader除去,digits.dで桁数を指定
# capture.outputで変数に取り込み
nm = capture.output(str(res$nume, give.head=FALSE,digits.d = prec))
dn = capture.output(str(res$deno, give.head=FALSE,digits.d = prec))
cat(paste0(nm,'/',dn,'\n'))
invisible(res)
}}
for(i in 1:30) f(i)
0888卵の名無しさん
垢版 |
2020/01/31(金) 01:00:30.29ID:24QiZJ0Y
> for(i in 1:30) f(i)
1
3 / 2
11 / 6
25 / 12
137 / 60
49 / 20
363 / 140
761 / 280
7129 / 2520
7381 / 2520
83711 / 27720
86021 / 27720
1145993 / 360360
1171733 / 360360
1195757 / 360360
2436559 / 720720
42142223 / 12252240
14274301 / 4084080
275295799 / 77597520
55835135 / 15519504
18858053 / 5173168
19093197 / 5173168
122755644038509457 / 32872539188238750
186187999757029099 / 49308808782358125
14112026408124257248 / 3698160658676859375
185305423634953775872 / 48076088562799171875
5051322526706550956032 / 1298054391195577640625
11894590428248250515456 / 3028793579456347828125
1043915747995966839455744 / 263505041412702261046875
2255784105806550548873216 / 564653660170076273671875
0889卵の名無しさん
垢版 |
2020/01/31(金) 01:12:13.74ID:24QiZJ0Y
>>884
H(n) = Σ[k=1,2,...,n] 1/k
とする。H(n)を既約分数で表したときの分子の整数をf(n)と表す。
f(77)を求めよ。

> f(77)
17610982920730618962802441030965952272844514966520010106103127939813509744122599441432576
/ 3574019481870823559764745233429885438685864430565417716720215849457565210956573486328125
0891卵の名無しさん
垢版 |
2020/01/31(金) 07:15:08.03ID:24QiZJ0Y
f <− function(n,prec=10000){ # Σ 1/kを既約分数表示する
  if(n==1){
    cat(V V,1,V\nV)
    invisible(1)
  }else{
   GCD <− function(a,b){  # ユークリッドの互除法 
    r = a%%b               # a=bq+r ⇒ a%%b=b%%rで最大公約数表示
    while(r!=0){a = b ; b = r ; r = a%%b}
    b }
0892卵の名無しさん
垢版 |
2020/01/31(金) 07:15:14.10ID:24QiZJ0Y
  library(Rmpfr)
  one = mpfr(1, prec) # 1(one)を10000桁精度に設定
  nn = 1:n            # nn : 1 2 3 ... n
  nume=numeric(n)     # 分子の容器
  for(i in nn) nume[i] = prod(nn[−i])*one # nnからi番目の要素を除いて乗算し精度アップ
  nume = mpfr2array(nume, dim = length(nume)) # mpfr2arrayで加算を可能にする
  Nume = sum(nume) # numeの総和を計算して分子に
  Deno=factorialZ(n) # 分母 n! = factorial(n*one)
  gcd = GCD(Nume,Deno) # Numerator/Denominator約分するため最大公約数を計算
  res=list(nume = Nume/gcd,deno=Deno/gcd,ratio=as.numeric(Nume/Deno)) # 最大公約数で除算して
  # 分数表示 give.head=FALSEでheader除去,digits.dで桁数を指定
  # capture.outputで切り取りsubstrで[1]を除去
  # nm = capture.output(str(res$nume, give.head=FALSE,digits.d = prec)) NAが混ざるバグあり
  nm =substr(capture.output(res$nume)[2],5,nchar(res$nume)) # W[1] 1234..W 文字列の5文字目から最後まで
  dn =substr(capture.output(res$deno)[2],5,nchar(res$deno))
  cat(paste0(nm,V/V,dn,V\nV))
  invisible(res)
}}
0893卵の名無しさん
垢版 |
2020/01/31(金) 07:15:42.75ID:24QiZJ0Y
> f(100)
3055216077446868329553816926933899676639525195878807877583434152044192757431459126874725081455196840519615954410565802448075620352
/ 588971222367687651371627846346807888288472382883312574253249804256440585603406374176100610302040933304083276457607746124267578125
0894卵の名無しさん
垢版 |
2020/01/31(金) 07:45:49.87ID:24QiZJ0Y
Reed-Frost モデル

(1) 集団内の感染者と感受性のあるものとの接触はランダムに起こる
(2) 感染者と感受性のあるものが接触して伝播する確率は一定である
(3) 感染のあと必ず免疫が起こる(再感染はしない)
(4) その集団は他の集団から隔離されている
(5) 上記の条件は各時間経過中一定である

ReedFrost=function(
p=0.04, # 1期間内での伝播確率
N=100, # 集団の人数
T=40) # 全期間
{
q=1-p # 伝播させない確率
I=numeric(T) # 感染者数 Infecteds
S=numeric(T) # 感受性のある人数 Susceptibles
I[1]=1 #一人から始まったとする
S[1]=N-I[1]
for(t in 1:(T-1)){
I[t+1]=S[t]*(1-q^I[t]) # Reed-Frost Model
S[t+1]=S[t]-I[t+1]
}
return(list(I,T))
}
0895卵の名無しさん
垢版 |
2020/01/31(金) 11:25:54.82ID:24QiZJ0Y
# simulation model using binominal random number
rm(list=ls())
reedfrost <- function(p, I0, S0, n, greenwood=FALSE) {
S <- St <- rep(S0, n) # St : Suscepibles @ time t, S:
I <- It <- rep(I0, n) # It : Infected @ time t
q <- 1-p # probability of non-transmission

time <- 0
while (sum(It)>0) { # until no new transmission
if (greenwood)
It <- rbinom(n, St, ifelse(It>0, p, 0))
else
It <- rbinom(n, St, 1-(q^It)) # how many ppl newly trannsmitted among St
St <- St-It # how many ppl left non-infected
I <- rbind(I, It)
S <- rbind(S, St)
time <- time+1
}
Inames=NULL
for(i in 0:(nrow(I)-1)) Inames[i+1]=paste0('I',i)
rownames(I)=Inames
Snames=NULL
for(i in 0:(nrow(I)-1)) Snames[i+1]=paste0('S',i)
rownames(S)=Snames
list(I0=I0,S0=S0,p=p,n=n,I=I,S=S)
}
re=reedfrost(0.05,1,99,100)
nr=nrow(re$I)
plot(0:(nr-1),re$I[,1],bty='l',type='l',lwd=2,
ylim=c(0,max(re$I)),xlab='time',ylab='Infecteds')
for(i in 2:n) lines(0:(nr-1),re$I[,i],lwd=2,col=sample(colours()))
0896卵の名無しさん
垢版 |
2020/01/31(金) 15:00:17.56ID:24QiZJ0Y
# SEIR MODEL
"
dS(t)/dt=-bS(t)I(t),
dE(t)/dt=bS(t)I(t)-aE(t) ,
dI(t)/dt=aE(t)-gI(t) ,
dR(t)/dt=gI(t)
a:発症率,b:感染率,g:回復率
"
remove (list = objects() )
graphics.off()

SEIR <- function(
# Parameters
contact_rate = 10, # number of contacts per day
transmission_probability = 0.07, # transmission probability
infectious_period = 5, # infectious period
latent_period = 2, # latent period
# Initial values for sub-populations.
s = 9990, # susceptible hosts
e = 9, # exposed hosts
i = 1, # infectious hosts
r = 0, # recovered hosts
# Output timepoints.
timepoints = seq (0, 100, by=0.5)
){
0897卵の名無しさん
垢版 |
2020/01/31(金) 15:00:39.55ID:24QiZJ0Y
library(deSolve)
# Function to compute derivatives of the differential equations.
seir_model = function (current_timepoint, state_values, parameters)
{
# create state variables (local variables)
S = state_values [1] # susceptibles
E = state_values [2] # exposed
I = state_values [3] # infectious
R = state_values [4] # recovered

with (
as.list (parameters), # variable names within parameters can be used
{
# compute derivatives
dS = (-beta * S * I)
dE = (beta * S * I) - (delta * E)
dI = (delta * E) - (gamma * I)
dR = (gamma * I)

# combine results
results = c (dS, dE, dI, dR)
list (results)
}
)
}

# Compute values of beta (tranmission rate) and gamma (recovery rate).
beta_value = contact_rate * transmission_probability
gamma_value = 1 / infectious_period
delta_value = 1 / latent_period
0898卵の名無しさん
垢版 |
2020/01/31(金) 15:00:45.24ID:24QiZJ0Y
# Compute Ro - Reproductive number.
Ro = beta_value / gamma_value

# Disease dynamics parameters.
parameter_list = c (beta = beta_value, gamma = gamma_value, delta = delta_value)

# Compute total population.
N = s + i + r + e

# Initial state values for the differential equations.
initial_values = c (S = s/N, E = e/N, I = i/N, R = r/N)

# Simulate the SEIR epidemic.
# ?lsoda # Solver for Ordinary Differential Equations (ODE), Switching Automatically Between Stiff and Non-stiff Methods
output = lsoda (initial_values, timepoints, seir_model, parameter_list)

# Plot dynamics of Susceptibles sub-population.
plot (S ~ time, data = output, pch='S', type='b', col = 'blue', bty='l', cex=0.75,
ylab='SEIR')
points(E ~ time, data = output, pch='E', type='b', col = 'yellow', cex=0.75)
points(I ~ time, data = output, pch='I', type='b', col = 'red', cex=0.75)
points(R ~ time, data = output, pch='R', type='b', col = 'green', cex=0.75)
}

SEIR()
args(SEIR)
SEIR(contact_rate=0.5,transmission_probability=0.05,infectious_period=365,latent_period=7,s=99,e=0,i=1,r=0,timepoints = 0:365*6)
0899卵の名無しさん
垢版 |
2020/01/31(金) 17:42:44.66ID:24QiZJ0Y
エンデミックな定常状態を(S?, I?)とおけば、S?N=1R0,I?N=μμ+γ(1?1R0)(15)である。すなわちエンデミックな状態における感受性人口比率と基本再生産数は逆数関係にあり、有病率(prevalence)I?/Nは1?1/R0に比例していて、その比例係数は、感染状態における平均滞在時間1/(μ+γ)とホストの寿命1/μの比である。これらの式はエンデミックな感染症におけるR0の推定式ともみなせる
0900卵の名無しさん
垢版 |
2020/01/31(金) 17:45:07.01ID:24QiZJ0Y
Rv?1という条件はワクチン接種率の条件として書き直せばv?1?1R0=H
0901卵の名無しさん
垢版 |
2020/02/01(土) 15:12:17.98ID:hIisy8jC
H(n) = Σ[k=1,2,...,n] 1/k
とする。H(n)を既約分数で表したときの分子の整数をf(n)と表す。
(1)lim[n→∞] H(n) を求めよ、答えのみで良い。
(2)n=1,2,...に対して、f(n)に現れる1桁の整数を全て求めよ
"
H <- function(n) sum(1/(1:n))
plot(sapply(1:1000,H),bty='l')

f <- function(n,prec=10000){ # Σ 1/kを既約分数表示する n>>=23で誤計算
if(n==1){
cat(n, ':' ,1,'\n')
invisible(1)
}else{
GCD <- function(a,b){  # ユークリッドの互除法
r = a%%b # a=bq+r ⇒ a%%b=b%%rで最大公約数表示
while(r!=0){a = b ; b = r ; r = a%%b}
b }
nn = 1:n # nn : 1 2 3 ... n
nume=list() # 分子の容器
length(nume)=n
Nume=0
library(gmp)
for(i in nn) Nume = Nume + prod.bigz(nn[-i]) # nnからi番目の要素を除いて乗算して総和を分子に
Deno=factorialZ(n) # 分母
gcd = GCD(Nume,Deno) # Numerator/Denominator約分するため最大公約数を計算
NUME=Nume/gcd
DENO=Deno/gcd
ratio=as.numeric(Nume/Deno)
RE=list(NUME,DENO,ratio) # 最大公約数で除算して約分
cat(n, ':' ,as.character(NUME),'/',as.character(DENO),'\n')
invisible(RE)
}}
0902卵の名無しさん
垢版 |
2020/02/01(土) 22:05:31.53ID:hIisy8jC
H(n) = Σ[k=1,2,...,n] 1/k
とする。H(n)を既約分数で表したときの分子の整数をf(n)と表す。

f <- function(n){ # Σ 1/kを既約分数表示する
if(n==1){
cat(n, ':' ,1,'\n')
invisible(1)
}else{
GCD <- function(a,b){  # ユークリッドの互除法
r = a%%b # a=bq+r ⇒ a%%b=b%%rで最大公約数表示
while(r!=0){a = b ; b = r ; r = a%%b}
b }
nn = 1:n # nn : 1 2 3 ... n
nume=list() # 分子の容器となるlist
length(nume)=n # を設定
Nume=0
library(gmp)
for(i in nn) Nume = Nume + prod.bigz(nn[-i]) # nnからi番目の要素を除いて乗算して総和を分子に
Deno=factorialZ(n) # 分母
gcd = GCD(Nume,Deno) # 約分するため最大公約数を計算
NUME=Nume/gcd
DENO=Deno/gcd
ratio=as.numeric(Nume/Deno)
RE=list(NUME,DENO,ratio)
cat(n, ':' ,as.character(NUME),'/',as.character(DENO),'\n')
invisible(RE)
}}
0903卵の名無しさん
垢版 |
2020/02/02(日) 13:53:23.64ID:+5dNqMpE
tbl <- function(x,v){ # vの要素がxにいくつあるか集計する
n=length(v)
hme=numeric(n) # how many entries?
for(i in 1:n) hme[i]=sum(x==v[i])
rbind(v,hme)
}

tbl(sample(10,rep=T),1:10)
0904卵の名無しさん
垢版 |
2020/02/04(火) 16:35:57.11ID:b64IHQrg
"https://this.kiji.is/597220008571339873?c=39550187727945729
中国湖北省武漢市からチャーター機で日本へ帰国した邦人の新型コロナウイルス感染率が高いと、
中国で驚きの声が上がっている。中国当局が発表した同市の感染者の割合に比べ「39倍も高い」というのだ。
現地は医療現場が混乱しているため、実際には発表よりかなり多くの感染者がいる可能性がある。
日本政府はチャーター機計3便を武漢市に派遣し、邦人565人が帰国した。厚生労働省によると、
チャーター機に乗っていた感染者は、症状のない人も含め計8人。感染率は1.416%だ。
一方、1月31日現在、武漢市の感染者数は3215人で、感染率は0.036%にとどまった。"
r1=8
r2=3215
n1=565
n2=round(3215/(0.036/100))
poisson.test(c(r1,r2),c(n1,n2))
prop.test(c(r1,r2),c(n1,n2))
library(BayesFactor)
mat=cbind(c(r1,r2),c(n1,n2)-c(r1,r2))
fisher.test(mat)
chisq.test(mat)$p.value
bf=BayesFactor::contingencyTableBF(mat,sampleType = 'poisson',posterior = TRUE,iteration=1e5)
rbf=round(bf)
(r1/n1)/(r2/n2)
frp <- function(x) (x[1]/(x[1]+x[2]))/ (x[3]/(x[3]+x[4]))
rrp=apply(rbf,1,frp)
hist(rrp)
BEST::plotPost(rrp)
(r1/(n1-r1))/(r2/(n2-r2))
fop <- function(x) (x[1]/x[2])/ (x[3]/x[4])
orp=apply(rbf,1,fop)
BEST::plotPost(orp)
quantile(orp,c(0.005,0.025,0.5,0.975,0.995))
library(exact2x2)
exact2x2::fisher.exact(mat)
fisher.test(mat)
0905卵の名無しさん
垢版 |
2020/02/04(火) 16:57:56.53ID:b64IHQrg
# Reed-Frost Model 時刻t+1での感染者数=時刻tでの感受性人数*(少なくとも一人の感染者がでる確率)
# p=0.04;N=100;I0=1;T=8
ReedFrost=function(
p=8/565, # 1期間内での伝播確率
N=565, # 集団の人数
I0=8, # 最初の感染者数
T=30, # 全期間
print=TRUE # グラフ表示
)
{
q=1-p # 伝播させない確率
I=numeric(T) # 感染者数 newly Infecteds
S=numeric(T) # 感受性のある人数 Susceptibles
I[1]=I0 # I0人から始まったとする
S[1]=N-I[1]
for(t in 1:(T-1)){
I[t+1]=S[t]*(1-q^I[t]) # Reed-Frost Model
S[t+1]=S[t]-I[t+1]
}
if(print){
plot(1:T,I,type='b',pch=19,lwd=2, ylim=c(0,N),bty='l',
xlab="time",ylab="persons",main=paste("Reed-Frost Model p= ",round(p,3)))
points(S,lty=2,col=2,lwd=2,type='b',pch=19)
points(N-S,lty=3,col=3,lwd=2,type='b',pch=19)
legend("right",bty="n",legend=c("New Infection","Susceptible","Immunized"),lty=1:3,col=1:3,lwd=2)}
list(newly_infecteds=round(I),susceptibles=round(S))
}
ReedFrost(T=7)
0906卵の名無しさん
垢版 |
2020/02/06(木) 22:51:49.26ID:WriFO9uC
"厚生労働省によりますと、新型コロナウイルスに感染した香港の男性が乗っていたクルーズ船で、
症状がみられる人やその濃厚接触者などにウイルス検査を実施した結果、10人が感染していたことが新たに確認されました。
これまでにこのクルーズ船の乗員乗客で感染が確認されたのは、合わせて20人です。

厚生労働省によりますと、クルーズ船「ダイヤモンド・プリンセス」の船内では
乗客と乗組員全員の合わせて3700人余りの検疫が行われ、発熱やせきなどの症状があった120人と、
症状がある人と濃厚接触した153人の合わせて273人から検体を採取して順次、ウイルス検査を実施しています。
6日、新たに71人分の結果が判明しこのうち10人がウイルスに感染していたことが確認されました。
"

NN=3700

N=273
n=71
r=10

(re=binom::binom.confint(r,n,conf=0.95))
cbind(re[,1],re[,5:6]*N)



library(BayesFactor)
(mat=cbind(c(r,r),c(n-r,n-r)))
bf=BayesFactor::proportionBF(r,n,r/n,posterior = TRUE,iterations=10000)
plot(bf)
head(bf)
infct=bf[,'p']*N
summary(infct)
BEST::plotPost(N*bf[,2],credMass = 0.95)
0908卵の名無しさん
垢版 |
2020/02/12(水) 15:41:37.89ID:6n8f5vvH
日本最高学費の底辺私立医大では

1年:進級失敗10人
2年:進級失敗16人
3年:進級失敗34人
4年:進級失敗9人
5年:進級失敗10人
6年:卒業失敗26人

一学年約120〜130人前後。
同じ学年で二回留年すると退学
https://mao.5ch.net/test/read.cgi/doctor/1516439331/1
であるという。

1年次学費総額 12,145,000円 2年次以降学費(年間) 7,030,000円

1学年を125人として上記データから算出した確率(例、1年次は10/125の確率で留年)を用いて

卒業できる確率と卒業生の在学年数の期待値を求めよ。
また、退学になる確率と退学者の在学年数の期待値を求めよ。
0909卵の名無しさん
垢版 |
2020/02/12(水) 15:41:57.91ID:6n8f5vvH
(p=1-c(10,16,34,9,10,26)/125)
q=1-p # 留年確率
(P=prod(1-q^2)) # 卒業できる確率 Π( 1 - 2年連続留年確率)
(Q=1-P) # 退学となる確率

p1=p # 各学年を1年で進級する確率
p2=p*(1-p) # 各学年を2年で進級する確率
P12=rbind(p1,p2)
gr=expand.grid(1:2,1:2,1:2,1:2,1:2,1:2) # 6学年の組み合わせdata.frame
years=apply(gr,1,sum) # 各組合せでの在学年数
dat=cbind(gr,years)
dat=as.matrix(dat) # data.frameを行列化
f <- function(x){ # 1~6年次の進級にかかった年数の配列xからその確率を返す
ps=1 # 進学確率
for(i in 1:6){ # 各組合せでの通算確率を算出
ps=ps*P12[x[i],i]
}
return(ps) # 卒業確率(入学してからその組合せで卒業できる確率)
}
Ps=apply(dat,1,f) # 組合わせ候補にfを適用 Probability of success
data=cbind(dat,Ps) # dat[,7]:入学してからの確率 dat[,8]:在学年数
# 在学年数の期待値
sum(data[,7]*data[,8])/sum(Ps)  # 期待値=Σxi*PiでΣPi=1でなくてはならないのでsum(Ps)で除算

# 退学
q=c(10,16,34,9,10,26)/125
Q=numeric(6)
Q[1]=q[1]^2 # 1年次で退学
Q[2]=q[2]^2 *(1- Q[1]) # 2年次で退学

for(i in 2:6){
Q[i]=q[i]^2 * (1-Q[i-1])
}
sum((1:6)*Q)/sum(Q)
0910卵の名無しさん
垢版 |
2020/02/12(水) 15:42:45.68ID:6n8f5vvH
ko=vector('list',6) # kicked out 退学までの軌跡
a=1:2  # 1:1回で進級,2:1回留年して翌年進級
ko[[1]]=as.matrix(2) # 1年時で退学
ko[[2]]=as.matrix(expand.grid(a,2)) # 2年時で退学の軌跡
ko[[3]]=as.matrix(expand.grid(a,a,2)) # 3年次で退学の軌跡
ko[[4]]=as.matrix(expand.grid(a,a,a,2))
ko[[5]]=as.matrix(expand.grid(a,a,a,a,2))
ko[[6]]=as.matrix(expand.grid(a,a,a,a,a,2))
f <- function(x){ # 軌跡与えてその確率(入学からの確率なので総和が退学確率Qに等しい)
n=length(x)
if(n==1) return(q[1]^2)
Pf=1
for(i in 1:(n-1)) Pf=Pf*P12[x[i],i]
return(Pf*q[n]^2)
}

Ef=numeric(6) # i年次退学する時の在学年数期待値(Qで除算が必要)
for(i in 1:6){
pf=apply(ko[[i]],1,f) # i年次で退学する場合の軌跡での確率
nf=apply(ko[[i]],1,sum) # その軌跡での在学年数
Ef[i]=sum(pf*nf)
}
sum(Ef)/Q
0911卵の名無しさん
垢版 |
2020/02/12(水) 15:43:16.39ID:6n8f5vvH
日本最高学費の底辺私立医大では

1年:進級失敗10人
2年:進級失敗16人
3年:進級失敗34人
4年:進級失敗9人
5年:進級失敗10人
6年:卒業失敗26人

一学年約120〜130人前後。
同じ学年で二回留年すると退学
https://mao.5ch.net/test/read.cgi/doctor/1516439331/1
であるという。

1年次学費総額 12,145,000円 2年次以降学費(年間) 7,030,000円


父兄から 同じ学年で二回留年すると退学というルールは厳しすぎる、

これを撤廃して、最長12年までは在学可能とすべきだという提言がなされたとする

この提言を採用した場合、

1学年を125人として上記データから算出した確率(例、1年次は10/125の確率で留年)を用いて

卒業できる確率と卒業生の在学年数の期待値を求めよ。

また、退学になる確率と退学者の在学年数の期待値を求めよ。
0912
垢版 |
2020/02/12(水) 20:50:03.53ID:dWksx8Sa
こんな凄いスレッドあったんですね、読み返してみます、
0913卵の名無しさん
垢版 |
2020/02/12(水) 21:02:12.30ID:iCMxhp27
ここは国試浪人の事務員のスレ
0915卵の名無しさん
垢版 |
2020/02/12(水) 22:17:18.73ID:6n8f5vvH
>>911
まず、シミュレーションプログラムを作る。

p=1-c(10,16,34,9,10,26)/125 #進級確率
q=1-p
sim <- function(){
g=1 # 学年,7:卒業
y=0 # 在学年数
while(g<7 & y<12){
g=g+sample(1:0,1,prob=c(p[g],q[g]))
y=y+1
}
c(g,y)
}
k=1e3
replicate(k,,sim())
0916卵の名無しさん
垢版 |
2020/02/13(木) 13:57:25.59ID:DpKqMtsQ
p=1-c(10,16,34,9,10,26)/125 #進級確率
q=1-p
sim <- function(){
g=1 # 学年,7:卒業
y=0 # 在学年数
while(g<7 & y<12){ # 卒業前、在学12年未満なら
g=g+sample(1:0,1,prob=c(p[g],q[g])) # 進級判定して
y=y+1 # 在学年数を増やす
}
c(g,y) # 学年と在学年数を返す
}
k=1e6
RE=t(replicate(k,sim()))
head(RE)
summary(RE)
R12=RE[RE[,2]==12,] # 12年在学
nrow(R12[R12[,1]<7,])/k # 退学確率
0917卵の名無しさん
垢版 |
2020/02/13(木) 13:58:30.33ID:DpKqMtsQ
> nrow(R12[R12[,1]<7,])/k # 退学確率
[1] 0.001039
0918卵の名無しさん
垢版 |
2020/02/13(木) 21:06:00.75ID:DpKqMtsQ
p=1-c(10,16,34,9,10,26)/125 # 進級確率
q=1-p # 留年確率
p6=prod(p) # 6年で卒業確率
f <- function(x) prod(q[x])
pf=c(6,p6)
for(i in 7:12){
cmb=combinations(6,i-6,rep=T)
pf=rbind(pf,c(i,p6*sum(apply(cmb,1,f))))
}
pf
(P=sum(pf[,2]))# 12年以内に卒業できる確率
sum(pf[,1]*pf[,2])/P # 卒業までの平均在学年数
0919卵の名無しさん
垢版 |
2020/02/14(金) 01:05:55.44ID:9rZr8ZNE
library(gtools)
p=1-c(10,16,34,9,10,26)/125 # 進級確率
q=1-p # 留年確率
p6=prod(p) # 6年で卒業確率
f <- function(x) prod(q[x]) # x:留年学年の配列→その組合せでの確率
pf=c(6,p6) # 在学年数,その確率
for(i in 7:12){#在学年数i 7~12において
cmb=combinations(6,i-6,rep=T) # 1:6から留年学年の組合せi-6個を重複を許して選ぶ
pf=rbind(pf,c(i,p6*sum(apply(cmb,1,f)))) #その組合せでの確率の総和に6年分の進級確率を乗ずる
}

(P=sum(pf[,2]))# 12年以内に卒業できる確率
(yg=sum(pf[,1]*pf[,2])/P) # 卒業までの平均在学年数 Σ x*pdf
(Q=1-P) # 退学確率
P*yg+Q*12 # # 大学を出る(卒業もしくは退学)を平均年数
0920卵の名無しさん
垢版 |
2020/02/14(金) 01:13:37.89ID:9rZr8ZNE
理論値
> (yg=sum(pf[,1]*pf[,2])/P) # 卒業までの平均在学年数 Σ x*pdf
[1] 7.027985

シミュレーション値
> mean(R7[,2]) # 卒業生の在学年数
[1] 7.027643

合致しているから、どちらも正しそう。
0921卵の名無しさん
垢版 |
2020/02/14(金) 18:43:07.48ID:x9TXrlfR
思えば東京に住んでる奴はそれだけで経済的に優遇されてるな

田舎に住んでる貧乏人は学力があっても地元国立一択だったり
学力があっても就職コースだったりするからなぁ
0922卵の名無しさん
垢版 |
2020/02/14(金) 20:30:31.44ID:9rZr8ZNE
>>921
東京で地元の国立に進学するのは容易ではないと思う。
0923卵の名無しさん
垢版 |
2020/02/14(金) 20:33:12.20ID:9rZr8ZNE
>>919
この問題は数学板に投稿してもプログラムの練習にしかならんな。
0924卵の名無しさん
垢版 |
2020/02/14(金) 22:03:29.56ID:wJciaHaO
難し、ネットで医療統計のページ見つけたが、
エクセルシートが出てくるだけだし、χ2検定だけでも
俺みたいなのに判るように解説してほしい、
MRが言う当社の薬剤は他のよりも優れていない確率は5%
って言うのはホントなんだろうか?違うよね
0925卵の名無しさん
垢版 |
2020/02/15(土) 07:37:08.29ID:6ICubIld
>>924
Χ2乗検定が知りたいのか
p値で判定することの欺瞞性を知りたいのか
非劣性検定の問題点を知りたいのか
どれ?
0926卵の名無しさん
垢版 |
2020/02/15(土) 15:24:15.01ID:BqM3deVD
具体的にはグーフィス(持田)の製品紹介にある
グーフィスはプラセボ群に比して有意に大きな値をしめしました(p<0.0001共分散解析)  
 次行にはほぼ同じ文面で同じ数字でFisherの正確検定
 更にしたには          Wilconxonの順位和検定とあります
なんのことやら、 
0927卵の名無しさん
垢版 |
2020/02/15(土) 16:05:12.72ID:9KqLKmld
分散分析は郡内分散と群間分散の比がF分布に従うことをつかった検定。
(この比をF ratioというのが色っぽいw)
統計の教科書読めばFisherもWilcoxonも載っているから独習してください。

頻度主義統計を理解する前に、
p値で判定することの欺瞞性や非劣性検定の問題点を論じても混乱するだけだと思います。
0928卵の名無しさん
垢版 |
2020/02/15(土) 19:46:00.83ID:9KqLKmld
新型コロナウイルスが新たに67人で陽性であった。
検査可能数を100~1000と仮定したときの検査数の期待値と95%信頼区間を求めよ

"



f <- function(N,conf=0.95,print=FALSE){
# N=100 ; conf=0.95
m=1
r=67
n=r:N
pmf=choose(r-1,m-1)/choose(n,m) #Pr(max=60|n)
# plot(n,pmf,ylab='probability',bty='l')
pdf=pmf/sum (pmf)
if(print) plot(n,pdf,ylab='density',type='h',bty='l')
E=sum(n*pdf) #E(n)
cdf=cumsum(pdf)
Lidx=which.min(abs(cdf-(1-conf)/2))
Uidx=which.min(abs(cdf-(1-(1-conf)/2)))
return(c(E=E,L=n[Lidx],U=n[Uidx]))
}

N=seq(100,1000,by=50)
RE=as.matrix(sapply(N,f))
RE
plot(N,RE[1,],bty='l',pch=19,ylim=c(0,1000),xlab='上限件数',ylab='推定件数')
segments(x0=N,y0=RE[2,],x1=N,y1=RE[3,])
0929卵の名無しさん
垢版 |
2020/02/16(日) 08:15:55.98ID:dI8Llzzn
コロナ患者はおことわり

当たり前だよなぁ

普通の病院に来られても検査はできん

医師なら当然知ってることだ
0930卵の名無しさん
垢版 |
2020/02/18(火) 12:09:44.51ID:OUmetWs8
製薬会社の社員って基本的に自社製品の宣伝しかしないよね
金儲けのため病院訪問してんだから当たり前かも知らんが

コンプ薬屋クンとかサラリーマン時代はどんな営業してたのかねぇ?
0931卵の名無しさん
垢版 |
2020/02/18(火) 19:48:55.89ID:OUmetWs8
人生に失敗してる奴ほど反日野党に肩入れするよねW
0932卵の名無しさん
垢版 |
2020/02/18(火) 19:53:12.59ID:Zlyy45UZ
binom::binom.bayes(4,4,prior.shape1=1,prior.shape2 = 1)
curve(dbeta(x,5,1),bty='l')
options(digits=22)
pbeta(0.01,5,1)
binom::binom.bayes(4,4)
curve(dbeta(x,4.5,0.5),bty='l')
pbeta(0.01,4.5,0.5)
0933卵の名無しさん
垢版 |
2020/02/18(火) 19:54:51.09ID:Zlyy45UZ
トップ為政者がどんなに私的な放蕩や汚職等の悪行を重ねても、国の危機には民の命を第一に守るという最低限の義務を放棄しない限りは支持され続ける、アベはそれをあっさりと放棄した。
0934卵の名無しさん
垢版 |
2020/02/18(火) 20:07:46.28ID:Zlyy45UZ
日本の領土、日本民族、そして日本語をもっとも破壊している反日勢力が安倍なんだが。
0935卵の名無しさん
垢版 |
2020/02/19(水) 13:39:37.63ID:PmndJ4fY
はいはい ワロスワロスW
0938卵の名無しさん
垢版 |
2020/02/20(木) 18:44:21.33ID:i8qqM3yt
お兄ちゃん、イサキは釣れたのっ?
0939卵の名無しさん
垢版 |
2020/02/24(月) 08:53:05.25ID:TQ/flAIX
おーい国試浪人 および コンプ薬屋
お前らのスレはここだ

他スレを荒らすんじゃないぞ
0940卵の名無しさん
垢版 |
2020/02/24(月) 19:15:49.10ID:x/xpTJWO
一辺10[m]の正方形ABCDのプールがある
点Dでは水が湧き出しており、点Dからr[m]離れた場所では(r/10)[m/s]までのスピードでしか泳げない

点Aから正方形の中心まで泳ぐのに掛かる最短時間を求めよ


極座標の曲線r=f(θ), 10=f(-π/2), 5√2=f(-π/4)上を泳ぐ時間は
T(f)=10∫[-π/2,-π/4]√(1+(f'(θ)/f(θ))^2)dθ
δT(f)=0に対するオイラーラグランジュの方程式は
-(f'/f)^2/(f√(1+(f'/f)^2))-(d/dθ)((f'/f)/(f√(1+(f'/f)^2)))=0
整理すると
(f'^2-f''f)(f^2+f'^2)^(-3/2)=0
この解はf(θ)=a e^(bθ)で境界条件を合わせると
f(θ)=10e^((-θ-π/2)(2log2)/π)
このとき
T(f)=10∫[-π/2,-π/4]√(1+(2log2/π)^2)/dθ
=(5/2)√(π^2+4(log2)^2)
0941卵の名無しさん
垢版 |
2020/02/24(月) 19:54:31.51ID:qbJ7+ra+
では、それを、みさくら語でどうぞ
0942卵の名無しさん
垢版 |
2020/02/24(月) 21:31:49.62ID:x/xpTJWO
円卓の席に座る方法を考える。
4人席の場合、既に着席している4人が1,2,3,4と書かれたくじを引いて、反時計回りに1,2,3,4と並ぶように座り直すことにする。1の席が固定されているということはない。
すると、どのようにくじを引いたとしても高々2人の移動で済むことが簡単な考察で分かる。
では一般にn席あって着席済のn人が1,2,…,nと書かれたくじを引く時、移動しなければならない人は高々何人だろうか?
0943卵の名無しさん
垢版 |
2020/02/24(月) 21:57:22.22ID:iv/jnKeV
底辺の人間ほどエセの正義を語ることで
偉くなった気分になるんだよね
https://togetter.com/li/1469889
0944卵の名無しさん
垢版 |
2020/02/24(月) 22:06:34.38ID:x/xpTJWO
Aチーム6人 : Bチーム6人でレースゲームを16試合する。
1位15点
2位12点
3位10点
4位9点
5位8点
6位7点
7位6点
8位5点
9位4点
10位3点
11位2点
12位1点
の配点の場合、各チームの合計点が656:656の引き分けになる確率を教えてください。

x=c(1:10,12,15)
sim <- function() sum(replicate(16, sum(x[sample(12,6)])))==656
k=1e5
mean(replicate(k,sim()))
0945卵の名無しさん
垢版 |
2020/02/24(月) 22:18:39.05ID:x/xpTJWO
3861707060011302197274473352442662107544339496/924^16
=0.0136781633711920174806098975...

シミュレーションでの近似値が
> mean(replicate(k,sim()))
[1] 0.01344

大体あってる。
0946卵の名無しさん
垢版 |
2020/02/24(月) 22:26:32.20ID:x/xpTJWO
>>941
数くらい数えるのと、足し算くらいできるだろ?

Aチーム6人 : Bチーム6人でレースゲームを16試合する。
1位15点
2位12点
3位10点
4位9点
5位8点
6位7点
7位6点
8位5点
9位4点
10位3点
11位2点
12位1点
の配点の場合、各チームの合計点が656:656の引き分けになる

282326431934901209944756971232412938108921708544通りの中から引き分けになるのが何個あるか数えてくれ。
0947卵の名無しさん
垢版 |
2020/02/25(火) 22:16:10.30ID:dZGWYWaM
臨床経験が無いのに
臨床統計を語るのは
どういうお気持ちですか?
0948卵の名無しさん
垢版 |
2020/02/26(水) 06:27:56.22ID:XNNbo5EQ
ここをコンプ薬屋と事務員の政治スレにしよう
0949卵の名無しさん
垢版 |
2020/02/26(水) 06:41:37.50ID:P+li/ooa
>>947
臨床でのエピソード

23 卵の名無しさん sage 2020/02/06(木) 10:18:40.39 ID:fvuyjOo1
予約の患者が朝食とったらしくキャンセルで空き時間ができた。
余談ながら、
若い看護師が若い女性に(キイロカインを)「ごっくんしてください」というのは艶かしいな。
思わずVater乳頭の観察に時間を割いてしまうw
0950卵の名無しさん
垢版 |
2020/02/26(水) 07:03:20.27ID:P+li/ooa
>>948
安倍ちゃんのいいところを書けば250円貰えるぞwww
://i.imgur.com/jfBeNNK.jpg
0951卵の名無しさん
垢版 |
2020/02/26(水) 13:42:04.22ID:AcA2+/yJ
遥か昔の学生時代の記憶はどうでもいいから

早くコンプ薬屋も呼んできて
二人で壁打ちしてろ
0952卵の名無しさん
垢版 |
2020/02/26(水) 14:21:00.17ID:P+li/ooa
>>951
また、逃げるの?

臨床医学って確率的事象を扱う稼業なのになぁ。
自分で統計処理できないのは恥ずかしいなぁ。
前スレでも答えられずに逃亡していた。

【新型コロナ】中国の映画監督、新型コロナウイルスで一家4人死亡
https://asahi.5ch.net/test/read.cgi/newsplus/1582010500/

上記をみた統計できない患者から、かかったら必ず死ぬんですか?
と聞かれたら数字を出して説明したいよね。

4人感染して4人死亡。
死亡率の期待値とその95%信頼区間は?
0953卵の名無しさん
垢版 |
2020/02/26(水) 14:38:28.03ID:P+li/ooa
"
医学雑誌ランセットには、武漢市金銀潭医院に入院していた重度の肺炎患者52人のうち32人(61.5%)が死亡したという論文が発表されています。
https://news.yahoo.co.jp/byline/kimuramasato/20200226-00164690/

厚生労働省によりますと、新型コロナウイルスへの感染が確認された人で人工呼吸器をつけたり集中治療室で治療を受けたりしている重症者は、25日の時点でクルーズ船の乗客・乗員が36人、国内で感染が確認された人が14人で合わせて50人となっています。
https://www3.nhk.or.jp/news/html/20200226/k10012301441000.html

何をもって重症としているのかは判然としないが、両者の重症判定基準が同等として
50人中何人死亡すると推定されるかを95%信頼区間とともに述べよ。

"

library(binom)
(bn=binom.confint(32,52))
attach(bn)
data.frame(method,mean*50,lower*50,upper*50)
0954卵の名無しさん
垢版 |
2020/02/26(水) 16:12:56.43ID:E0xdg3nZ
>>953
童貞! 校庭! 童貞! 校庭! 
童貞! 校庭! 童貞! 校庭! 
0955卵の名無しさん
垢版 |
2020/02/27(木) 18:46:44.41ID:N3R7wpqC
>>953
臨床童貞はおもしろいですか?
0956卵の名無しさん
垢版 |
2020/02/28(金) 12:33:39.16ID:Fl09KmOa
ド底辺シリツ医および同等頭脳が答が出せない問題。

若い女性研修医(嘘つきかどうかは不明)から
「あなたのいうことが正しければ手コキかフェラをしてあげる、そうでなければセンズリを命じる」と言われた。
フェラをしてもらうには何と言えばいいか?
尚、正直者なら嘘をつかないし、嘘つきなら必ず嘘をつく。
0957卵の名無しさん
垢版 |
2020/02/28(金) 18:59:27.82ID:SCfPKsWW
>>956
いつもどおりキモいですねW
0959卵の名無しさん
垢版 |
2020/02/28(金) 21:16:39.57ID:x0SPnMpa
>>958
早くド底辺仲間のコンプ薬屋を呼んできなよ

オマエとコンプが揃ってAGWPする
地獄絵図が見たいなぁ

by 都内JK
0961卵の名無しさん
垢版 |
2020/02/29(土) 07:34:46.03ID:1jppDb+T
>>960
コンプ薬屋とAWPまだぁ

by 都内JK
0963卵の名無しさん
垢版 |
2020/02/29(土) 10:28:46.22ID:Ix6SlPJQ
プログラム解はこのスレに既出だからそれを日常言語化すれば答になるけど、ド底辺はそういう教養を欠いているんだよなぁ。
0964卵の名無しさん
垢版 |
2020/02/29(土) 17:53:19.62ID:1jppDb+T
相変わらず、反日テレビ局は偏向報道が酷いな
まるで何もかも反対しかしない
昭和の野党みたいだ
0965卵の名無しさん
垢版 |
2020/03/01(日) 15:18:41.42ID:tomslBB/
おい統計野郎
他スレでのオマエのゴミレスみると
ごまかしと暇つぶしだけの人生だなW
0966卵の名無しさん
垢版 |
2020/03/01(日) 15:27:55.66ID:8WrH5vXE
レベルが高いからレスがつかんのよ
あんたこういうグラフ作れる?

暇つぶしに、感度80% 特異度90%だった時の有病率と 検査陰性での感染確率のグラフを書いてみた。

https://i.imgur.com/yVwE5Bs.png
0967卵の名無しさん
垢版 |
2020/03/01(日) 15:45:45.65ID:8WrH5vXE
>>965
数学板にも投稿してますが、みてないの?

357 132人目の素数さん sage 2020/02/29(土) 20:50:00.58 ID:duevA7i1
>>345
RでSEIR MODEL
dS(t)/dt = mu*(N-S) - b*S(t)*I(t)/N - nu*S(t)
dE(t)/dt = b*S(t)I(t)/N - (mu+sig)*E(t)
dI(t)/dt = sig*E(t) - (mu+g)*I(t)
dR(t)/dt = g*I(t) - mu*R + nu*S(t)
mu:自然死亡率 b:感染率(S->I)
nu:ワクチン有効率(S->R) sig:発症率(E->I),g:回復率(I->R)
でプログラムを組んでクルーズ船に閉じ込めておいたときの収束予想をだそうと遊んでみた。
0968卵の名無しさん
垢版 |
2020/03/02(月) 21:47:53.33ID:/IzIBX47
ほらまたコンプがあっちで湧いた
お前の嫁だろ
早く呼んで来いやー
0969卵の名無しさん
垢版 |
2020/03/02(月) 22:05:34.76ID:BcEADux3
>>968
>956の答も出せないドアホ登場。
ド底辺シリツ医並の頭脳だなぁ。
0971卵の名無しさん
垢版 |
2020/03/02(月) 23:53:44.04ID:JuR2B+30
息を吐くようにシリツの言葉が出るって、どう考えても底辺国立だな
0972卵の名無しさん
垢版 |
2020/03/03(火) 06:12:16.13ID:MOd/ilOT
>>971
都内旧二期校卒

あんたは>956の答も出せないドアホだろ
ド底辺シリツ医並の頭脳だなぁ。
0973卵の名無しさん
垢版 |
2020/03/03(火) 06:20:52.12ID:MOd/ilOT
ド底辺シリツ医頭脳じゃなければ>956に正答すると思っていた。
それを受けてこっちをやってみ、と書く予定だったが
想定したよりも馬鹿だった。


AからHの8人はそれぞれ正直者か嘘つきであり、誰が正直者か嘘つきかはお互いに知っている。
A,B,C,D,Eは嘘つきなら必ず嘘をつくが、F,G,Hは嘘つきでも正しいことを言う場合がある。
次の証言から誰を確実に正直者と断定できるか?

A「嘘つきの方が正直者より多い」
B「Hは嘘つきである」
C「Bは嘘つきである」
D「CもFも嘘つきである」
E「8人の中に、少なくとも1人嘘つきがいる」
F「8人の中に、少なくとも2人嘘つきがいる」
G「Eは嘘つきである」
H「AもFも正直者である」
0974卵の名無しさん
垢版 |
2020/03/03(火) 07:06:47.46ID:9I6dVjmr
>>972
相変わらず毎日ウソばっかりですね
このFランの恐ろしいところは周囲にうつそうとすることですね
高学歴の私は抗体があるので無事ですが

https://www.nicovideo.jp/watch/sm36414429
0975卵の名無しさん
垢版 |
2020/03/03(火) 07:49:46.32ID:MOd/ilOT
>>974
あんたは>956の答も出せないドアホだろ
ド底辺シリツ医並の頭脳だなぁ。
0976卵の名無しさん
垢版 |
2020/03/03(火) 07:59:50.55ID:MOd/ilOT
>>974
>973に論理的に答られたら高学歴が実証されるからやってみ。
24時間待ってあげる。
0977卵の名無しさん
垢版 |
2020/03/03(火) 10:05:44.33ID:paZpS0zc
都内旧二期校卒!?とか言う言葉が出るあたり、相当な負け犬根性が培われてるな
一期校より下、旧六より下、都内なら私立より下まではいかんが私立より上ではない
底辺国立でいいだろ、分かりやすくて
高校の時に頑張って勉強しとくんだったなwww
ま、そんなことより、リアルでもネットでも、他人とコミュニケーション取れるようにな
0979卵の名無しさん
垢版 |
2020/03/04(水) 17:06:06.71ID:0bS4J8i5
>>978
受験を控えている高校生です

他のスレであなたの通っていた学校は実はFランであるとお聞きしました
レスも私の知っている大人の方たちと比べて随分と支離滅裂で低レベルなものしかされてませんが
今はどのようなお仕事をされてるんですか?
0982卵の名無しさん
垢版 |
2020/03/04(水) 17:57:44.47ID:JeuwPZj2
>>981
それで今はどのようなお仕事をされてるんですか?
下品なアジを書いたプラカード持って街角に立ってるお仕事ですか?
0984卵の名無しさん
垢版 |
2020/03/04(水) 20:28:09.86ID:u9i0Khrz
>>983
受験を控えている高校生です

他のスレでアナタはコンプ性Fラン症候群という不治の病であるとお聞きしました
高学歴の私と違ってFランであるアナタは今はどのようなお仕事をされてるんですかぁ?
0986卵の名無しさん
垢版 |
2020/04/24(金) 23:02:54.99ID:CaIpZWAk
医療大麻 CBDオイル 匿名ユーザーレビュー特集

・なんで効くのかわからないけど大麻すごい
父の病気が、治りました。
医者が驚いてます。僕も驚いてます。父は喜んでます。母は得意げです。
↓↓
謎に迫る! https://plaza.rakuten.co.jp/denkyupikaso/diary/202003270000/
0988卵の名無しさん
垢版 |
2020/09/28(月) 07:18:00.74ID:nQ3vcs5K
- ショートカットを表示しない


[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]

"link"=hex:00,00,00,00
0989卵の名無しさん
垢版 |
2020/09/28(月) 07:18:23.22ID:nQ3vcs5K
- ショートカットを表示しない


[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]

"link"=hex:00,00,00,00
0990卵の名無しさん
垢版 |
2020/12/27(日) 22:55:28.44ID:Wj30LPWM
水の比重1、重力加速度9.8m/(s^2)とすると
1N=1/9.8kg重
1hPa=100N/m^2
100/9.8kg重/(100cm)^2
100/9.8=10.19716
100/9.8(kg重)/(100)^2(cm^2)
100/9.8*1000(g重)/100^2(cm^2)
100/9.8*1000/100^2(g重/cm^2)
0991卵の名無しさん
垢版 |
2020/12/29(火) 00:37:18.34ID:RkgAFAj8
うりゅうひろゆきの本スレにようこそ!
このウンコスレは基本的にさらしアゲて使用します!
ココは医師真似事務員ジイさんが、医師妬みの挙句、テメェで勝手に自称で医科歯科大を卒業した医師って設定で
妄想願望日記を発表するスレです
お医者さんのマトモなレスなど全く不要!
ゴミ箱まがいの公衆便所掃き溜め痰壷下品スレとして使用しましょうね
そんなわけで、いまだ懲りない恥さらし(自称)医科歯科事務員ジジイ登場〜〜

│      彡川川川三三三ミ〜  プウゥ〜ン
|      川|川/  \|〜 ポワ〜ン    ________
|     ‖|‖ ◎---◎|〜        /
|     川川‖    3  ヽ〜      < 僕はうりゅうひろゆき
|     川川   ∴)д(∴)〜       \________
|     川川      〜 /〜 カタカタカタ
|     川川‖    〜 /‖ _____
|    川川川川___/‖  |  | ̄ ̄\ \
|      /       \__|  |    | ̄ ̄|
|     /  \医科歯科     |  |    |__|
|     | \      |つ   |__|__/ /
|     / 医師うらやましいぜ・・ | ̄ ̄ ̄ ̄|  〔 ̄ ̄〕
       よし、医科歯科の医者と称して
       私立のお医者様を攻撃だ!なんたって、医科歯科の看板借りてんだからな
       え?証明???自称だから医科歯科の学生証、卒業証書あるわけねえよ
       同期の医師あげてみろ、ったて、そもそも医師じゃねえし居ねえよバカ
       でも病院でもらった、医科歯科の封筒はもってま〜す!これを証拠にしてやるぜ
       専門医?欲しいけど・・いいや!そんなの必要ねえ! 俺は事務員だし
0993卵の名無しさん
垢版 |
2021/01/17(日) 11:43:16.68ID:0+l4A2WC
r1=100
n1=10000
r2=500
n2=10000

k=1e6
va=rbeta(k,1+r1,1+n1-r1) # vacccine
pl=rbeta(k,1+r2,1+n2-r2) # placebo
rr=pl/va
summary(rr)
quantile(rr,c(0.025,0.975))

NNT=1/(pl - va)
summary(NNT)
quantile(NNT,c(0.025,0.975))
0994卵の名無しさん
垢版 |
2021/01/17(日) 14:22:04.75ID:0+l4A2WC
20000人の被験者の半数にはワクチンを、半数には偽薬を
注射し、1ヶ月後に調べたところ、ワクチン群には10人、
偽薬群には50人の感染者が出た。
このワクチン接種により感染確率が1/4未満になる確率はいくらか?



r1=10
n1=1000
r2=50
n2=1000

k=1e6
va=rbeta(k,1+r1,1+n1-r1) # vacccine
pl=rbeta(k,1+r2,1+n2-r2) # placebo
rr=pl/va
summary(rr)
quantile(rr,c(0.025,0.975))
BEST::plotPost(rr,xlab='risk ratio')
HDInterval::hdi(rr)
mean(1/rr < 1/4)


NNT=1/(pl - va)
summary(NNT)
quantile(NNT,c(0.025,0.975))
BEST::plotPost(NNT,xlab='NNT',col=2)
HDInterval::hdi(NNT)
0995卵の名無しさん
垢版 |
2021/01/17(日) 22:21:32.82ID:Phpvqw96
'
感染有 感染無
既往有 44 6570
既往無 409 13764
'

covid=
cbind(
replicate(44, c(1,1)),
replicate(409, c(1,0)),
replicate(6570, c(0,1)),
replicate(13764, c(0,0)))

COVID=t(covid)
colnames(COVID)=c('infection','history')
COVID19=as.data.frame(COVID)
glm=glm(infection~.,data=COVID19, family=binomial)
adj.or=exp(glm$coef)
round(cbind(adj.or, exp(confint(glm))),3)


k=1e6
neg=rbeta(k,1+r1,1+n1-r1) # negative history
pos=rbeta(k,1+r2,1+n2-r2) # positive history
neg.o=neg/(1-neg)
pos.o=pos/(1-pos)
or=pos.o/neg.o
quantile(or,c(0.025,0.975))
summary(or)
0996卵の名無しさん
垢版 |
2021/01/18(月) 23:51:49.23ID:cEjl/X0L
医者になる前はsoftware engineerだった俺には
RなんぞVBレベル痴呆言語にしか思えない。
そもそもdata.frameとか取ってつけたような拡張が
本当にうぜえ。S言語自体が80年代の設計だから
マトリックス操作がcbindやらなんちゃらbindやら
オプション満載の超原始的。
んな言語恥ずかしいレベルやな。
0997卵の名無しさん
垢版 |
2021/01/19(火) 21:49:17.29ID:kd8IADuM
ウリュウ=プログラムおじさん
社会にも5chでも除け者にされ居場所はない。
0998卵の名無しさん
垢版 |
2021/01/19(火) 21:49:50.10ID:kd8IADuM
ウリュウに待つのは医者コンプに塗れながらの孤独死である。
0999卵の名無しさん
垢版 |
2021/01/19(火) 21:50:52.32ID:kd8IADuM
東医の佐野君→若くて実家がお金持ちで将来は医者
ウリュウ→金なし、医師免許なし、将来なし
1000卵の名無しさん
垢版 |
2021/01/19(火) 21:51:27.13ID:kd8IADuM
私立医コンプレックスのウリュウのジジイにつける薬などない。
10011001
垢版 |
Over 1000Thread
このスレッドは1000を超えました。
新しいスレッドを立ててください。
life time: 811日 23時間 32分 1秒
10021002
垢版 |
Over 1000Thread
5ちゃんねるの運営はプレミアム会員の皆さまに支えられています。
運営にご協力お願いいたします。


───────────────────
《プレミアム会員の主な特典》
★ 5ちゃんねる専用ブラウザからの広告除去
★ 5ちゃんねるの過去ログを取得
★ 書き込み規制の緩和
───────────────────

会員登録には個人情報は一切必要ありません。
月300円から匿名でご購入いただけます。

▼ プレミアム会員登録はこちら ▼
https://premium.5ch.net/

▼ 浪人ログインはこちら ▼
https://login.5ch.net/login.php
レス数が1000を超えています。これ以上書き込みはできません。

ニューススポーツなんでも実況