diff --git a/Project.toml b/Project.toml index efd45cf..913b2f3 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "CRRao" uuid = "49d1be55-416f-4ec4-9ddf-53cbbcddc063" authors = ["xKDR Forum, Sourish Das"] -version = "0.1.0" +version = "0.1.1" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" diff --git a/docs/make.jl b/docs/make.jl index 020c4d2..5dff179 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -23,8 +23,7 @@ makedocs(; "Frequentist Regression Models" => "api/frequentist_regression.md", "Bayesian Regression Models" => "api/bayesian_regression.md" ] - ], - strict = :doctest + ] ) deploydocs(; diff --git a/docs/src/api/bayesian_regression.md b/docs/src/api/bayesian_regression.md index b0ad4eb..018096c 100644 --- a/docs/src/api/bayesian_regression.md +++ b/docs/src/api/bayesian_regression.md @@ -8,6 +8,7 @@ BayesianRegression ### Linear Regression with User Specific Gaussian Prior ```@docs +fit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, prior::Prior_Gauss, alpha_prior_mean::Float64, beta_prior_mean::Vector{Float64}, sim_size::Int64 = 1000) fit(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) ``` @@ -80,7 +81,7 @@ fit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior ### Negative Binomial Regression with HorseShoe Prior ```@docs -fit(formula::FormulaTerm,data::DataFrame,modelClass::NegBinomRegression,prior::Prior_HorseShoe,sim_size::Int64 = 1000) +fit(formula::FormulaTerm,data::DataFrame,modelClass::NegBinomRegression,prior::Prior_HorseShoe, h::Float64 = 1.0, sim_size::Int64 = 1000) ``` ## Poisson Regression @@ -105,4 +106,4 @@ fit(formula::FormulaTerm, data::DataFrame, modelClass::PoissonRegression, prior: ### Poisson Regression with Horse Shoe Prior ```@docs fit(formula::FormulaTerm,data::DataFrame,modelClass::PoissonRegression,prior::Prior_HorseShoe,sim_size::Int64 = 1000) -``` \ No newline at end of file +``` diff --git a/docs/src/api/frequentist_regression.md b/docs/src/api/frequentist_regression.md index bdec4a6..3fc17d0 100644 --- a/docs/src/api/frequentist_regression.md +++ b/docs/src/api/frequentist_regression.md @@ -7,6 +7,19 @@ FrequentistRegression ## Linear Regression ```@docs fit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression) +fit(formula::FormulaTerm, data::DataFrame, modelClass::LinearRegression, bootstrap::Boot_Residual, sim_size::Int64 = 1000) +``` + +### With bootstrap +Fitting linear regression while estimating the standard error using bootstrap statistics. +```@docs +Boot_Residual +``` + +### Breusch-Pagan Lagrange Multiplier test for heteroscedasticity +Breusch-Pagan tests the homoscedasticity assumption of the residual variance in linear regression. +```@docs +BPTest(container::FrequentistRegression, data::DataFrame) ``` ## Logistic Regression @@ -30,6 +43,7 @@ fit(formula::FormulaTerm, data::DataFrame, modelClass::PoissonRegression) ## Extended functions from [StatsAPI.jl](https://github.com/JuliaStats/StatsAPI.jl) ```@docs +coef(container::FrequentistRegression) coeftable(container::FrequentistRegression) r2(container::FrequentistRegression) adjr2(container::FrequentistRegression) @@ -40,4 +54,4 @@ sigma(container::FrequentistRegression) predict(container::FrequentistRegression) residuals(container::FrequentistRegression) cooksdistance(container::FrequentistRegression) -``` \ No newline at end of file +``` diff --git a/docs/src/man/guide.md b/docs/src/man/guide.md index 6070ce5..c4b710c 100644 --- a/docs/src/man/guide.md +++ b/docs/src/man/guide.md @@ -50,7 +50,7 @@ sigma(model) We can also get the predicted response of the model, along with other measures like the vector of Cook's distances using the [`predict`](@ref) and [`cooksdistance`](@ref) functions exported by CRRao. Here's a plot of the vector of Cook's distances. -```@example ols_linear_regression +```@repl ols_linear_regression plot(cooksdistance(model)) ``` diff --git a/src/bayesian/negativebinomial_regression.jl b/src/bayesian/negativebinomial_regression.jl index 20638ab..e2f8a47 100644 --- a/src/bayesian/negativebinomial_regression.jl +++ b/src/bayesian/negativebinomial_regression.jl @@ -16,7 +16,7 @@ end """ ```julia -fit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Ridge, h::Float64 = 0.1, sim_size::Int64 = 1000) +fit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Ridge, h::Float64 = 1.0, sim_size::Int64 = 1000) ``` Fit a Bayesian Negative Binomial Regression model on the input data with a Ridge prior. @@ -103,7 +103,7 @@ function fit( data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Ridge, - h::Float64 = 0.1, + h::Float64 = 1.0, sim_size::Int64 = 1000 ) @model NegativeBinomialRegression(X, y) = begin @@ -218,7 +218,7 @@ function fit( data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Laplace, - h::Float64 = 0.1, + h::Float64 = 1.0, sim_size::Int64 = 1000 ) @model NegativeBinomialRegression(X, y) = begin @@ -511,6 +511,7 @@ function fit( data::DataFrame, modelClass::NegBinomRegression, prior::Prior_HorseShoe, + h::Float64 = 1.0, sim_size::Int64 = 1000 ) @model NegativeBinomialRegression(X, y) = begin @@ -523,11 +524,11 @@ function fit( τ ~ halfcauchy ## Global Shrinkage λ ~ filldist(halfcauchy, p) ## Local Shrinkage - σ ~ halfcauchy + σ ~ InverseGamma(h, h) #α ~ Normal(0, τ * σ) β0 = repeat([0], p) ## prior mean - β ~ MvNormal(β0, λ * τ *σ) - + # β ~ MvNormal(β0, λ * τ *σ) + β ~ MvNormal(β0, λ * τ) ## link #z = α .+ X * β diff --git a/test/numerical/bayesian/LogisticRegression.jl b/test/numerical/bayesian/LogisticRegression.jl index 07aa246..470d66b 100644 --- a/test/numerical/bayesian/LogisticRegression.jl +++ b/test/numerical/bayesian/LogisticRegression.jl @@ -40,8 +40,8 @@ tests = [ ( Prior_HorseShoe(), ( - (Logit(), 0.38683395333332327), - (Probit(), 0.38253233489484173), + (Logit(), 0.7599999999740501), + (Probit(), 0.7580564600751047), (Cloglog(), 0.7667553778881738), (Cauchit(), 0.7706755564626601) )