Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba43852
commit daccdff
Showing
21 changed files
with
397 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
Package: BayesGOF | ||
Type: Package | ||
Title: Bayesian Modeling via Goodness of Fit | ||
Version: 1.3 | ||
Date: 2017-11-14 | ||
Version: 1.4 | ||
Date: 2018-01-02 | ||
Author: Subhadeep Mukhopadhyay, Douglas Fletcher | ||
Maintainer: Doug Fletcher <tug25070@temple.edu> | ||
Description: Non-parametric method for learning prior distribution starting with parametric (subjective) prior. It performs four interconnected tasks: (i) characterizes the uncertainty of the elicited prior; (ii) exploratory diagnostic for checking prior-data conflict; (iii) computes the final statistical prior density estimate; and (iv) performs macro- and micro-inference. Primary reference is Mukhopadhyay, S. and Fletcher, D. (2017, Technical Report). | ||
Depends: orthopolynom, VGAM | ||
Suggests: knitr, rmarkdown | ||
VignetteBuilder: knitr | ||
License: GPL-2 | ||
NeedsCompilation: no | ||
Packaged: 2017-11-16 02:29:46 UTC; Doug | ||
Packaged: 2018-01-03 14:43:19 UTC; Doug | ||
Repository: CRAN | ||
Date/Publication: 2017-11-16 10:20:32 UTC | ||
Date/Publication: 2018-01-05 19:00:44 UTC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,55 @@ | ||
cfd4bef72baae3a4552280fa451fc676 *DESCRIPTION | ||
ff715b03553ac6270dbb83c08e7f16df *DESCRIPTION | ||
a4f3d575676f1b80e1058c92810fd2b7 *NAMESPACE | ||
e8cdb771de69edc672a7aac8d9440bb9 *R/BetaBinoMLE.R | ||
41c4e27fc84725947452cf8a4c781290 *R/DS.PostMean.R | ||
b26eb9d329b41e2370371b06b92f2048 *R/DS.PostMean.reduce.R | ||
fe43131dc70d9bfb435a4e0dcd3ae58d *R/ConMean.prt.2.R | ||
f534a2cee775d2300a120951ff633f4a *R/DS.PostMean.R | ||
6f77a33e7e6f0fa1184b966f73dae483 *R/DS.PostMean.reduce.R | ||
df69695935b3e562e17b49c8223033a9 *R/DS.macro.inf.R | ||
468477eb09a9719982eac417a2c94b62 *R/DS.micro.inf.R | ||
f6bd71b34fe492a6b41c5767eb31772a *R/DS.mode.map.R | ||
d7e1d4d09924ca058faacdad2455fa6d *R/DS.micro.inf.R | ||
60be8417bea981f785e722ec25c278b9 *R/DS.mode.map.R | ||
03be355b3798c6a69b97548e5eee3926 *R/DS.mode.reduce.R | ||
176d6138242fd09744d1d85328a1a37f *R/DS.prior.R | ||
8f5455dc47b5866c8c6423ee6b5f83ab *R/DS.prior.R | ||
e5354a65b65d2c5b81582559ee7a1030 *R/EXP.denom.R | ||
5ded1e76591fbd05471de371c5261042 *R/EXP.num.1.R | ||
cd2cdbd50f105ec57eb2fd32efc9630d *R/EXP.num.2.R | ||
074ac6883254aa2c0c110ef810250a9e *R/EXP.score.R | ||
399a1ec91a0e02f8186b74648054c169 *R/EXP.score.R | ||
e04999cc772d27e577942b140b77ef24 *R/LP.basis.beta.R | ||
0488b1290b901beda5de0d54c6000679 *R/LP.smooth.R | ||
6b2a90b2028ddec70ff0a68fa1a519e0 *R/Local.Mode.R | ||
2809c3ee1ee7446e7a65b25a9705376a *R/PP.prt.2.R | ||
cc0c13114ef93fab90e4634341fa76ce *R/Reduce.LP.coef.R | ||
7fa03fde303c925b5de4e3fa82bfe8a4 *R/mom.est.R | ||
a704236500da903d6e489b72cf9a7a59 *R/plot.DS_GF.R | ||
4a066dcb7cf21ec5cae398acb93e70a2 *R/plot.DS_GF_macro_mean.R | ||
72934ff6d9d54321965bd059222208d3 *R/plot.DS_GF_macro_mode.R | ||
4958fab993b56a933daa39ab4f52c953 *R/plot.DS_GF_micro.R | ||
71c42d22a062530811bf5774eab9b56f *R/plot.DS_GF.R | ||
1f8be9e42445840b66f7f2457fa95f15 *R/plot.DS_GF_macro_mean.R | ||
22ffc8f09ab875efedf86b9f35707f27 *R/plot.DS_GF_macro_mode.R | ||
ca68dbc678d9f573c109a904b2ac29fb *R/plot.DS_GF_micro.R | ||
32731dab82fe5d939ab07f068eece6e5 *R/print.DS_GF.R | ||
847051f9d55ea4d3df293cbe661e8fb7 *R/print.DS_GF_macro_mean.R | ||
5d2acbda0d40b6b8ea5074459f8916ba *R/print.DS_GF_macro_mode.R | ||
9a2ea0cbaae526bf289d047e08c484c2 *R/print.DS_GF_micro.R | ||
c5751d11df67d3e13765bb79a0ed8cdf *R/rDS.R | ||
904d66c45aae0007a9a9790007834619 *R/rDS.posterior.R | ||
43346db63edf02693e6dc6cde4561463 *R/weight.fun.beta.R | ||
e8e8a76b16019e4560c612c15fd0e13d *build/partial.rdb | ||
52e60785b26ceed34594689813d7cde2 *build/partial.rdb | ||
32bb6c15cc261cc5a800feaef03df159 *build/vignette.rds | ||
4eb418b2906c27f4d7c4f1820cdfef39 *data/rat.rda | ||
86f2e44eba816a17d1c21b98238eb0f9 *data/ship.rda | ||
2ea567712e420d7dad930065d164f0ea *data/surg.rda | ||
b2cc985b167635ee9460b40031cb97b1 *data/tacks.rda | ||
d5e17a0af9b0f694d178a824213f7f04 *data/terb.rda | ||
b6b93be51774b48490af693f8da7b977 *inst/doc/vignette_BayesGOF.R | ||
cbd58b4bd918f85fd591770a32884297 *inst/doc/vignette_BayesGOF.Rmd | ||
e4d0976b6350f76127b0c4229a87fbc2 *inst/doc/vignette_BayesGOF.html | ||
f602b20ce666636fd4ce1fe3e2e4b14f *man/BayesGOF-package.Rd | ||
d5fe161c86340df185b1bf8722ed3244 *man/BetaBinoMLE.Rd | ||
761067228b62ec63a273ba5dbe9034b2 *man/DS.PostMean.Rd | ||
b14a54fa25faf8496826ef5e2a0938aa *man/DS.PostMean.Rd | ||
f212f760e4377b14adde601a86a6c06b *man/DS.macro.inf.Rd | ||
323c51a0c260a624791b4c2a5cd96081 *man/DS.micro.inf.Rd | ||
cda9fcc073393201bc5ec9e9d1c94817 *man/DS.prior.Rd | ||
883a6c582feafd1a0c212e75a234c579 *man/DS.prior.Rd | ||
80f2637e9f992da56001c6e04a910c57 *man/LP.basis.beta.Rd | ||
c5ae2041c3448673d570d4f62292a08a *man/rDS.Rd | ||
d0e4b41b002567b8dd89ece7943ad973 *man/rat.Rd | ||
036e74bea69c9cb18ce9435abda7a77d *man/ship.Rd | ||
1a4578d3061e06f366a3a81187e2d7bb *man/surg.Rd | ||
7df318a497e78c94fafa22de2db27802 *man/tacks.Rd | ||
e260deea72882c143a52313389aa8b6d *man/terb.Rd | ||
cbd58b4bd918f85fd591770a32884297 *vignettes/vignette_BayesGOF.Rmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,14 @@ | ||
DS.PostMean <- | ||
function(y.i, n.i, g.par, u, LP.par, method = c("LP-Score", "Theta")){ | ||
method = match.arg(method) | ||
function(y.i, n.i, g.par, u, LP.par){ | ||
post.par1.i <- y.i + g.par[1] | ||
post.par2.i <- n.i - y.i + g.par[2] | ||
weight <- weight.fun.beta(u, g.par[1],g.par[2],post.par1.i,post.par2.i) | ||
weight <- weight.fun.beta(u, g.par[1], g.par[2], post.par1.i, post.par2.i) | ||
leg.mat <- LP.basis.beta(u,c(1,1), length(LP.par)) | ||
#leg.mat2 <- Leg.poly(u, length(LP.par)) | ||
switch(method, | ||
"LP-Score" = { | ||
vec.map <- (EXP.num.1(weight, leg.mat) + | ||
EXP.num.2(LP.par, weight, leg.mat) ) / | ||
EXP.denom(LP.par, weight, leg.mat) | ||
return(vec.map) | ||
}, | ||
"Theta" = { | ||
if(sum(LP.par^2) == 0){ | ||
if(sum(LP.par^2) == 0){ | ||
ConMean.ind <- (post.par1.i)/(post.par1.i + post.par2.i) | ||
} else { | ||
post.mu <- post.par1.i /(post.par1.i + post.par2.i) | ||
ConMean.ind <- ( post.mu + PP.prt.2(LP.par, weight, leg.mat, u, g.par[1], g.par[2]) ) / EXP.denom(LP.par,weight,leg.mat) | ||
ConMean.ind <- ( post.mu + ConMean.prt.2(LP.par, weight, leg.mat, u, g.par[1], g.par[2]) ) / EXP.denom(LP.par,weight,leg.mat) | ||
} | ||
return(ConMean.ind) | ||
} | ||
) | ||
return(ConMean.ind) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
plot.DS_GF_micro <- | ||
function(x, x.lim = c(0,1), ...){ | ||
plot(x$post.data$theta.vals, x$post.data$ds.pos, xlim = x.lim, | ||
function(x, ...){ | ||
plot(x$post.data$theta.vals, x$post.data$ds.pos, | ||
main = "Posterior Density Estimate", type = "l", lwd = 2, col = "red3", | ||
xlab = expression(theta), ylab = "", font.main = 1, | ||
cex.lab=1.45, cex.axis=1.5, cex.main=1.5, cex.sub=1.5) | ||
cex.lab=1.45, cex.axis=1.5, cex.main=1.5, cex.sub=1.5, ...) | ||
title(ylab = expression(paste(hat(pi)(theta[i]~"|"~y[i]))), line = 2.3, cex.lab=1.45) | ||
lines(x$post.data$theta.vals, x$post.data$parm.pos, | ||
col = "blue", lty = "dashed", lwd = 2) | ||
} | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## ---- message = FALSE--------------------------------------------------- | ||
library(BayesGOF) | ||
set.seed(8697) | ||
data(rat) | ||
###Use MLE to determine starting values | ||
rat.start <- BetaBinoMLE(rat$y, rat$n)$estimate | ||
|
||
## ------------------------------------------------------------------------ | ||
rat.ds <- DS.prior(rat, max.m = 6, rat.start) | ||
|
||
## ---- fig.height = 5.5, fig.width = 5.5, fig.align = 'center'------------ | ||
plot(rat.ds, plot.type = "Ufunc") | ||
|
||
## ------------------------------------------------------------------------ | ||
rat.ds | ||
|
||
## ----fig.height = 5.5, fig.width = 5.5,fig.align = 'center'-------------- | ||
plot(rat.ds, plot.type = "DSg") | ||
|
||
## ---- warning = FALSE---------------------------------------------------- | ||
rat.macro.md <- DS.macro.inf(rat.ds, num.modes = 2 , iters = 25, method = "mode") | ||
|
||
## ------------------------------------------------------------------------ | ||
rat.macro.md | ||
|
||
## ---- fig.height = 5.5, fig.width = 5.5,fig.align = 'center'------------- | ||
|
||
plot(rat.macro.md) | ||
|
||
## ---- fig.align = 'center'----------------------------------------------- | ||
rat.y71.micro <- DS.micro.inf(rat.ds, y.i = 4, n.i = 14) | ||
rat.y71.micro | ||
|
||
## ----fig.height = 5.5, fig.width = 5.5,fig.align = 'center'-------------- | ||
plot(rat.y71.micro) | ||
|
Oops, something went wrong.