@@ -25,19 +25,19 @@ function get_dummy_indexes(Exogenous_X::Matrix{Fl}) where{Fl}
25
25
end
26
26
27
27
"""
28
- get_outlier_duplicate_columns(Estimation_X::Matrix{Tl}, components_indexes::Dict{String, Vector{Int64 }}) where{Tl}
28
+ get_outlier_duplicate_columns(Estimation_X::Matrix{Tl}, components_indexes::Dict{String, Vector{Int }}) where{Tl}
29
29
30
30
Identifies and returns the indexes of outlier columns that are duplicates of dummy variables in the exogenous matrix.
31
31
32
32
# Arguments
33
33
- `Estimation_X::Matrix{Tl}`: Matrix used for estimation.
34
- - `components_indexes::Dict{String, Vector{Int64 }}`: Dictionary containing indexes for different components.
34
+ - `components_indexes::Dict{String, Vector{Int }}`: Dictionary containing indexes for different components.
35
35
36
36
# Returns
37
37
- `Vector{Int}`: Vector containing the indexes of outlier columns that are duplicates of dummy variables in the exogenous matrix.
38
38
39
39
"""
40
- function get_outlier_duplicate_columns (Estimation_X:: Matrix{Tl} , components_indexes:: Dict{String, Vector{Int64 }} ) where {Tl}
40
+ function get_outlier_duplicate_columns (Estimation_X:: Matrix{Tl} , components_indexes:: Dict{String, Vector{Int }} ) where {Tl}
41
41
if ! haskey (components_indexes, " o" )
42
42
return []
43
43
else
115
115
116
116
"""
117
117
fit_lasso(Estimation_X::Matrix{Tl}, estimation_y::Vector{Fl}, α::Float64, information_criteria::String,
118
- penalize_exogenous::Bool, components_indexes::Dict{String, Vector{Int64 }}, penalty_factor::Vector{Float64};
118
+ penalize_exogenous::Bool, components_indexes::Dict{String, Vector{Int }}, penalty_factor::Vector{Float64};
119
119
rm_average::Bool = false)::Tuple{Vector{Float64}, Vector{Float64}} where {Tl, Fl}
120
120
121
121
Fits a Lasso regression model to the provided data and returns coefficients and residuals based on selected criteria.
@@ -126,15 +126,15 @@ end
126
126
- `α::Float64`: Elastic net control factor between ridge (α=0) and lasso (α=1) (default: 0.1).
127
127
- `information_criteria::String`: Information Criteria method for hyperparameter selection (default: aic).
128
128
- `penalize_exogenous::Bool`: Flag for selecting exogenous variables. When false the penalty factor for these variables will be set to 0.
129
- - `components_indexes::Dict{String, Vector{Int64 }}`: Dictionary containing indexes for different components.
129
+ - `components_indexes::Dict{String, Vector{Int }}`: Dictionary containing indexes for different components.
130
130
- `penalty_factor::Vector{Float64}`: Penalty factors for each predictor.
131
131
- `rm_average::Bool`: Flag to consider if the intercept will be calculated is the average of the time series (default: false).
132
132
133
133
# Returns
134
134
- `Tuple{Vector{Float64}, Vector{Float64}}`: Tuple containing coefficients and residuals of the fitted Lasso model.
135
135
136
136
"""
137
- function fit_lasso (Estimation_X:: Matrix{Tl} , estimation_y:: Vector{Fl} , α:: Float64 , information_criteria:: String , penalize_exogenous:: Bool , components_indexes:: Dict{String, Vector{Int64 }} , penalty_factor:: Vector{Float64} ; rm_average:: Bool = false ):: Tuple{Vector{Float64}, Vector{Float64}} where {Tl, Fl}
137
+ function fit_lasso (Estimation_X:: Matrix{Tl} , estimation_y:: Vector{Fl} , α:: Float64 , information_criteria:: String , penalize_exogenous:: Bool , components_indexes:: Dict{String, Vector{Int }} , penalty_factor:: Vector{Float64} ; rm_average:: Bool = false ):: Tuple{Vector{Float64}, Vector{Float64}} where {Tl, Fl}
138
138
139
139
outlier_duplicate_columns = get_outlier_duplicate_columns (Estimation_X, components_indexes)
140
140
penalty_factor[outlier_duplicate_columns] .= Inf
@@ -168,23 +168,23 @@ end
168
168
"""
169
169
fit_adalasso(Estimation_X::Matrix{Tl}, estimation_y::Vector{Fl}, α::Float64,
170
170
information_criteria::String,
171
- components_indexes::Dict{String, Vector{Int64 }},
171
+ components_indexes::Dict{String, Vector{Int }},
172
172
ε::Float64, penalize_exogenous::Bool)::Tuple{Vector{Float64}, Vector{Float64}} where {Tl, Fl}
173
173
174
174
Fits an Adaptive Lasso (AdaLasso) regression model to the provided data and returns coefficients and residuals.
175
175
176
176
# Arguments
177
177
- `Estimation_X::Matrix{Tl}`: Matrix of predictors for estimation.
178
178
- `estimation_y::Vector{Fl}`: Vector of response values for estimation.
179
- - `components_indexes::Dict{String, Vector{Int64 }}`: Dictionary containing indexes for different components.
179
+ - `components_indexes::Dict{String, Vector{Int }}`: Dictionary containing indexes for different components.
180
180
- `estimation_input::Dict`: Dictionary containing the estimation input parameters.
181
181
182
182
# Returns
183
183
- `Tuple{Vector{Float64}, Vector{Float64}}`: Tuple containing coefficients and residuals of the fitted AdaLasso model.
184
184
185
185
"""
186
186
function default_estimation_procedure (Estimation_X:: Matrix{Tl} , estimation_y:: Vector{Fl} ,
187
- components_indexes:: Dict{String, Vector{Int64 }} , estimation_input:: Dict ):: Tuple{Vector{Float64}, Vector{Float64}} where {Tl, Fl}
187
+ components_indexes:: Dict{String, Vector{Int }} , estimation_input:: Dict ):: Tuple{Vector{Float64}, Vector{Float64}} where {Tl, Fl}
188
188
189
189
@assert all ([key in keys (estimation_input) for key in [" α" , " information_criteria" , " ϵ" , " penalize_exogenous" , " penalize_initial_states" ]]) " All estimation input parameters must be set"
190
190
α = estimation_input[" α" ]; information_criteria = estimation_input[" information_criteria" ];
0 commit comments