Questions tagged [bayesian]

Bayesian (after Thomas Bayes) refers to methods in probability and statistics that involve quantifying uncertainty about parameter or latent variable estimates by incorporating both prior and observed information. Bayesian modeling, inference, optimization, and model comparison techniques are on topic. A programming element is expected; theoretical/methodological questions should go to https://stats.stackexchange.com.

Overview

Bayesian inference is a method of statistical inference which uses Bayes' theorem - named after Thomas Bayes (1702-1761) - to quantify the uncertainty of parameters or latent variables. The statement of Bayes' theorem in Bayesian inference is

enter image description here

Here θ represents the parameters to be inferred and d the data. P(θ|d) is the posterior probability and P(d|θ) is the likelihood function. P(θ) is the prior: a function encoding previous beliefs about θ within a model appropriate for the data. P(d) is a normalization factor.

The formula is used as an updating procedure: as more data become available, the posterior can be updated successively. In the first instance, the prior must be specified by the user. In later updates, the prior is usually chosen to be the posterior from a previous updating procedure.

References

The following threads contain lists of references:

The following journals are dedicated to research in Bayesian statistics:

Tag usage

Questions on tag should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

1808 questions
0
votes
1 answer

Calculating a custom probability distribution in python (numerically)

I have a custom (discrete) probability distribution defined somewhat in the form: f(x)/(sum(f(x')) for x' in a given discrete set X). Also, 0<=x<=1. So I have been trying to implement it in python 3.8.2, and the problem is that the numerator and…
0
votes
1 answer

How can I “translate” a statistical model defined on paper to the computer using R?

I have initially posted this question on stats.stackexchange.com, but it was closed due to being focused on programming. Hopefully, I can get any help here. I will not put many theoretical details here to make it simple, but my final goal is to…
bbublue
  • 25
  • 5
0
votes
0 answers

Is there a loop for contingencyTableBF

I am new to R and am looking for some help on automatically producing a series of contingencyTableBF objects for tables created from my data. I want to use such a contingency table as it generates Bayes Factor values for each table. I have searched…
0
votes
1 answer

How could I solve Dimension mismatch in Jags model.?

I'm super new in bayesian analysis and I'm trying to practice with an example for Classic Capture-recapture models: Mh2 This is my code nind <- dim(venados)[1] K <- 43 ntraps <- 13 M <- 150 nz <- M - nind Yaug <- array(0, dim = c(M, ntraps,…
SLV
  • 1
0
votes
1 answer

Need help w/ R code plotting error vs no. of samples in Markovian chain

I am new to R as well as Bayesian Statistics. I am going through the problem set in Chapter#12 of Students Guide to Bayesian Statistics (this link has problem as well as answer plot). In it Problem 12.4.3, author has provided a graph as the error vs…
Amsci Fi
  • 33
  • 3
0
votes
1 answer

Using bartCause package to predict uplift

I'm trying to use the bartCause package to build an uplift model in R. Unfortunately I have trouble to integrate the data frame in the right way - error message: $<-.data.frame`(`*tmp*`, "lift", value = c(0.159231848781688, : replacement has 160…
Marcel
  • 1
  • 1
0
votes
0 answers

Emcee with gaussian prior gives NaN

I've been using emcee to sampel my parameter, at first my prior were all uniform def logprior_BAO(theta): A, B, C, D, epsilon, rd = theta if A > 0 and B > 0 and C > 0 and D > 0 and epsilon > -5 and 146.96<=rd<=147.58: return 0.0 return…
0
votes
0 answers

Two-way bayesian ANOVA with Jags

I'm trying to perform 2-way bayesian ANOVA with jags, but there is an error I can not understand. ## data set.seed(123) n <- 30 y <- log(rnorm(n, 3, 1)) x1 <- as.numeric(c(1, 2, 1, 2, 2, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 1, 2, 2, 1, 1,…
0
votes
0 answers

How to calculate a Bayes estimator using Octave or MATLAB

I am reading a statistics textbook Introduction to Statistics for Engineers by Sheldon Ross, p.275 and trying to re-do its examples on paper and in Octave. I am not able to replicate many Bayes calculations in Octave when it comes to the integration…
0
votes
0 answers

Is there a way to fix this problem in the code?

for i in range(103): # we will run 100 experiments of GP => 100 befief updates of the good region. existing_bayesian_optimizer = os.path.isfile(out_dir + "ev_file_RL_ANN") # ev_file is a simple txt file (empty @ beginning) "warning \n" if…
0
votes
1 answer

When is the features independent in order to use NB classifier?

I am working with classification models and as I am new to it I have a question. It is said that Naive Bayes performs well when features are independent of each other. How do I know if features in my feature set are independent? Any example?…
user6058265
0
votes
1 answer

Posterior probabilities from function bic.glm in R

I'm looking at the posterior probabilities output from the function "bic.glm" in R, and they only have 3 digits displayed. Moreover, when I try "options(digits = 16)", I STILL only get posterior probabilities with 3 digits. My question has two…
Chris J
  • 23
  • 3
0
votes
0 answers

Questions about building a Bayesian network

Example: Suppose we choose the ordering M, J, A, B, E P(J | M) = P(J)? No P(A | J, M) = P(A | J)? P(A | J, M) = P(A)? No How do you know that P(A|J, M) = P(A) is the only condition that A depends on M? Is it possible that only J is dependent on A?
0
votes
2 answers

how to predict quality of data?

I'm very sorry if I'm wording this wrong in advance but I have a large dataset and I am trying to analyze it, but most of the data is not correct and need some help figuring out how to select the correct data. Here's some more information to clear…
Lostsoul
  • 25,013
  • 48
  • 144
  • 239
0
votes
2 answers

determine equal-tail credible interval

I have obtained the posterior density for part d: $2 theta^{-1}(1- theta)^{-1}$. How do I plot in R the distribution to find the l and u such that $F_{theta| x} (l) = 0.025$ and $F_{theta| x} (u) = 0.975$? (the equal-tail interval)
siegfried
  • 461
  • 1
  • 5
  • 20