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

Add basic documentation to negbin #301

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ x2 -0.152062 0.124931 -1.21717 0.2582
glm
fit
lm
negbin
```

## Model methods
Expand Down
2 changes: 1 addition & 1 deletion src/GLM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module GLM
glm, # general interface
linpred, # linear predictor
lm, # linear model
negbin, # interface to fitting genative binomial regression
negbin, # interface to fitting negative binomial regression
nobs, # total number of observations
predict, # make predictions
ftest # compare models with an F test
Expand Down
23 changes: 23 additions & 0 deletions src/negbinfit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ function mle_for_θ(y::AbstractVector, μ::AbstractVector, wts::AbstractVector;
θ
end

"""
negbin(formula,
data,
link;
initialθ::Real=Inf,
maxiter::Integer=30,
atol::Real=1e-6,
rtol::Real=1.e-6,
verbose::Bool=false,
kwargs...)

Fit a negative binomial generalized linear model to data, while simultaneously
estimating the shape parameter θ. Extra arguments and keyword arguments will be
passed to [`glm`](@ref).

# Keyword Arguments
- `initialθ::Real=Inf`: Starting value for shape parameter θ. If it is `Inf`
then the initial value will be estimated by fitting a Poisson distribution.
- `maxiter::Integer=30`: See `maxiter` for [`glm`](@ref)
- `atol::Real=1.0e-6`: See `atol` for [`glm`](@ref)
- `rtol::Real=1.0e-6`: See `rtol` for [`glm`](@ref)
- `verbose::Bool=false`: See `verbose` for [`glm`](@ref)
"""
function negbin(F,
D,
args...;
Expand Down