[過去ログ] 臨床統計もおもしろいですよ、その2 (1002レス)
1-

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
879
(1): 2020/01/30(木)05:17 ID:m/EdOA9B(1/6) AAS
>>878
イナカも東京も国立なら学費は同じだぞ。
880
(1): 2020/01/30(木)08:20 ID:b9qEKmQr(1) AAS
>>879
イナカモノにしてみれば
地元以外のところに大学が存在しているという時点で
学費以外にもアパート代や食費などの参入障壁があるんだな
881: 2020/01/30(木)08:31 ID:17lSJR5q(1) AAS
>>880
シリツ医大専門受験予備校のバイトは一コマ90分で手取り2万円だったな。大学の授業料が年間14万4千円の頃の話。
地方にはそんな割のいいバイトはない。
882: 2020/01/30(木)20:25 ID:m/EdOA9B(2/6) AAS
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)
省6
883: 2020/01/30(木)21:10 ID:m/EdOA9B(3/6) AAS
パッケージの内部関数を使って解決してくれた。

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.
884
(2): 2020/01/30(木)21:21 ID:m/EdOA9B(4/6) AAS
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を既約分数表示する
省17
885: 2020/01/30(木)23:51 ID:m/EdOA9B(5/6) AAS
#Reed-Frost Model
ReedFrost=function(
p=0.04,
N=100,
T=40)
{
q=1-p
I=numeric(T)
S=numeric(T)
I[1]=1
省16
886: 2020/01/30(木)23:53 ID:m/EdOA9B(6/6) AAS
こっちは、モンテカルロによるシミュレーション

# 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)
省19
887: 2020/01/31(金)00:59 ID:24QiZJ0Y(1/14) AAS
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)
省17
888: 2020/01/31(金)01:00 ID:24QiZJ0Y(2/14) AAS
> for(i in 1:30) f(i)
1
3 / 2
11 / 6
25 / 12
137 / 60
49 / 20
363 / 140
761 / 280
7129 / 2520
省21
889: 2020/01/31(金)01:12 ID:24QiZJ0Y(3/14) AAS
>>884
H(n) = Σ[k=1,2,...,n] 1/k
とする。H(n)を既約分数で表したときの分子の整数をf(n)と表す。
f(77)を求めよ。

> f(77)
17610982920730618962802441030965952272844514966520010106103127939813509744122599441432576
/ 3574019481870823559764745233429885438685864430565417716720215849457565210956573486328125
890: 2020/01/31(金)07:13 ID:24QiZJ0Y(4/14) AAS
>>884
n=100と大きいとNAが混ざるな
891: 2020/01/31(金)07:15 ID:24QiZJ0Y(5/14) AAS
AA省
892: 2020/01/31(金)07:15 ID:24QiZJ0Y(6/14) AAS
AA省
893: 2020/01/31(金)07:15 ID:24QiZJ0Y(7/14) AAS
> f(100)
3055216077446868329553816926933899676639525195878807877583434152044192757431459126874725081455196840519615954410565802448075620352
/ 588971222367687651371627846346807888288472382883312574253249804256440585603406374176100610302040933304083276457607746124267578125
894: 2020/01/31(金)07:45 ID:24QiZJ0Y(8/14) AAS
Reed-Frost モデル

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

ReedFrost=function(
p=0.04, # 1期間内での伝播確率
N=100, # 集団の人数
T=40) # 全期間
省12
895: 2020/01/31(金)11:25 ID:24QiZJ0Y(9/14) AAS
# 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))
省20
896: 2020/01/31(金)15:00 ID:24QiZJ0Y(10/14) AAS
# 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()
省14
897: 2020/01/31(金)15:00 ID:24QiZJ0Y(11/14) AAS
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 (
省17
898: 2020/01/31(金)15:00 ID:24QiZJ0Y(12/14) AAS
# 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
省11
1-
あと 104 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.025s