Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8709091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:17:02+00:00 2026-06-13T04:17:02+00:00

DISCLAIMER: This question is only for those who have access to the econometrics toolbox

  • 0

DISCLAIMER: This question is only for those who have access to the econometrics toolbox in Matlab.

The Situation: I would like to use Matlab to simulate N observations from an ARIMA(p, d, q) model using the econometrics toolbox. What’s the difficulty? I would like the innovations to be simulated with deterministic, time-varying variance.

Question 1) Can I do this using the in-built matlab simulate function without altering it myself? As near as I can tell, this is not possible. From my reading of the docs, the innovations can either be specified to have a constant variance (ie same variance for each innovation), or be specified to be stochastically time-varying (eg a GARCH model), but they cannot be deterministically time-varying, where I, the user, choose their values (except in the trivial constant case).

Question 2) If the answer to question 1 is “No”, then does anyone see any reason why I can’t edit the simulate function from the econometrics toolbox as follows:
a) Alter the preamble such that the function won’t throw an error if the Variance field in the input model is set to a numeric vector instead of a numeric scalar.
b) Alter line 310 of simulate from:

E(:,(maxPQ + 1:end)) = Z * sqrt(variance);

to

E(:,(maxPQ + 1:end)) = (ones(NumPath, 1) * sqrt(variance)) .* Z;

where NumPath is the number of paths to be simulated, and it can be assumed that I’ve included an error trap to ensure that the (input) deterministic variance path stored in variance is of the right length (ie equal to the number of observations to be simulated per path).

Any help would be most appreciated. Apologies if the question seems basic, I just haven’t ever edited one of Mathwork’s own functions before and didn’t want to do something foolish.

UPDATE (2012-10-18): I’m confident that the code edit I’ve suggested above is valid, and I’m mostly confident that it won’t break anything else. However it turns out that implementing the solution is not trivial due to file permissions. I’m currently talking with Mathworks about the best way to achieve my goal. I’ll post the results here once I have them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:17:03+00:00Added an answer on June 13, 2026 at 4:17 am

    It’s been a week and a half with no answer, so I think I’m probably okay to post my own answer at this point.

    In response to my question 1), no, I have not found anyway to do this with the built-in matlab functions.

    In response to my question 2), yes, what I have posted will work. However, it was a little more involved than I imagined due to matlab file permissions. Here is a step-by-step guide:

    i) Somewhere in your matlab path, create the directory @arima_Custom.

    ii) In the command window, type edit arima. Copy the text of this file into a new m file and save it in the directory @arima_Custom with the filename arima_Custom.m.

    iii) Locate the econometrics toolbox on your machine. Once found, look for the directory @arima in the toolbox. This directory will probably be located (on a Linux machine) at something like $MATLAB_ROOT/toolbox/econ/econ/@arima (on my machine, $MATLAB_ROOT is at /usr/local/Matlab/R2012b). Copy the contents of @arima to @arima_Custom, except do NOT copy the file arima.m.

    iv) Open arima_Custom for editing, ie edit arima_Custom. In this file change line 1 from:

    classdef (Sealed) arima < internal.econ.LagIndexableTimeSeries
    

    to

    classdef (Sealed) arima_Custom < internal.econ.LagIndexableTimeSeries
    

    Next, change line 406 from:

    function OBJ = arima(varargin)
    

    to

    function OBJ = arima_Custom(varargin)
    

    Now, change line 993 from:

    if isa(OBJ.Variance, 'double') && (OBJ.Variance <= 0)
    

    to

    if isa(OBJ.Variance, 'double') && (sum(OBJ.Variance <= 0) > 0)
    

    v) Open the simulate.m located in @arima_Custom for editing (we copied it there in step iii). It is probably best to open this file by navigating to it manually in the Current Folder window, to ensure the correct simulate.m is opened. In this file, alter line 310 from:

    E(:,(maxPQ + 1:end)) = Z * sqrt(variance);
    

    to

    %Check that the input variance is of the right length (if it isn't scalar)
    if isscalar(variance) == 0
        if size(variance, 2) ~= 1
            error('Deterministic variance must be a column vector');
        end
        if size(variance, 1) ~= numObs
            error('Deterministic variance vector is incorrect length relative to number of observations');
        end
    else
        variance = variance(ones(numObs, 1));
    end
    %Scale innovations using deterministic variance
    E(:,(maxPQ + 1:end)) =  sqrt(ones(numPaths, 1) * variance') .* Z;
    

    And we’re done!

    You should now be able to simulate with deterministically time-varying variance using the arima_Custom class, for example (for an ARIMA(0,1,0)):

    ARIMAModel = arima_Custom('D', 1, 'Variance', ScalarVariance, 'Constant', 0);
    ARIMAModel.Variance = TimeVaryingVarianceVector;
    [X, e, VarianceVector] = simulate(ARIMAModel, NumObs, 'numPaths', NumPaths);
    

    Further, you should also still be able to use matlab’s original arima class, since we didn’t alter it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Disclaimer: I apologize that this question is so long. I have added code as
Disclaimer: this question may not have practical value, it's more of a puzzle/curiosity question.
Disclaimer: this question is driven by my personal curiosity more than an actual need
Disclaimer: This question is strictly academic. The example I'm about to give is probably
Disclaimer: this is not a question about how to install asp.net or an application
(Disclaimer: I realize this is a massive wall of text, but I have done
Disclaimer : I already asked this question , but without the deployment requirement. I
Disclaimer: The author of this post has only theoretical and almost no practical knowledge
Disclaimer When I wrote this question I was wrong about the behavior of the
Disclaimer: Hello all Python masters and fans. I would like to thank everyone for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.