Skip to content

Commit 4f02efa

Browse files
authored
Use function definitions in StatsAPI (#744)
1 parent 3ff13c5 commit 4f02efa

File tree

8 files changed

+21
-435
lines changed

8 files changed

+21
-435
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ DataStructures = "0.10, 0.11, 0.12, 0.13, 0.14, 0.17, 0.18"
2222
LogExpFunctions = "0.3"
2323
Missings = "0.3, 0.4, 1.0"
2424
SortingAlgorithms = "0.3, 1.0"
25-
StatsAPI = "1"
25+
StatsAPI = "1.2"
2626
julia = "1"
2727

2828
[extras]

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
4+
StatsAPI = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
45

56
[compat]
67
Documenter = "0.24"

docs/make.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Documenter, StatsBase, Statistics, Random, LinearAlgebra
1+
using Documenter, StatsBase, StatsAPI, Statistics, Random, LinearAlgebra
22

33
# Workaround for JuliaLang/julia/pull/28625
44
if Base.HOME_PROJECT[] !== nothing
@@ -7,7 +7,7 @@ end
77

88
makedocs(
99
sitename = "StatsBase.jl",
10-
modules = [StatsBase],
10+
modules = [StatsBase, StatsAPI],
1111
pages = ["index.md",
1212
"weights.md",
1313
"scalarstats.md",
@@ -29,4 +29,4 @@ makedocs(
2929

3030
deploydocs(
3131
repo = "github.com/JuliaStats/StatsBase.jl.git"
32-
)
32+
)

docs/src/statmodels.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Abstraction for Statistical Models
22

3-
This package defines an abstract type `StatisticalModel`, and an abstract subtype `RegressionModel`.
3+
[StatsAPI.jl](https://github.com/JuliaStats/StatsAPI.jl) defines an abstract type `StatisticalModel`,
4+
and an abstract subtype `RegressionModel`. They are both extended by StatsBase, and documented here.
45

56
Particularly, instances of `StatisticalModel` implement the following methods.
67

@@ -30,7 +31,7 @@ rss
3031
score
3132
stderror
3233
vcov
33-
weights(::StatisticalModel)
34+
weights
3435
```
3536

3637
`RegressionModel` extends `StatisticalModel` by implementing the following additional methods.
@@ -52,4 +53,4 @@ residuals
5253
An exception type is provided to signal convergence failures during model estimation:
5354
```@docs
5455
ConvergenceException
55-
```
56+
```

docs/src/weights.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,5 @@ fweights
149149
pweights
150150
eweights
151151
uweights
152-
weights
152+
weights(vs::AbstractArray{<:Real})
153153
```

src/StatsBase.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ import LinearAlgebra: BlasReal, BlasFloat
2020
import Statistics: mean, mean!, var, varm, varm!, std, stdm, cov, covm,
2121
cor, corm, cov2cor!, unscaled_covzm, quantile, sqrt!,
2222
median, middle
23-
import StatsAPI: pairwise, pairwise!
23+
using StatsAPI: StatisticalModel, RegressionModel
24+
import StatsAPI: pairwise, pairwise!, params, params!,
25+
fitted, response, responsename, meanresponse, modelmatrix,
26+
crossmodelmatrix, leverage, cooksdistance, residuals, predict,
27+
predict!, dof_residual, coef, coefnames, coeftable, confint,
28+
deviance, islinear, nulldeviance, loglikelihood, nullloglikelihood,
29+
loglikelihood, loglikelihood, score, nobs, dof, mss, rss,
30+
informationmatrix, stderror, vcov, weights, isfitted, fit, fit!,
31+
aic, aicc, bic, r2, r², adjr2
2432

2533
## tackle compatibility issues
2634

0 commit comments

Comments
 (0)