Skip to content

Commit

Permalink
Merge pull request #19 from JuliaStats/anj/generic
Browse files Browse the repository at this point in the history
RFC:Add abstract types of generic functions
  • Loading branch information
johnmyleswhite committed Aug 29, 2013
2 parents 2a9e325 + be58da3 commit 2127b21
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/Stats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,25 @@ module Stats
cor_kendall,

# others
rle,
inverse_rle,
## Types
StatisticalModel,
RegressionModel,

## Fcuntions
coef,
coeftable,
confint,
ecdf,
findat

findat,
inverse_rle,
loglikelihood,
nobs,
predict,
residuals,
model_response,
rle,
stderr,
vcov

include("scalar_stats.jl")
include("weighted_stats.jl")
Expand Down
14 changes: 14 additions & 0 deletions src/others.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,18 @@ function ecdf{T}(X::AbstractVector{T})
return e
end

abstract StatisticalModel

coef(obj::StatisticalModel) = error("No method defined")
coeftable(obj::StatisticalModel) = error("No method defined")
confint(obj::StatisticalModel) = error("No method defined")
loglikelihood(obj::StatisticalModel) = error("No method defined")
nobs(obj::StatisticalModel) = size(model_response(obj), 1)
stderr(obj::StatisticalModel) = sqrt(diag(vcov(obj)))
vcov(obj::StatisticalModel) = error("No method defined")

abstract RegressionModel <: StatisticalModel

residuals(obj::RegressionModel) = error("No method defined")
model_response(obj::RegressionModel) = error("No method defined")
predict(obj::RegressionModel) = error("No method defined")

0 comments on commit 2127b21

Please sign in to comment.