-
Notifications
You must be signed in to change notification settings - Fork 25
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
Can not fit MA(q) #323
Comments
Hi @shayandavoodii, that's actually an easy one – you have a typo on your |
Sorry, I was having dinner. Yes, you're right. I forgot to put the answer on my own. Thank you so much. julia> using StateSpaceModels
julia> ts = rand(100);
julia> model = SARIMA(ts, order=(0,0,2))
SARIMA(0, 0, 2)x(0, 0, 0, 0) with zero mean
julia> res = StateSpaceModels.fit!(model)
SARIMA(0, 0, 2)x(0, 0, 0, 0) with zero mean Does the following code give me the coefficients? julia> res.results.coef_table.coef
3-element Vector{Float64}:
0.5778745695380242
0.36309170005361113
0.17571266972630697 If yes, what's the order of them? I mean, does the first one represent |
The coefficient table also has a julia> model.results.coef_table.names
3-element Vector{String}:
"ma_L1"
"ma_L2"
"sigma2_η"
julia> model.results.coef_table.coef
3-element Vector{Float64}:
0.7612171821159301
0.43638168954943535
0.16763243467500588 |
Thank you for your kind response! So, this means it is not necessary to call |
I guess "ma_L1" and "ma_L2" refer to the MA (Moving Average) coefficients associated with the lagged error terms. Then, "ma_L1" represents the coefficient for the first lag of the error term, and "ma_L2" represents the coefficient for the second lag of the error term. Furthermore, "sigma2_η" represents the variance ( |
You do need to call julia> model = SARIMA(ts, order=(0,0,2))
SARIMA(0, 0, 2)x(0, 0, 0, 0) with zero mean
julia> model.results.coef_table
StateSpaceModels.CoefficientTable{Float64}(String[], Float64[], Float64[], Float64[], Float64[])
julia> StateSpaceModels.fit!(model)
SARIMA(0, 0, 2)x(0, 0, 0, 0) with zero mean
julia> model.results.coef_table
StateSpaceModels.CoefficientTable{Float64}(["ma_L1", "ma_L2", "sigma2_η"], [0.7612171821159301, 0.43638168954943535, 0.16763243467500588], [0.09444579747538931, 0.11219079770386164, 0.028962339753974605], [8.05983116733477, 3.889638887329303, 5.787945176356171], [0.0, 0.0, 0.0]) I haven't looked at this particular code in a long time, but I believe the |
Thank you so much. It means the world to me ❤ |
Happy to help! |
As a comment, you can also call the function julia> ts = rand(100);
julia> model = SARIMA(ts, order=(0,0,2))
SARIMA(0, 0, 2)x(0, 0, 0, 0) with zero mean
julia> res = StateSpaceModels.fit!(model)
SARIMA(0, 0, 2)x(0, 0, 0, 0) with zero mean
julia> print_results(model)
Results
===============================================================
Model: SARIMA(0, 0, 2)x(0, 0, 0, 0) with zero mean
Number of observations: 100
Number of unknown parameters: 3
Log-likelihood: -58.5700
AIC: 123.1401
AICc: 123.3901
BIC: 130.9556
---------------------------------------------------------------
Parameter Estimate Std.Error z stat p-value
ma_L1 0.5884 0.1198 4.9112 0.0000
ma_L2 0.3002 0.0987 3.0416 0.0000
sigma2_η 0.1880 0.0307 6.1302 0.0000 |
Thank you so much! It's a great summary! |
Hi, I want to fit an$MA(q)$ using this package. I saw your documentation and tried to adjust it to get $MA(q)$ only. Here is what I tried and what I got:
How can I fit an$MA$ model on a vector?
The text was updated successfully, but these errors were encountered: