Skip to content

Commit

Permalink
Delegate new functions for statistical models
Browse files Browse the repository at this point in the history
These were just added to StatsBase.
  • Loading branch information
nalimilan committed Mar 12, 2016
1 parent ea16d2b commit fd30845
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
@@ -1,6 +1,6 @@
julia 0.4
DataArrays 0.2.15
StatsBase 0.3.9+
StatsBase v0.8.0

This comment has been minimized.

Copy link
@tkelman

tkelman Mar 23, 2016

Contributor

the v is nonstandard

GZip
SortingAlgorithms
Reexport
Expand Down
13 changes: 10 additions & 3 deletions src/statsmodels/statsmodel.jl
Expand Up @@ -59,11 +59,18 @@ end

# Delegate functions from StatsBase that use our new types
typealias DataFrameModels @compat(Union{DataFrameStatisticalModel, DataFrameRegressionModel})
@delegate DataFrameModels.model [StatsBase.coef, StatsBase.confint, StatsBase.deviance,
StatsBase.loglikelihood, StatsBase.nobs, StatsBase.stderr,
StatsBase.vcov]
@delegate DataFrameModels.model [StatsBase.coef, StatsBase.confint,
StatsBase.deviance, StatsBase.nulldeviance,
StatsBase.loglikelihood, StatsBase.nullloglikelihood,
StatsBase.df, StatsBase.df_residual, StatsBase.nobs,
StatsBase.stderr, StatsBase.vcov]
@delegate DataFrameRegressionModel.model [StatsBase.residuals, StatsBase.model_response,
StatsBase.predict, StatsBase.predict!]
# Need to define these manually because of ambiguity using @delegate
StatsBase.R2(mm::DataFrameRegressionModel) = R2(mm.model)
StatsBase.adjR2(mm::DataFrameRegressionModel) = adjR2(mm.model)
StatsBase.R2(mm::DataFrameRegressionModel, variant::Symbol) = R2(mm.model, variant)
StatsBase.adjR2(mm::DataFrameRegressionModel, variant::Symbol) = adjR2(mm.model, variant)

# Predict function that takes data frame as predictor instead of matrix
function StatsBase.predict(mm::DataFrameRegressionModel, df::AbstractDataFrame)
Expand Down

0 comments on commit fd30845

Please sign in to comment.