高校数学の質問スレ(医者・東大卒専用) Part438 (899レス)
上下前次1-新
799: 04/29(火)10:38 ID:pY4WJf3b(2/4) AAS
questtion="良品サイコロは1の目の出る確率の95%信頼区間が[1/7,1/5]に収まるサイコロと定義する。それ以外はFランサイコロと呼ぶ。
チンパンフェチが発狂してサイコロを齧ってしまった。
このサイコロが良品のままかFランかを調べたい。
(1)2回投げたらどちらも1の目がでたときこのサイコロがFランである確率を求めよ。
(2)最初から何回1の目が続いてでたらFランである確率が0.5を超えるか?
計算に必要な条件は適宜決定してよい。
"
省7
800(1): 04/29(火)18:09 ID:pY4WJf3b(3/4) AAS
library(RcppAlgos)
library(fmsb)
library(matrixStats)
N <- 50
# Generate all combinations
cm <- comboGeneral(0:N, 3, repetition = FALSE)
# Pre-allocate
省38
801(1): 04/29(火)19:11 ID:A0Mypkqe(1) AAS
>>800
高校生が解く証明問題が解けずにコソコソ書き込みかよ
802: 04/29(火)21:05 ID:pY4WJf3b(4/4) AAS
options(warn = -1)
library(RcppAlgos)
N=50
alpha=0.01
cm=comboGeneral(0:N,3,repetition=FALSE)
f=\(x,Yates=FALSE){
n=rep(N,3)
省24
803(1): 04/30(水)02:47 ID:wedVH8wl(1/10) AAS
>>801
スレタイ読んだら。
Fラン卒は別スレだぞ。
804: 04/30(水)04:58 ID:wedVH8wl(2/10) AAS
options(warn = -1)
alpha=0.05
sim=\(N=100){
A=sample(1:(N-2),1) # Ensure A leaves enough room for B and C
remaining = N - A
if(remaining > 1){
B=sample(1:(remaining-1),1) # Ensure B is at least 1
省20
805: 04/30(水)05:14 ID:wedVH8wl(3/10) AAS
options(warn = -1)
alpha=0.05
sim=\(N=100){
A=sample(1:(N-2),1) # Ensure A leaves enough room for B and C
remaining = N - A
if(remaining > 1){
B=sample(1:(remaining-1),1) # Ensure B is at least 1
省25
806: 04/30(水)06:57 ID:wedVH8wl(4/10) AAS
おっしゃる通り、カイ二乗検定で連続性補正を外せば、より小さな差でも有意になりやすいため、ご要望のデータを作成できる可能性は高まります。しかし、Fisherの正確確率検定は、まさにその正確性ゆえに、サンプルサイズが小さい場合や比率の差が小さい場合に、p値が離散的になり、Bonferroni補正のような厳しい多重比較補正を乗り越えて有意差を示すのが難しい傾向があります。
Fisherの正確確率検定は、周辺度数を固定した条件下での確率に基づいてp値を計算するため、どうしても「わずかな差」が有意になりにくいという特性があります。特に、全体で有意差が出ない程度に比率の差を抑えようとすると、ペアワイズでも同様に差が小さくなり、Bonferroni補正によって有意水準が厳しくなるため、有意差を検出するのが非常に困難になります。
連続性補正は、カイ二乗分布の連続近似を離散的なデータに適用する際の誤差を小さくするための調整ですが、これを外すことで、p値が小さくなりやすくなります。一方、Fisherの正確確率検定はその性質上、近似を用いないため、連続性補正のような概念がありません。
結論として、ご指摘の通り、「全体のFisherの正確確率検定で有意差がないのに、ペアワイズなFisherの正確確率検定だとどれかに有意差がある(Bonferroni補正あり)」という条件を満たすデータを作成するのは、統計的な制約から非常に困難であると言わざるを得ません。
やっぱり、Bonferroniの壁はFisherでは乗り越えられようだ。
807: 04/30(水)07:36 ID:IZhDMqNd(1/2) AAS
>>803
スレタイ読めないのはアンタだぞマヌケ
808(1): 04/30(水)08:07 ID:wedVH8wl(5/10) AAS
ここはFランアクセス禁。
809: 04/30(水)08:07 ID:wedVH8wl(6/10) AAS
options(warn = -1)
alpha <- 0.05
sim_fisher <- function(N = 100) {
# Function to simulate data for three groups and perform Fisher's exact test.
# N: Total sample size.
# Determine sample sizes for each of the three groups.
A <- sample(1:(N - 2), 1) # Ensure A leaves enough room for B and C.
省31
810: 04/30(水)08:07 ID:wedVH8wl(7/10) AAS
# Find data where the overall Fisher's exact test is not significant,
# but at least one pairwise Fisher's exact test (with Bonferroni correction) is significant.
res_no_overall_sig_pairwise_sig <- NULL
while (is.null(res_no_overall_sig_pairwise_sig) || res_no_overall_sig_pairwise_sig$fisher_pg > alpha || res_no_overall_sig_pairwise_sig$min_pairwise_p_bonf > alpha) {
res_no_overall_sig_pairwise_sig <- sim_fisher()
}
cat("Data where overall Fisher's test is not significant, but pairwise is:\n")
省11
811: 04/30(水)08:12 ID:wedVH8wl(8/10) AAS
options(warn = -1)
alpha <- 0.05
sim_chisq <- function(N = 100) {
# Function to simulate data for three groups and perform Chi-squared test (without Yates' correction).
# N: Total sample size.
# Determine sample sizes for each of the three groups.
A <- sample(1:(N - 2), 1) # Randomly select a size for group A, ensuring space for B and C.
省23
812: 04/30(水)08:12 ID:wedVH8wl(9/10) AAS
# Find data where the overall Chi-squared test is not significant (p > alpha),
# but at least one pairwise proportion test (with Bonferroni correction) is significant (p <= alpha).
res_no_overall_sig_pairwise_sig <- NULL
while (is.null(res_no_overall_sig_pairwise_sig) || res_no_overall_sig_pairwise_sig$chisq_pg > alpha || res_no_overall_sig_pairwise_sig$min_pairwise_p_bonf > alpha) {
res_no_overall_sig_pairwise_sig <- sim_chisq() # Keep simulating until the condition is met.
}
cat("Data where overall Chi-squared test is not significant, but pairwise proportion test is:\n")
省11
813: 04/30(水)08:13 ID:wedVH8wl(10/10) AAS
コメントが長すぎて読みにくくなった。
814: 04/30(水)08:38 ID:IZhDMqNd(2/2) AAS
>>808
アンタ日本語も読めないからfランですらないねw
あと高校生が解く証明問題すら解けないのに医者東大卒なわけねーだろタコ
815: 05/01(木)09:07 ID:L1qIlz9/(1/4) AAS
ディリクレ事前分布のパラメータαを階層化することで、より信頼性の高いベイズ推定が可能となる。
特にこの問題のように「実際に歪んでいる可能性がある」かつ「繰り返しが少ない」ケースでは、階層ベイズモデルはより適切な枠組みです。
816: 05/01(木)09:09 ID:L1qIlz9/(2/4) AAS
Stanで作ったらコンパイルに時間がかかる。簡単なモデルはJAGSの方がいい。離散変数も扱えるし。
# JAGS model
library(rjags)
# Prepare the data
outcome_data <- c(rep(1, 17), rep(2, 21), rep(3, 15), rep(4, 21), rep(5, 20), rep(6, 6))
N <- length(outcome_data)
data_jags <- list(outcome = outcome_data, N = N)
省42
817: 05/01(木)09:14 ID:L1qIlz9/(3/4) AAS
事後分布が出せたのであとはオッズ比などの計算も容易。
画像リンク[png]:i.imgur.com
818: 05/01(木)11:18 ID:L1qIlz9/(4/4) AAS
ニッチな値の探索処理が終了しないコード
rm(list=ls())
library(fmsb)
library(parallel)
alpha <- 0.05
# Function to perform a single simulation
sim_single <- function(N = 100) {
省49
819: 05/01(木)19:36 ID:VtjTJL9d(1) AAS
3群以上の多群の比の比較検定で、ペアワイズでの有意差検定を行いボンフェローニ補正ではどのペアでも有意差なしだが、
ホルム補正では有意差がでるペアが存在するというデータを有意水準0.05として作成してください。
各群のサンプルサイズは不均等でもかまいません。
820: 05/01(木)19:38 ID:twZ5uJsW(1) AAS
質問スレなので宿題依頼スレでやってください
821: 05/01(木)22:05 ID:xi2mMyC+(1) AAS
またゴミがなんかいってるよ。アホなサイト引っ張りだしてきてでたらめほざいて。正しいこと言ってるサイトと見分けつかんのかね?大学院とかついてたらそれだけで信じるカス。書いてる内容メタくそやん。
822: 05/02(金)10:48 ID:+8QO9mMm(1/2) AAS
set.seed(123)
library(fmsb)
alpha <- 0.05
N <- 1000
sim <- function() {
# 群ごとのサンプルサイズ(不均等で可)
n1 <- sample(250:350, 1) # 低用量
省25
823: 05/02(金)11:02 ID:+8QO9mMm(2/2) AAS
set.seed(123)
library(fmsb)
alpha <- 0.05
N <- 1000
# Simulation function
sim <- function() {
# Random group sizes
省48
824: 05/02(金)22:44 ID:056ygUN9(1) AAS
EMPAREG試験の解析をベイズでやっていたら、低用量高用量を統合する必要もなかったはず。
頻度主義統計で有意差がでない237:253の範囲でもプラセボよりイベント発生を抑制することが示せる。
############## 237:253 ################
# JAGSモデル文字列
model_string <- "
model {
for (i in 1:N) {
省44
825: 05/04(日)19:45 ID:Ie2Wyhjx(1) AAS
CRANからパッケージBESTが消えていたのでplotPostと同等機能の関数を復刻(不適当データ入力などエラー回避処理は面倒なのでやってない)。
画像リンク[png]:i.imgur.com
This function helps visualize posterior distribution samples from Bayesian inference and displays various informative elements. It can show the mean, mode, median, a credible interval (either HDI or quantiles), the Region of Practical Equivalence (ROPE), and a comparison value.
Arguments:
posterior_samples: A numeric vector of posterior distribution samples.
credMass: The width of the credible interval (a numeric value between 0 and 1; default is 0.95).
ROPE: A numeric vector specifying the ROPE range (e.g., c(lower_bound, upper_bound)).
省12
826: 05/05(月)19:07 ID:LDY1RQtT(1/4) AAS
# This R function, riskratio.boot, calculates the risk ratio and its Highest Density Interval (HDI)
# using a bootstrap method. It takes the number of events and the total number of observations
# for two groups as input.
riskratio.boot <- function(r1, r2, n1, n2, nboot = 5000, conf.level = 0.95, verbose = FALSE){
# Combine the number of events and total observations for both groups.
r <- c(r1, r2)
n <- c(n1, n2)
省26
827: 05/05(月)19:08 ID:LDY1RQtT(2/4) AAS
Description:
The `riskratio.boot` function in R estimates the risk ratio between two groups and provides its Highest Density Interval (HDI) using a bootstrap resampling approach. It takes the counts of events and the total number of observations for each of the two groups as input.
Usage:
riskratio.boot(r1, r2, n1, n2, nboot = 5000, conf.level = 0.95, verbose = FALSE)
Arguments:
省7
828: 05/05(月)19:09 ID:LDY1RQtT(3/4) AAS
Details:
The function works by simulating the event outcomes in each group through bootstrap resampling. For each group, it draws `n1` (or `n2`) samples with replacement from a hypothetical population that has the observed proportion of events (`r1/n1` or `r2/n2`). The number of events in each resampled set (`R1` and `R2`) is then used to calculate a bootstrapped risk ratio `(R1/n1) / (R2/n2)`. This process is repeated `nboot` times to generate a distribution of risk ratios. The function then calculates the mean of this distribution and its Highest Density Interval (HDI), which represents the most credible range for the true risk ratio given the data and the bootstrap procedure.
If `verbose` is set to `TRUE`, the function attempts to plot the distribution of the bootstrapped risk ratios using a script named `plotpost.R`. This requires that the `plotpost.R` script exists in the current working directory and is capable of handling the vector of bootstrapped risk ratios.
Value:
The function returns a list with the following components:
省4
829: 05/05(月)19:23 ID:LDY1RQtT(4/4) AAS
> riskratio.boot(244,282,2345,2333,nboot=10000)
$b_mean
[1] 0.8641319
$b_ci
lower upper
0.7312212 1.0106121
attr(,"credMass")
省1
830: 05/09(金)06:19 ID:vIVXuysf(1) AAS
SequentialPrimeDigits[n_Integer] :=
Module[{p = 10, result = {}},
While[Length[result] < n,
If[PrimeQ[p] && AllDifferencesAreOneQ[p],
AppendTo[result, p]
];
p++
省8
831: 05/10(土)11:02 ID:ynDPH7B8(1/2) AAS
# ------------------------------------------------------------------------------
# ファイル名:logistic_regression_uraguchi_factors.R
# 目的:裏口入学の決定要因を評価するロジスティック回帰分析
# 考察対象の説明変数:学力、大学ランク (基準カテゴリ: A)、縁故、親の所得、寄付金
# ------------------------------------------------------------------------------
# データ生成 (大学ランクを因子型、基準レベル A)
set.seed(123)
省47
832: 05/10(土)11:02 ID:ynDPH7B8(2/2) AAS
# 現在の par() の設定を保存
current_par <- par(no.readonly = TRUE)
# 指定された mar と bty で描画
par(mar = c(5, 8, 5, 2), bty = 'l')
# plot 関数を使用したオッズ比の信頼区間プロット (1を基準)
n_vars <- nrow(odds_ratios_ci)
y_positions <- n_vars:1
省19
833: 05/11(日)21:13 ID:2CgV4g4d(1) AAS
# データ設定
n_placebo <- 1000; eff_placebo <- 24
n_old <- 1000; eff_old <- 40
n_new <- 1000; eff_new <- 25
# 有効率
p_placebo <- eff_placebo / n_placebo
p_old <- eff_old / n_old
省28
834: 05/13(火)13:21 ID:L+Wotuil(1/2) AAS
ド底辺シリツ医大の三法則を与えたらAIが12法則まで拡張してくれました。
ド底辺医大の十二箇条 (The Twelve Laws of Do-Teihen Medical School)
第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法則
ド底辺シリツ医大卒は恥ずかしくて、学校名を皆さま言いません。
省13
835: 05/13(火)13:21 ID:L+Wotuil(2/2) AAS
第7法則
ド底辺医大卒は「実力で入った」と言うが、その“実力”の定義を決して口にしない。
A Do-Teihen graduate may claim, “I got in on merit,” but they will never define what that 'merit' actually was.
第8法則
ド底辺医大卒の最大の敵は、同級生ではなく、偏差値という現実である。
The greatest enemy of a Do-Teihen graduate is not their classmates—but the cold, numerical reality of standardized test scores.
第9法則
省11
836: 05/15(木)15:07 ID:vFdoSXtm(1) AAS
rm(list=ls())
library(PropCIs)
noninferior.pitfall <- function(r0,n0, r1,n1, r2,n2, r3,n3, nim_coef, alpha=0.05, yates=FALSE) {
delta <- (r0/n0 - r1/n1) * nim_coef
if (min(r0, r1, r2, r3) < 5) {
p1 <- fisher.test(matrix(c(r1, n1-r1, r0, n0-r0), 2, 2))$p.value
p2 <- fisher.test(matrix(c(r2, n2-r2, r0, n0-r0), 2, 2))$p.value
省13
837(1): 05/16(金)16:37 ID:s89ybxV8(1) AAS
イベント発生が人数比で
臨床試験1で 旧薬 vs プラセボで 5/201 vs 19/202
臨床試験2で 新薬 vs 旧薬 で 9/203 vs 5/204
であったとき
(1) 新薬がプラセボより劣る確率を計算せよ。
(2) 新薬はプラセボより有意差をもって有効といえるか?
計算に必要な条件は適宜設定してよい。
省42
838: 05/17(土)02:21 ID:zAzyVzie(1) AAS
>>837
# --- 必要パッケージ ---
library(rjags)
library(coda)
library(HDInterval)
# --- データ定義 ---
data_list <- list(
省45
839: 05/17(土)07:49 ID:Vpav5/5q(1) AAS
library(meta)
library(gemtc)
# データフレームの作成
data <- data.frame(
study = factor(c(1, 1, 2, 2)),
treatment = factor(c("Placebo", "Old", "Old", "New")),
events = c(19, 5, 5, 9),
省31
840: 05/20(火)23:31 ID:gwaBTE4C(1) AAS
library(R2jags)
# データ
data <- list(
nA1 = 100, rA1 = 80, # Study1: 治療A
nB1 = 100, rB1 = 40, # Study1: 治療B
nA2 = 100, rA2 = 10, # Study2: 治療A
nC2 = 100, rC2 = 5 # Study2: 治療C
省39
841: 05/23(金)10:58 ID:or+7Cxzr(1) AAS
#
"
Construct a Monte Carlo study that investigates how the probability of coverage depends on the sample size and true proportion value. In the study, let n be 10, 25, 50, and 100 and let p be .05, .25, and .50. Write an R function that has three inputs, n, p, and the number of Monte Carlo simulations m,and will output the estimate of the exact coverage probability.
Implement your function using each combination of n and p and m = 1000 simulations.
Describe how the actual probability of coverage of the traditional interval depends on the sample size and true proportion value.
"
f = \(n,p,m=1000){
省12
842: 05/24(土)02:35 ID:VetM3rz7(1/5) AAS
LearnBayes::beta.selectをoptimを使って算出
beta.optim <- function(x1, p1, x2, p2, verbose = TRUE) {
# -------------------------
# モーメント近似による初期値推定
# -------------------------
mu0 <- (x1 + x2) / 2 # 仮の平均
sigma2 <- ((x2 - x1) / 4)^2 # 仮の分散(中間50%幅から)
省42
843: 05/24(土)08:17 ID:VetM3rz7(2/5) AAS
library(rjags)
# Fit a Bayesian logistic regression model using JAGS and return predictions and posterior summaries
fit_bayesian_logistic_jags <- function(data, formula, newdata,
n.chains = 3, n.iter = 5000, n.burnin = 1000) {
# Extract response variable name from the formula
response_var <- all.vars(formula)[1]
y <- data[[response_var]]
省43
844: 05/24(土)08:18 ID:VetM3rz7(3/5) AAS
# Example data
data <- data.frame(
donation = c(0, 1000, 2000, 0, 3000, 0, 4000, 0, 5000, 0),
score = c(90, 40, 35, 88, 30, 85, 25, 92, 20, 89),
parent = c(0, 1, 1, 0, 1, 0, 1, 0, 1, 0),
admission = as.factor(c(0, 1, 1, 0, 1, 0, 1, 0, 1, 0))
)
省25
845: 05/24(土)08:37 ID:VetM3rz7(4/5) AAS
library(rjags)
# Fit a Bayesian logistic regression model using JAGS and return predictions and posterior summaries
fit_bayesian_logistic_jags <- function(data, formula, newdata,
n.chains = 3, n.iter = 5000, n.burnin = 1000) {
# Extract response variable name from the formula
response_var <- all.vars(formula)[1]
y <- data[[response_var]]
省43
846: 05/24(土)21:16 ID:VetM3rz7(5/5) AAS
# dbeta(L,a,b) == dbbeta(U,a,b)
# Solve[L^(a-1)(1-L)^(b-1)==U^(a-1)(1-U)^(b-1), b]
L=1/7
U=1/5
credMass = 0.95
f = function(a) 1 + ((a - 1) * log(U / L)) / log((1 - L) / (1 - U))
g = function(a) pbeta(U,a,f(a)) - pbeta(L,a,f(a)) - credMass
省3
847(1): 05/25(日)04:22 ID:P4nhnL8B(1/6) AAS
# dbeta(L,a,b) == dbbeta(U,a,b)
# Solve[L^(a-1)(1-L)^(b-1)==U^(a-1)(1-U)^(b-1), b]
L=1/7
U=1/5
credMass = 0.95
f = function(a) 1 + ((a - 1) * log(U / L)) / log((1 - L) / (1 - U))
g = function(a) pbeta(U,a,f(a)) - pbeta(L,a,f(a)) - credMass
省9
848: 05/25(日)05:57 ID:P4nhnL8B(2/6) AAS
>847のRのコードをChatGPTで
Mathematicaにコメント付きで移植
(*
betaParameter 関数:
指定された信頼区間 [L, U] に、指定された信頼度 credMass(例: 95%)の確率質量を持つ
ベータ分布のパラメータ α, β を算出する。
*)
省23
849: 05/25(日)06:42 ID:P4nhnL8B(3/6) AAS
>>847
このプロトタイプをAIに与えて描画機能やコメントをつけてもらった。
beta.parameter <- function(lower, upper, credMass = 0.95, verbose = FALSE) {
# Helper function to convert decimal numbers to fraction strings using MASS::fractions
fractionStr <- function(x) {
as.character(MASS::fractions(x))
}
省24
850: 05/25(日)06:42 ID:P4nhnL8B(4/6) AAS
# If verbose flag is TRUE, plot the Beta distribution and annotate results
if (verbose) {
# Generate x values from 0 to 1 for plotting the density
x <- seq(0, 1, length.out = 1000)
# Compute Beta density values at x
y <- dbeta(x, alpha, beta)
# Color bars within the credible interval [lower, upper] as "lightcoral",
省36
851: 05/25(日)06:51 ID:P4nhnL8B(5/6) AAS
今回スムーズに機能拡張できた理由は、以下のようにプロトタイプが非常に明快かつ健全だったことが大きな要因です。
✅ プロトタイプの良さが拡張性を支えた理由
1. 構造がシンプル
中心となる数式(pbeta(U, a, b) - pbeta(L, a, b) = credMass)が明確で、ロジックが一貫していました。
f(a) で b を a の関数として定義しており、探索空間を1次元に抑えていた点も効率的。
2. 関数分離と再利用が可能
f(a) や g(a) が関数として定義されていたので、視覚化やバリエーションの追加が簡単でした。
省4
852: 05/25(日)10:38 ID:P4nhnL8B(6/6) AAS
HDI_discrete <- function(prob_data, credMass) {
x = prob_data[, 1]
p = prob_data[, 2]
n = length(x)
sp = sort(p, index.return = TRUE)
i = sp$ix[seq(n, 1, -1)]
ps = p[i]
省10
853: 05/29(木)17:36 ID:WPcwJ6cn(1) AAS
"
サイコロを50回なげて4回1の目がでた。
1の目のでる確率は1/6である仮説が正しい確率を求めよ。
計算に必要なモデルは適宜設定してよい。
例:サイコロを投げる前のこの仮説が正しい確率は一様分布に従う。
a/(a+b)=p
a=p(a+b)
省24
854: 05/30(金)06:24 ID:zoAuXcvc(1/3) AAS
par(bty="l")
y = c(43, 24, 100, 35, 85)
yn = max(y)
n = length(y)
B = 200
like = numeric(B)
for(i in yn:B) { like[i] = 1 / (i^n) }
省11
855: 05/30(金)19:44 ID:zoAuXcvc(2/3) AAS
(* pbetat関数の定義 *)
pbetat[p0_, prob_, ab_, data_] := Module[{a, b, s, f, lbf, bf, post},
a = ab[[1]];
b = ab[[2]];
s = data[[1]];
f = data[[2]];
lbf = s * Log[p0] + f * Log[1 - p0] + Log@Beta[a, b] - Log@Beta[a + s, b + f];
省8
856: 05/30(金)20:13 ID:zoAuXcvc(3/3) AAS
p_post_null <- function(p0, prior, alpha, beta, success, failure){
# Calculate the total number of trials from successes and failures.
total = success + failure
# Calculate the likelihood of the data under the null hypothesis (H0).
# This assumes a binomial distribution where the success probability is p0.
m0 = dbinom(success, total, p0)
# Calculate the marginal likelihood of the data under the alternative hypothesis (H1).
省29
857: 05/31(土)05:25 ID:jzcOJBMt(1) AAS
#' @title ベイズ事後確率計算関数
#' @description 帰無仮説と対立仮説の事後確率を計算
#' @param s 観測成功数(1の目が出た回数)
#' @param n 総試行回数
#' @param p0 帰無仮説の確率(例: 1/6)
#' @param prior 帰無仮説の事前確率(0~1)
#' @param alpha 対立仮説のベータ分布αパラメータ
省33
858: 06/01(日)07:35 ID:/PZFDI/g(1/2) AAS
auc = integrate(unnorm_posterior,0,Inf)$value
integrate(\(x) x*unnorm_posterior(x)/auc, 0,Inf)
log_auc <- log(integrate(\(x) exp(log(unnorm_posterior(x))), 0, Inf)$value)
integrate(\(x) x * exp(log(unnorm_posterior(x)) - log_auc), 0, Inf)$value
859: 06/01(日)09:23 ID:9o1m2vAK(1) AAS
Calculate the marginal likelihood of the data under the alternative hypothesis (H1).
wwwwwwwwwwwwwwwwwwwwwwwwwwwwww
あほ~~
wwwwwwwwwwwwwwwwwwwwwwwwwwwwww
860: 06/01(日)10:41 ID:/PZFDI/g(2/2) AAS
はい、Gelmanらの推奨は確かに進化しており、近年ではハーフt分布(half-t)がより一般的に推奨されています。この変化の背景と具体的な推奨内容を、理論的根拠と実践的なアドバイスに分けて解説します。
1. Gelmanの推奨の変遷
(1) 初期(2006年頃): ハーフコーシー(自由度ν=1)の推奨
推奨理由:
分散パラメータの弱情報事前分布として適切
裾が重く、極端な値への過剰なペナルティを回避
問題点:
省8
861: 06/02(月)11:14 ID:GMuHFUYr(1/2) AAS
x = c(-0.86, -0.3, -0.05, 0.73)
n = c(5, 5, 5, 5)
y = c(0, 1, 3, 5)
(data = cbind(x, n, y))
(response = cbind(y, n - y) )
results = glm(response ~ x, family = binomial)
#summary(results)
省15
862: 06/02(月)12:04 ID:GMuHFUYr(2/2) AAS
# データ
x <- c(-0.86, -0.3, -0.05, 0.73)
n <- c(5, 5, 5, 5)
y <- c(0, 1, 3, 5)
# JAGSモデル
model_string <- "
model {
省32
863: 06/03(火)00:31 ID:CfA5PBxZ(1/2) AAS
x = c(-0.86, -0.3, -0.05, 0.73)
n = c(5, 5, 5, 5)
y = c(0, 1, 3, 5)
(data = cbind(x, n, y))
(response = cbind(y, n - y) )
results = glm(response ~ x, family = binomial(link="logit") )
summary(results)
省7
864: 06/03(火)23:40 ID:CfA5PBxZ(2/2) AAS
k=10
m=400
Nmax=1000
sim = \(){
N=sample(m:Nmax,1)
if(max(sample(1:N,k))==m) return(N)
}
省4
865: 06/04(水)07:49 ID:n75lIIio(1) AAS
set.seed(123)
solve = function(x,k=1e5){
f = function(x) runif(1,x-0.5,x+0.5)
y=replicate(k,mean(sapply(x,f)))
quantile(y,p=c(0.025,0.975))
}
solve(c(9,10,11,11,12))
省13
866: 06/05(木)13:25 ID:tGlaBVfa(1) AAS
> stancode(fit)
// generated with brms 2.22.0
functions {
/* compute monotonic effects
* Args:
* scale: a simplex parameter
* i: index to sum over the simplex
省67
867: 06/06(金)04:41 ID:fR053ZqC(1/2) AAS
# ロジスティック回帰モデル
ACT = c(16,18,20,22,24,26,28)
n = c(2,7,14,26,13,14,3)
y = c(0,0,6,12,7,9,3)
fit = glm(cbind(y, n - y) ~ ACT, family = binomial())
#predict(fit, newdata = data.frame(ACT = 20)) |> plogis()
predict(fit, newdata = data.frame(ACT = 20)
省20
868: 06/06(金)04:43 ID:fR053ZqC(2/2) AAS
確率は0~1の範囲に制限されるため、直接計算は境界(0や1)に近い場合に不適切(例: 負の値や1超えの可能性)。また、ロジスティック回帰の標準誤差はログオッズスケールで計算されるため、確率スケールでの線形近似は精度が落ちる。
869: 06/06(金)06:49 ID:rCqJxG6F(1) AAS
お前には永遠に確率論なんて無理だよ。
数学Bの統計すらわからないのに。
自分が理解できていないことすら理解できないゴミ
870: 06/06(金)08:42 ID:icvPdYuT(1) AAS
公式当てはめてるだけだからな
じゃあその公式をどうやって証明するかまでは考えが及ばない
やってることは公文式で大学生の演習解いてる中学生と一緒
871(4): 06/12(木)09:46 ID:z7P0Lqdi(1) AAS
Bayesian Computation with RでRのコードが理解できなかった。バグだとおもったのだが、
外部リンク[txt]:bayesball.github.io
のerrataにも掲載がないのでAIに聞いてみた。
>>
対数ヤコビアン項が間違っていると思う。
# theta=c(log(eta/(1-eta)),log(K))
> LearnBayes::betabinexch
省33
872: 06/12(木)18:10 ID:CDb/RdAY(1/2) AAS
>>871
脳内医者完全にバレたのにまだ頑張ってるんだ
哀れだね
873: 06/12(木)18:20 ID:QiRqli9X(1) AAS
>>871
バグだと思ったのにIssueもあげないの?
スレの私的利用といい、マジで他人の成果やタイトルに乗っかるだけの寄生虫じゃん
税金も年金もコイツに使うだけ無駄だよ
874(1): 06/12(木)18:27 ID:CDb/RdAY(2/2) AAS
>>871に質問!
当然入試でも満点が取れる解答以外認めません
①円周率が3.05より大きいことを証明せよ。
ただし円周率は(円周)/(円の直径)と定義され、円周率が3.14より大きい事は判明していないものとする。
②√2+√3が無理数であることを証明せよ。
875: 06/13(金)07:38 ID:XjvE6Ide(1) AAS
>>874
証明問題解けないんだから、人のした証明が正しいかの判断できないだろ
876(2): 06/14(土)05:53 ID:nWbGzc8A(1) AAS
(1)nを正整数とする。
n^3+4n^2+3nを6で割った余りを求めよ。
(2)nを正整数とする。
n^3+7n^2+5nを6で割った余りを求めよ。
877: 06/14(土)10:23 ID:c0/MskJB(1) AAS
>>876
(2)が傑作でございます
878: 06/15(日)01:22 ID:bEUsomGs(1) AAS
>>876
n^3+7n^2+5n
=n(n^2+7n+5)
=n{(n+1)(n+2)+3(n+1)+n}
・n(n+1)(n+2)は3連続の正整数の積なので6の倍数
・n(n+1)は偶数なので3n(n+1)は6の倍数
したがってn^3+7n^2+5nを6で割った余りはn^2を6で割った余りに等しい。
省6
879: 06/15(日)08:32 ID:MIIBNstg(1) AAS
pdf2hdi <- function(pdf,
xMIN=0,
xMAX=1,
cred=0.95,
Print=TRUE,
nxx=1001){
xx=seq(xMIN,xMAX,length=nxx)
省30
上下前次1-新書関写板覧索設栞歴
あと 20 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.041s