-
Notifications
You must be signed in to change notification settings - Fork 22
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
Choose a model by AIC in a Stepwise Algorithm #110
Comments
Dear Sir, One simple example. Instantiate a # To execute forward step-wise selection with primary parameter to be R-squared score
# and secondary parameter to be aic.
julia> obj = ModelSelection("forward", "r2", "aic")
ModelSelection(BestModelSubset.forward_stepwise, nothing, StatsAPI.r2, nothing, StatsAPI.aic,
nothing, StatsAPI.r2, StatsAPI.aic) Fit the julia> Random.seed!(123); df = hcat(rand(Float64, (50, 21))); # 50*21 Matrix
# The fit! function updates the fields of the `ModelSelection` object.
# Returns the indexes of columns which have the least aic value.
julia> index = fit!(obj, df)
1-element Vector{Vector{Int64}}:
[5, 6, 16, 17, 18, 20] Access various statistics like r2, adjr2, aic and bic for the selected model # One can always use something like MLBase.rss(df[:, index]) to get the statistics not passed earlier.
julia> obj.r2
0.8161760683631274
julia> obj.aic
21.189713760250477 I would be more than willing to contribute to CRRao.jl, a step-wise selection feature. |
The link is not working |
Sir, julia> using Pkg; Pkg.add(url="https://github.com/waitasecant/BestModelSubset.jl.git") |
Feature Request: Choose a model by AIC in a Stepwise Algorithm
Select a formula-based model by AIC.
The
R
code is following. We need to translate it into JuliaReferances
Hastie, T. J. and Pregibon, D. (1992) Generalized linear models. Chapter 6 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. New York: Springer (4th ed).
The text was updated successfully, but these errors were encountered: