Skip to content

Commit

Permalink
Add basic documentation to negbin (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
galenlynch authored and nalimilan committed Jan 21, 2020
1 parent 6534b83 commit 27d8ca9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
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

0 comments on commit 27d8ca9

Please sign in to comment.