An extention to the bayes_R2 function
まだ誰も着手していません。
評価
調査の方向性
まず R/bayes_R2.R、リンク先の論文、添付された BayesRsquared.pdf を読んで、提案されている拡張を現在の関数と比較してください。この Issue では、合意されたスコープも受け入れ基準も定義されていません。完了とするには、maintainer がより広範なモデルのサポートをこの package に含めるべきか判断し、実装と検証に関する期待事項を定める必要があります。
索引モデルが issue の本文から書いたものです。
説明
Hi,
This work shows that we can extend the use of the Bayesian R-square in the bayes_R2 function to a wider range of models. I've suggested some changes to the bayes_R2 function, which you can find below and in the attached file. It is not an issue, but I wanted to know whether to create an issue or submit a direct pull request.
BayesRsquared.pdf
Thank you for considering this.
Best regards,
Abdollah
bayes_R2_new <- function(fit)
{
fam <- family(fit) # family dist. of the response
eta <- posterior_linpred(fit) # linear predictor: eta
mu <- fam$linkinv(eta) # conditional mean
varfit <- apply(mu, 1, var)
varres <- switch(fam$family, gaussian={
as.matrix(fit, pars="sigma")^2
}, binomial={
v <- fam$variance(mu)
apply(v, 1, mean)
}, poisson={
v <- fam$variance(mu)
apply(v, 1, mean)
}, Gamma={
v <- fam$variance(mu)
apply(v, 1, mean) / as.matrix(fit, pars="shape")
}, beta={
v <- fam$variance(mu)
apply(v, 1, mean)
}, neg_binomial_2={
size <- as.matrix(fit, pars="reciprocal_dispersion")
v <- fam$variance(mu, theta=c(size))
apply(v, 1, mean)
}, inverse.gaussian={
v <- family(fit)$variance(mu)
apply(v, 1, mean) / as.matrix(fit, pars="lambda")
}, stop("the speciefied family is not implemented"))
R2 <- varfit / (varres + varfit) # Bayesian R-squared
attributes(R2) <- list(varfit=varfit, varres=varres)
return(R2)
}
- 主要言語
- R
- スター
- 49
- フォーク
- 24
- 平均マージ
- 23時間 46分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stan-dev/rstantools のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
stan-dev/rstantools#131 · コメント 2 件 ·
-
Use testthat 3e再び着手できるかも @VisruthSK が 77 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
stan-dev/rstantools#159 · リアクション 1 件 · 担当者 1 名 ·
-
Cleanup Vignette再び着手できるかも @VisruthSK が 80 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
stan-dev/rstantools#157 · コメント 1 件 · 担当者 1 名 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 45/100
stan-dev/rstantools#134 · コメント 6 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
stan-dev/rstantools#127 ·
stan-dev/rstantools の issue をすべて見る