Skip to main content
added 146 characters in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80

I submitted this question to answer it myself, since I recently updated my Bayesian inference repository on GitHub with a function called BayesianLinearRegression that does just this. I wrote a general introduction to its functionalities on the Wolfram Community and Wolfram Blog and the example notebook on GitHub shows some more advanced uses of the function. I also submitted the function to the Wolfram function repository and you can use this version simply by evaluating:

I submitted this question to answer it myself, since I recently updated my Bayesian inference repository on GitHub with a function called BayesianLinearRegression that does just this. I wrote a general introduction to its functionalities on the Wolfram Community and the example notebook on GitHub shows some more advanced uses of the function. I also submitted the function to the Wolfram function repository and you can use this version simply by evaluating:

I submitted this question to answer it myself, since I recently updated my Bayesian inference repository on GitHub with a function called BayesianLinearRegression that does just this. I wrote a general introduction to its functionalities on the Wolfram Community and Wolfram Blog and the example notebook on GitHub shows some more advanced uses of the function. I also submitted the function to the Wolfram function repository and you can use this version simply by evaluating:

deleted 2 characters in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
  1. "PredictiveDistribution": A distribution that depends on the independent variables (x in the example above). By filling in a value for x, you get a distribution that tells you where you could expect to find future y values. This distribution accounts for all relevant uncertainties in the model: model variance caused by the term eps; uncertainty in the values of a and b; and uncertainty in sigma.

  2. "UnderlyingValueDistribution": Similar to "PredictiveDistribution", but this distribution givegives the possible values of a + b x without the eps error term.

  3. "RegressionCoefficientDistribution": The joinjoint distribution over a and b.

  4. "ErrorDistribution": The distribution of the variance sigma^2.

People familiar with Bayesian analysis may note that one distribution is absent: the full joint distribution over a, b and sigma all together (I only gave the marginals over a and b on one hand and sigma on the other). This is because Mathematica doesn't really offer a convenient framework for representing this distribution, unfortunately.

  1. "PredictiveDistribution": A distribution that depends on the independent variables (x in the example above). By filling in a value for x, you get a distribution that tells you where you could expect to find future y values. This distribution accounts for all relevant uncertainties in the model: model variance caused by the term eps; uncertainty in the values of a and b; and uncertainty in sigma.

  2. "UnderlyingValueDistribution": Similar to "PredictiveDistribution", but this distribution give the possible values of a + b x without the eps error term.

  3. "RegressionCoefficientDistribution": The join distribution over a and b.

  4. "ErrorDistribution": The distribution of the variance sigma^2.

People familiar with Bayesian analysis may note that one distribution is absent: the full joint distribution over a, b and sigma all together (I only gave the marginals over a and b on one hand and sigma on the other). This is because Mathematica doesn't really offer a convenient framework for representing this distribution, unfortunately.

  1. "PredictiveDistribution": A distribution that depends on the independent variables (x in the example above). By filling in a value for x, you get a distribution that tells you where you could expect to find future y values. This distribution accounts for all relevant uncertainties in the model: model variance caused by the term eps; uncertainty in the values of a and b; and uncertainty in sigma.

  2. "UnderlyingValueDistribution": Similar to "PredictiveDistribution", but this distribution gives the possible values of a + b x without the eps error term.

  3. "RegressionCoefficientDistribution": The joint distribution over a and b.

  4. "ErrorDistribution": The distribution of the variance sigma^2.

People familiar with Bayesian analysis may note that one distribution is absent: the full joint distribution over a, b and sigma together (I only gave the marginals over a and b on one hand and sigma on the other). This is because Mathematica doesn't really offer a convenient framework for representing this distribution, unfortunately.

added 1 character in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80

BayesianLinearRegression uses the same syntax as LinearModelFit. In addition, it also supports Rule-based definitions of input-output data as used by Predict (i.e., data of the form {x1 -> y1, ...} or {x1, x2, ...} -> {y1, y2, ...}). This format is particularly useful for multivariate regression (i.e., when the y values are vectors), which is also supported by BayesianLinearRegression.

BayesianLinearRegression uses the same syntax as LinearModelFit. In addition, it also supports Rule-based definitions of input-output data as used by Predict (i.e., data of the form {x1 -> y1, ...} or {x1, x2, ...} -> {y1, y2, ...}. This format is particularly useful for multivariate regression (i.e., when the y values are vectors), which is also supported by BayesianLinearRegression.

BayesianLinearRegression uses the same syntax as LinearModelFit. In addition, it also supports Rule-based definitions of input-output data as used by Predict (i.e., data of the form {x1 -> y1, ...} or {x1, x2, ...} -> {y1, y2, ...}). This format is particularly useful for multivariate regression (i.e., when the y values are vectors), which is also supported by BayesianLinearRegression.

added 12 characters in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
Loading
added 195 characters in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
Loading
Update link to point to a release tag instead (so future updates can't break the examples).
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
Loading
deleted 6 characters in body
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323
Loading
added 6 characters in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
Loading
added 77 characters in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
Loading
added 1 character in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
Loading
added 357 characters in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
Loading
added 1953 characters in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
Loading
added 77 characters in body
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
Loading
Source Link
Sjoerd Smit
  • 24.8k
  • 48
  • 80
Loading