Skip to content

Commit

Permalink
version 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fmcron authored and gaborcsardi committed Aug 6, 2012
0 parents commit d9a08d1
Show file tree
Hide file tree
Showing 32 changed files with 2,741 additions and 0 deletions.
20 changes: 20 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Package: Bayesthresh
Version: 0.1
Date: 2012-08-06
Title: Bayesian thresholds mixed-effects models for categorial data
Author: Fabio Mathias Correa <fmcron@gmail.com> and Julio Silvio de
Souza Bueno Filho <juliobuenof@gmail.com>
Maintainer: Fabio Mathias Correa <fmcron@gmail.com>
Description: This library fits a linear mixed model for ordinal
categorical responses using Bayesian inference via Monte Carlo
Markov Chains. Default is Nandran & Chen algorithm using
Gaussian link function and saving just the summaries of the
chains. Among the options, package allow for two other options
of algorithms, for using Student's "t" link function and for
saving the full chains.
Depends: R(>= 2.10.1), lme4 (>= 0.999375-35), MASS, VGAM, mvtnorm,
matrixcalc
License: GPL (>= 2)
Repository: CRAN
Date/Publication: 2012-08-08 05:37:26
Packaged: 2012-08-07 23:21:34 UTC; fmcron
31 changes: 31 additions & 0 deletions MD5
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
c68ca96c1fb8dc3019fd3f0c1fe817f6 *DESCRIPTION
637174c4b580e5e2f976596269734abc *NAMESPACE
4b742abdb54c0f674c2f06b880d63a6f *R/Bayes.factor.R
ca79ffb9476bc8c8726ec09db03183f7 *R/Bayesthresh.R
97d72f8e990f3a229d4ddd7408ccb010 *R/coef.Bayesthresh.R
2433b9d274c1b12429f632c0eee7fa31 *R/compVar.R
f52b3e962fcf1c240d68304c2b98d08c *R/plot.random.effects.R
91935a4a020ccf82ac7f1549cb4eb84f *R/random.effects.R
b51185e0fa4825009b06e9dee61b9358 *R/zzz.R
bd4a5ef6aad4293f4ff514233e794b7e *data/sensory.rda
3b4c692402cf955ad72ec62c0a1beb17 *inst/CITATION
ca591a030c5407c420cdcba3a31c06f2 *man/ACGaussian.Rd
e02f57831b3a1c651460698503742667 *man/ACt.Rd
0d794c2437253de1db61ec284b8fb9b1 *man/Bayes.factor.Rd
5d06b782074a983feb965f728e536ad8 *man/Bayesthresh.Rd
5f1450d8675c66f5a4d7f56569408e4a *man/MCGaussian.Rd
3f0ab3eb6a77313f0e041b975e9819ef *man/MCt.Rd
f1ccbd0f52aa5675a6c605d736f9ab21 *man/NCGaussian.Rd
8ac8feda967146bacd0a1d19d47d6da8 *man/NCt.Rd
a699cec2bb477682a005e38e436e0442 *man/coef.Bayesthresh.Rd
a2ec37d6e8bb71324a4fcfca3409502e *man/compVar.Rd
28a10a7d8adbd79a4897a3718bec9de5 *man/plot.random.effects.Rd
c9c19c8d023af5461476ee3fd6352836 *man/predict.Bayesthresh.Rd
d5d66b115b1b19eb1d2abd95f8ba46e7 *man/random.effects.Rd
937ef63c15dbe35bdbeb96d83aa639f4 *man/sensory.Rd
e441f70f7997b49ceba84c8d4bfbeeea *man/summary.Bayesthresh.Rd
f76f32b3af49874a82e9ef6d4bf995ef *src/acum.c
af33e99954d91e868233f336cf5b1d7a *src/dist.c
149e8aa070b60438aa24fc9b0e54c76a *src/lambda.f95
e28e02b96aeb9e651b03c559caa357b4 *src/partition.f95
03a51259d331296b00ce9d680dcfeabb *src/vua.f95
22 changes: 22 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
useDynLib(Bayesthresh)

export("Bayesthresh",
"Bayes.factor",
"random.effects",
"coef.Bayesthresh",
"summary.Bayesthresh",
"ACGaussian",
"ACt",
"MCGaussian",
"MCt",
"NCGaussian",
"NCt",
"predict.Bayesthresh",
"plot.random.effects",
"compVar")


S3method(predict, Bayesthresh)
S3method(plot, random.effects)
S3method(coef, Bayesthresh)
S3method(summary, Bayesthresh)
22 changes: 22 additions & 0 deletions R/Bayes.factor.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Bayes.factor <- function(model1, model2)
{
if(!inherits(model1, "Bayesthresh"))
stop("Model1 does not belong a class Bayesthresh")
if(!inherits(model2, "Bayesthresh"))
stop("Model2 does not belong a class Bayesthresh")
veros1 <- 1/((1/model1$inter$ef.iter)*(as.numeric(model1$lik)))
Postmean1 <- veros1[1]
veros2 <- 1/((1/model2$inter$ef.iter)*(as.numeric(model2$lik)))
Postmean2 <- veros2[1]
bf <- Postmean1/Postmean2
result <- data.frame(bf)
rownames(result) <- c("model1/model2")
colnames(result) <- c("Bayes factor")
cat("\nBayes factor for comparison two models\n")
cat("\n \n")
cat("Model 1:", deparse(model1$formula), fill=TRUE )
cat("Model 2:", deparse(model2$formula), "\n")
cat("\n \n")
print(result)
}

0 comments on commit d9a08d1

Please sign in to comment.