Bayesian Regression Models
CRRao.BayesianRegression
— TypeBayesianRegression{RegressionType}
Type to represent bayesian regression models returned by fit
functions. This type is used internally by the package to represent all bayesian regression models. RegressionType
is a Symbol
representing the model class.
Linear Regression
Linear Regression with User Specific Gaussian Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Gauss, alpha_prior_mean::Float64, alpha_prior_sd::Float64, beta_prior_mean::Vector{Float64}, beta_prior_sd::Vector{Float64}, sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a Gaussian prior with user specific prior mean and sd for α and β.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+Bayesian Regression Models · CRRao.jl Bayesian Regression Models
CRRao.BayesianRegression
— TypeBayesianRegression{RegressionType}
Type to represent bayesian regression models returned by fit
functions. This type is used internally by the package to represent all bayesian regression models. RegressionType
is a Symbol
representing the model class.
sourceLinear Regression
Linear Regression with User Specific Gaussian Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Gauss, alpha_prior_mean::Float64, alpha_prior_sd::Float64, beta_prior_mean::Vector{Float64}, beta_prior_sd::Vector{Float64}, sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a Gaussian prior with user specific prior mean and sd for α and β.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> df = dataset("datasets", "mtcars");
julia> CRRao.set_rng(StableRNG(123));
julia> container = fit(@formula(MPG ~ HP + WT + Gear), df, LinearRegression(), Prior_Gauss(),30.0,10.0,[0.0,-3.0,1.0],[0.1,1.0,1.0],1000)
@@ -33,7 +33,7 @@
β[1] 24.9976 29.6654 31.4881 33.5860 37.6309
β[2] -0.0546 -0.0430 -0.0373 -0.0311 -0.0200
β[3] -4.2471 -3.5287 -3.1438 -2.7626 -1.9238
- β[4] -0.0285 0.7312 1.0926 1.4948 2.1519
sourceLinear Regression with Ridge Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Ridge, h::Float64 = 0.01, sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a Ridge prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+ β[4] -0.0285 0.7312 1.0926 1.4948 2.1519
sourceLinear Regression with Ridge Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Ridge, h::Float64 = 0.01, sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a Ridge prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> df = dataset("datasets", "mtcars")
32×12 DataFrame
Row │ Model MPG Cyl Disp HP DRat WT QSec VS AM Gear Carb
@@ -84,7 +84,7 @@
β[1] 17.0694 25.0878 28.6635 32.2368 39.1438
β[2] -0.0594 -0.0462 -0.0398 -0.0327 -0.0198
β[3] -4.5435 -3.3350 -2.6938 -2.1350 -0.7247
- β[4] -0.2647 0.9636 1.5983 2.2412 3.6841
sourceLinear Regression with Laplace Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Laplace, h::Float64 = 0.01, sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a Laplace prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+ β[4] -0.2647 0.9636 1.5983 2.2412 3.6841
sourceLinear Regression with Laplace Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Laplace, h::Float64 = 0.01, sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a Laplace prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> df = dataset("datasets", "mtcars")
32×12 DataFrame
Row │ Model MPG Cyl Disp HP DRat WT QSec VS AM Gear Carb
@@ -133,7 +133,7 @@
β[1] 17.7583 25.3061 28.8668 32.2456 38.1808
β[2] -0.0615 -0.0469 -0.0398 -0.0329 -0.0187
β[3] -4.4721 -3.3004 -2.7042 -2.0441 -0.7107
- β[4] -0.1806 0.8682 1.5224 2.1637 3.6193
sourceLinear Regression with Cauchy Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Cauchy, sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a Cauchy prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+ β[4] -0.1806 0.8682 1.5224 2.1637 3.6193
sourceLinear Regression with Cauchy Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Cauchy, sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a Cauchy prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> df = dataset("datasets", "mtcars")
32×12 DataFrame
Row │ Model MPG Cyl Disp HP DRat WT QSec VS AM Gear Carb
@@ -181,7 +181,7 @@
β[1] 20.5220 26.8878 30.1467 33.4241 38.9193
β[2] -0.0600 -0.0454 -0.0400 -0.0334 -0.0192
β[3] -4.4784 -3.3625 -2.8345 -2.2815 -1.1017
- β[4] -0.2688 0.6897 1.3047 1.8932 3.0914
sourceLinear Regression with T-distributed Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_TDist, h::Float64 = 2.0, sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a t(ν) distributed prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsPlots, StatsModels
+ β[4] -0.2688 0.6897 1.3047 1.8932 3.0914
sourceLinear Regression with T-distributed Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_TDist, h::Float64 = 2.0, sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a t(ν) distributed prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsPlots, StatsModels
julia> df = dataset("datasets", "mtcars")
32×12 DataFrame
Row │ Model MPG Cyl Disp HP DRat WT QSec VS AM Gear Carb
@@ -233,7 +233,7 @@
β[3] -4.3684 -3.3394 -2.8206 -2.2711 -1.0594
β[4] -0.2602 0.7464 1.3014 1.8909 3.1216
-julia> plot(container.chain)
sourceLinear Regression with Horse Shoe Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm,data::DataFrame,modelClass::LinearRegression,prior::Prior_HorseShoe,sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a HorseShoe prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsPlots, StatsModels
+julia> plot(container.chain)
sourceLinear Regression with Horse Shoe Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm,data::DataFrame,modelClass::LinearRegression,prior::Prior_HorseShoe,sim_size::Int64 = 1000)
Fit a Bayesian Linear Regression model on the input data with a HorseShoe prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsPlots, StatsModels
julia> df = dataset("datasets", "mtcars");
julia> CRRao.set_rng(StableRNG(123));
julia> container = fit(@formula(MPG ~ HP + WT + Gear), df, LinearRegression(), Prior_HorseShoe())
@@ -279,7 +279,7 @@
β[3] -4.7741 -3.6626 -3.1250 -2.5222 -1.0155
β[4] -0.3640 0.3357 0.8594 1.4728 2.8541
-julia> plot(container.chain)
sourceLogistic Regression
Logistic Regression with Ridge Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LogisticRegression, Link::CRRaoLink, prior::Prior_Ridge, h::Float64 = 0.1, level::Float64 = 0.95, sim_size::Int64 = 1000)
Fit a Bayesian Logistic Regression model on the input data with a Ridge prior with the provided Link
function.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+julia> plot(container.chain)
sourceLogistic Regression
Logistic Regression with Ridge Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LogisticRegression, Link::CRRaoLink, prior::Prior_Ridge, h::Float64 = 0.1, level::Float64 = 0.95, sim_size::Int64 = 1000)
Fit a Bayesian Logistic Regression model on the input data with a Ridge prior with the provided Link
function.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> turnout = dataset("Zelig", "turnout")
2000×5 DataFrame
Row │ Race Age Educate Income Vote
@@ -437,7 +437,7 @@
β[3] -0.1352 0.0549 0.1552 0.2700 0.4495
β[4] 0.1679 0.2128 0.2384 0.2667 0.3222
β[5] 0.1142 0.1420 0.1580 0.1754 0.2121
-
sourceLogistic Regression with Laplace Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LogisticRegression, Link::CRRaoLink, prior::Prior_Laplace, h::Float64 = 0.1, level::Float64 = 0.95, sim_size::Int64 = 1000)
Fit a Bayesian Logistic Regression model on the input data with a Laplace prior with the provided Link
function.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+
sourceLogistic Regression with Laplace Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LogisticRegression, Link::CRRaoLink, prior::Prior_Laplace, h::Float64 = 0.1, level::Float64 = 0.95, sim_size::Int64 = 1000)
Fit a Bayesian Logistic Regression model on the input data with a Laplace prior with the provided Link
function.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> CRRao.set_rng(StableRNG(123))
StableRNGs.LehmerRNG(state=0x000000000000000000000000000000f7)
julia> turnout = dataset("Zelig", "turnout")
@@ -590,7 +590,7 @@
β[2] 0.0210 0.0260 0.0293 0.0319 0.0380
β[3] -0.1352 0.0447 0.1375 0.2297 0.4357
β[4] 0.1680 0.2130 0.2378 0.2663 0.3196
- β[5] 0.1178 0.1461 0.1615 0.1769 0.2070
sourceLogistic Regression with Cauchy Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LogisticRegression, Link::CRRaoLink, prior::Prior_Cauchy, h::Float64 = 0.1, level::Float64 = 0.95, sim_size::Int64 = 1000)
Fit a Bayesian Logistic Regression model on the input data with a Cauchy prior with the provided Link
function.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+ β[5] 0.1178 0.1461 0.1615 0.1769 0.2070
sourceLogistic Regression with Cauchy Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LogisticRegression, Link::CRRaoLink, prior::Prior_Cauchy, h::Float64 = 0.1, level::Float64 = 0.95, sim_size::Int64 = 1000)
Fit a Bayesian Logistic Regression model on the input data with a Cauchy prior with the provided Link
function.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> CRRao.set_rng(StableRNG(123))
StableRNGs.LehmerRNG(state=0x000000000000000000000000000000f7)
julia> turnout = dataset("Zelig", "turnout")
@@ -738,7 +738,7 @@
β[2] 0.0211 0.0270 0.0301 0.0329 0.0384
β[3] -0.1105 0.0282 0.1117 0.2168 0.3907
β[4] 0.1603 0.2064 0.2324 0.2627 0.3157
- β[5] 0.1166 0.1501 0.1669 0.1839 0.2152
sourceLogistic Regression with T-Distributed Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LogisticRegression, Link::CRRaoLink, prior::Prior_TDist, h::Float64 = 1.0, level::Float64 = 0.95, sim_size::Int64 = 1000)
Fit a Bayesian Logistic Regression model on the input data with a T-Dist prior with the provided Link
function.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+ β[5] 0.1166 0.1501 0.1669 0.1839 0.2152
sourceLogistic Regression with T-Distributed Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LogisticRegression, Link::CRRaoLink, prior::Prior_TDist, h::Float64 = 1.0, level::Float64 = 0.95, sim_size::Int64 = 1000)
Fit a Bayesian Logistic Regression model on the input data with a T-Dist prior with the provided Link
function.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> CRRao.set_rng(StableRNG(123))
StableRNGs.LehmerRNG(state=0x000000000000000000000000000000f7)
julia> turnout = dataset("Zelig", "turnout")
@@ -911,7 +911,7 @@
β[2] 0.0218 0.0271 0.0300 0.0330 0.0388
β[3] -0.1336 0.0643 0.1646 0.2552 0.4311
β[4] 0.1592 0.2092 0.2368 0.2650 0.3271
- β[5] 0.1218 0.1508 0.1661 0.1819 0.2157
sourceLogistic Regression with Horse Shoe Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm,data::DataFrame,modelClass::LogisticRegression,Link::CRRaoLink,prior::Prior_HorseShoe,level::Float64 = 0.95,sim_size::Int64 = 1000)
Fit a Bayesian Logistic Regression model on the input data with a HorseShoe prior with the provided Link
function.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+ β[5] 0.1218 0.1508 0.1661 0.1819 0.2157
sourceLogistic Regression with Horse Shoe Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm,data::DataFrame,modelClass::LogisticRegression,Link::CRRaoLink,prior::Prior_HorseShoe,level::Float64 = 0.95,sim_size::Int64 = 1000)
Fit a Bayesian Logistic Regression model on the input data with a HorseShoe prior with the provided Link
function.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> turnout = dataset("Zelig", "turnout");
julia> CRRao.set_rng(StableRNG(7740))
julia> container_logit = fit(@formula(Vote ~ Age + Race + Income + Educate), turnout, LogisticRegression(), Logit(), Prior_HorseShoe())
@@ -1098,7 +1098,7 @@
β[3] -0.1005 0.0049 0.0767 0.1826 0.4019
β[4] 0.1614 0.2127 0.2382 0.2638 0.3140
β[5] 0.1201 0.1472 0.1657 0.1804 0.2148
-
sourceNegative Binomial Regression
Negative Binomial Regression with Ridge Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Ridge, h::Float64 = 0.1, sim_size::Int64 = 1000)
Fit a Bayesian Negative Binomial Regression model on the input data with a Ridge prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+
sourceNegative Binomial Regression
Negative Binomial Regression with Ridge Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Ridge, h::Float64 = 0.1, sim_size::Int64 = 1000)
Fit a Bayesian Negative Binomial Regression model on the input data with a Ridge prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> sanction = dataset("Zelig", "sanction")
78×8 DataFrame
Row │ Mil Coop Target Import Export Cost Num NCost
@@ -1170,7 +1170,7 @@
0.9868233460913254
24.39047761169405
1.1542620442281972
-8.219200484970807
sourceNegative Binomial Regression with Laplace Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Laplace, h::Float64 = 0.01, sim_size::Int64 = 1000)
Fit a Bayesian Negative Binomial Regression model on the input data with a Laplace prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+8.219200484970807
sourceNegative Binomial Regression with Laplace Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Laplace, h::Float64 = 0.01, sim_size::Int64 = 1000)
Fit a Bayesian Negative Binomial Regression model on the input data with a Laplace prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> sanction = dataset("Zelig", "sanction")
78×8 DataFrame
Row │ Mil Coop Target Import Export Cost Num NCost
@@ -1242,7 +1242,7 @@
1.0011451666062938
23.744012407689187
1.1547110091441486
-8.611185000528977
sourceNegative Binomial Regression with Cauchy Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Cauchy, h::Float64 = 1.0, sim_size::Int64 = 1000)
Fit a Bayesian Negative Binomial Regression model on the input data with a Cauchy prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+8.611185000528977
sourceNegative Binomial Regression with Cauchy Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Cauchy, h::Float64 = 1.0, sim_size::Int64 = 1000)
Fit a Bayesian Negative Binomial Regression model on the input data with a Cauchy prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> sanction = dataset("Zelig", "sanction")
78×8 DataFrame
Row │ Mil Coop Target Import Export Cost Num NCost
@@ -1299,7 +1299,7 @@
β[4] -1.1899 -0.5662 -0.1798 0.1778 0.9467
β[5] 0.6384 1.0495 1.2673 1.4884 1.9266
β[6] -0.4275 -0.0388 0.1676 0.3465 0.7206
-
sourceNegative Binomial Regression with T-Distributed Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_TDist, h::Float64 = 1.0, sim_size::Int64 = 1000)
Fit a Bayesian Negative Binomial Regression model on the input data with a t(ν) distributed prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+
sourceNegative Binomial Regression with T-Distributed Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_TDist, h::Float64 = 1.0, sim_size::Int64 = 1000)
Fit a Bayesian Negative Binomial Regression model on the input data with a t(ν) distributed prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> sanction = dataset("Zelig", "sanction")
78×8 DataFrame
Row │ Mil Coop Target Import Export Cost Num NCost
@@ -1354,7 +1354,7 @@
β[4] -1.2265 -0.5194 -0.1622 0.2064 0.8424
β[5] 0.6213 1.0451 1.2792 1.4909 1.8955
β[6] -0.4084 -0.0453 0.1477 0.3433 0.7080
-
sourceNegative Binomial Regression with HorseShoe Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm,data::DataFrame,modelClass::NegBinomRegression,prior::Prior_HorseShoe,sim_size::Int64 = 1000)
Fit a Bayesian Negative Binomial Regression model on the input data with a HorseShoe prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsPlots, StatsModels
+
sourceNegative Binomial Regression with HorseShoe Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm,data::DataFrame,modelClass::NegBinomRegression,prior::Prior_HorseShoe,sim_size::Int64 = 1000)
Fit a Bayesian Negative Binomial Regression model on the input data with a HorseShoe prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsPlots, StatsModels
julia> sanction = dataset("Zelig", "sanction");
julia> CRRao.set_rng(StableRNG(123))
julia> container = fit(@formula(Num ~ Target + Coop + NCost), sanction, NegBinomRegression(), Prior_HorseShoe())
@@ -1406,7 +1406,7 @@
β[3] 0.7268 0.8657 0.9770 1.0755 1.2406
β[4] -0.9419 -0.2720 -0.0234 0.1072 0.6187
β[5] 0.6108 1.0708 1.2936 1.5336 1.8016
- β[6] -0.3937 -0.1448 -0.0029 0.1130 0.4378
sourcePoisson Regression
Poisson Regression with Ridge Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::PoissonRegression, prior::Prior_Ridge, h::Float64 = 0.1, sim_size::Int64 = 1000)
Fit a Bayesian Poisson Regression model on the input data with a Ridge prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+ β[6] -0.3937 -0.1448 -0.0029 0.1130 0.4378
sourcePoisson Regression
Poisson Regression with Ridge Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::PoissonRegression, prior::Prior_Ridge, h::Float64 = 0.1, sim_size::Int64 = 1000)
Fit a Bayesian Poisson Regression model on the input data with a Ridge prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> sanction = dataset("Zelig", "sanction")
78×8 DataFrame
Row │ Mil Coop Target Import Export Cost Num NCost
@@ -1479,7 +1479,7 @@
23.451157821412178
1.0317165509592108
5.726972543900231
-
sourcePoisson Regression with Laplace Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::PoissonRegression, prior::Prior_Laplace, h::Float64 = 0.1, sim_size::Int64 = 1000)
Fit a Bayesian Poisson Regression model on the input data with a Laplace prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+
sourcePoisson Regression with Laplace Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::PoissonRegression, prior::Prior_Laplace, h::Float64 = 0.1, sim_size::Int64 = 1000)
Fit a Bayesian Poisson Regression model on the input data with a Laplace prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> sanction = dataset("Zelig", "sanction")
78×8 DataFrame
Row │ Mil Coop Target Import Export Cost Num NCost
@@ -1549,7 +1549,7 @@
0.7892315194893381
23.288584913402246
1.0177004055294072
- 5.759286021571133
sourcePoisson Regression with Cauchy Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Cauchy, h::Float64 = 1.0, sim_size::Int64 = 1000)
Fit a Bayesian Poisson Regression model on the input data with a Cauchy prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+ 5.759286021571133
sourcePoisson Regression with Cauchy Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Cauchy, h::Float64 = 1.0, sim_size::Int64 = 1000)
Fit a Bayesian Poisson Regression model on the input data with a Cauchy prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> sanction = dataset("Zelig", "sanction")
78×8 DataFrame
Row │ Mil Coop Target Import Export Cost Num NCost
@@ -1601,7 +1601,7 @@
β[3] 1.0131 1.0925 1.1303 1.1680 1.2368
β[4] -0.7701 -0.4356 -0.2757 -0.1448 0.1045
β[5] 1.5159 1.6388 1.7020 1.7689 1.9046
- β[6] 0.0738 0.2632 0.3881 0.5176 0.7230
sourcePoisson Regression with T-Distributed Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::PoissonRegression, prior::Prior_TDist, h::Float64 = 2.0, sim_size::Int64 = 1000)
Fit a Bayesian Poisson Regression model on the input data with a t(ν) distributed prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+ β[6] 0.0738 0.2632 0.3881 0.5176 0.7230
sourcePoisson Regression with T-Distributed Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm, data::DataFrame, modelClass::PoissonRegression, prior::Prior_TDist, h::Float64 = 2.0, sim_size::Int64 = 1000)
Fit a Bayesian Poisson Regression model on the input data with a t(ν) distributed prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> CRRao.set_rng(StableRNG(123))
StableRNGs.LehmerRNG(state=0x000000000000000000000000000000f7)
julia> sanction = dataset("Zelig", "sanction")
@@ -1657,7 +1657,7 @@
β[3] 1.0322 1.0932 1.1310 1.1688 1.2362
β[4] -0.7680 -0.4694 -0.3020 -0.1519 0.1128
β[5] 1.5030 1.6252 1.7037 1.7682 1.8936
- β[6] 0.0701 0.2710 0.3911 0.5023 0.7236
sourcePoisson Regression with Horse Shoe Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm,data::DataFrame,modelClass::PoissonRegression,prior::Prior_HorseShoe,sim_size::Int64 = 1000)
Fit a Bayesian Poisson Regression model on the input data with a Horse Shoe prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
+ β[6] 0.0701 0.2710 0.3911 0.5023 0.7236
sourcePoisson Regression with Horse Shoe Prior
StatsAPI.fit
— Functionfit(formula::FormulaTerm,data::DataFrame,modelClass::PoissonRegression,prior::Prior_HorseShoe,sim_size::Int64 = 1000)
Fit a Bayesian Poisson Regression model on the input data with a Horse Shoe prior.
Example
julia> using CRRao, RDatasets, StableRNGs, StatsModels
julia> sanction = dataset("Zelig", "sanction");
julia> CRRao.set_rng(StableRNG(123))
julia> container = fit(@formula(Num ~ Target + Coop + NCost), sanction, PoissonRegression(), Prior_HorseShoe())
@@ -1709,4 +1709,4 @@
β[5] 1.4992 1.6387 1.7051 1.7718 1.9102
β[6] 0.0305 0.2485 0.3763 0.4911 0.7002
julia> using StatsPlots
-julia> plot(container.chain)
sourceSettings
This document was generated with Documenter.jl version 0.27.24 on Sunday 5 March 2023. Using Julia version 1.8.5.
+julia> plot(container.chain)