Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing CI tests #147

Merged
merged 11 commits into from
Oct 23, 2024
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 1 addition & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ makedocs(;
"Frequentist Regression Models" => "api/frequentist_regression.md",
"Bayesian Regression Models" => "api/bayesian_regression.md"
]
],
strict = :doctest
]
)

deploydocs(;
Expand Down
5 changes: 3 additions & 2 deletions docs/src/api/bayesian_regression.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down Expand Up @@ -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
Expand All @@ -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)
```
```
16 changes: 15 additions & 1 deletion docs/src/api/frequentist_regression.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -40,4 +54,4 @@ sigma(container::FrequentistRegression)
predict(container::FrequentistRegression)
residuals(container::FrequentistRegression)
cooksdistance(container::FrequentistRegression)
```
```
2 changes: 1 addition & 1 deletion docs/src/man/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
```

Expand Down
13 changes: 7 additions & 6 deletions src/bayesian/negativebinomial_regression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 * β
Expand Down
4 changes: 2 additions & 2 deletions test/numerical/bayesian/LogisticRegression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down
Loading