# Is there a function equivalent of ARMAtoMA in R (for timeseries)

I am trying to write an AR(p) model as a MA process, and to extract the θ and ϕ coefficients of the linear models for an ARMA(p,q).

In R, there is a function ARMAtoMA cf https://www.jstatsoft.org/article/view/v023i05/v23i05.pdf

I don't know any equivalent to ARMAtoMA in Mathematica, and I could not find any. I just see ArimaTheta, ArimaPhi and others in Economic and Financial Modeling with Mathematica (Hal Varian) p378, but they come from the author package.

Are there native Mathematica functions that I can use with the function ARProcess? Are there other suggestions for how to do that.

Thanks for any help.

• Maybe MAProcess[ARMAProcess[{α}, {β}, Σ], q] with q a n integer? From the docs on MAProcess: MAProcess[tproc,q] gives a moving-average representation of the time series process tproc of order q.
– kglr
Oct 10, 2016 at 21:34

Starting with a MAProcess:

In[29]:= ma = MAProcess[c, {b1, b2}, v];


Convert to ARProcess of order 5:

In[31]:= ARProcess[ma, 5]

Out[31]= ARProcess[(1 - b1 + b1^2 - b1^3 + b1^4 - b1^5 - b2 +
2 b1 b2 - 3 b1^2 b2 + 4 b1^3 b2 + b2^2 -
3 b1 b2^2) c, {b1, -b1^2 + b2,
b1^3 - 2 b1 b2, -b1^4 + 3 b1^2 b2 - b2^2,
b1^5 - 4 b1^3 b2 + 3 b1 b2^2}, v]


Convert to ARMAProcess with orders (3,1):

In[34]:= ARMAProcess[ma, {3, 1}]

Out[34]= ARMAProcess[(1 + (b1^4 - 3 b1^2 b2 + b2^2)/(
b1^3 - 2 b1 b2)) (1 + (b1 b2^2)/(b1^3 - 2 b1 b2) - b2^3/(
b1^3 - 2 b1 b2) + (-b1^2 b2 + b2^2)/(
b1^3 - 2 b1 b2)) c, {-((-b1^2 b2 + b2^2)/(b1^3 - 2 b1 b2)), -((
b1 b2^2)/(b1^3 - 2 b1 b2)), b2^3/(b1^3 - 2 b1 b2)}, {(
b1^4 - 3 b1^2 b2 + b2^2)/(b1^3 - 2 b1 b2)}, v]


Start with an ARMAProcess:

In[35]:= arma = ARMAProcess[c, {a1, a2}, {b1, b2}, v];


Convert to MAProcess of order 4:

In[36]:= MAProcess[arma, 4]

Out[36]= MAProcess[(1 + a1 + a1^2 + a1^3 + a1^4 + a2 + 2 a1 a2 +
3 a1^2 a2 + a2^2) c, {a1 + b1, a1^2 + a2 + a1 b1 + b2,
a1^3 + 2 a1 a2 + a1^2 b1 + a2 b1 + a1 b2,
a1^4 + 3 a1^2 a2 + a2^2 + a1^3 b1 + 2 a1 a2 b1 + a1^2 b2 + a2 b2}, v]


Convert to ARProcess of order 5:

In[38]:= ARProcess[arma, 5]

Out[38]= ARProcess[(1 - b1 + b1^2 - b1^3 + b1^4 - b1^5 - b2 +
2 b1 b2 - 3 b1^2 b2 + 4 b1^3 b2 + b2^2 - 3 b1 b2^2) c, {a1 + b1,
a2 - a1 b1 - b1^2 + b2, -a2 b1 + a1 b1^2 + b1^3 - a1 b2 - 2 b1 b2,
a2 b1^2 - a1 b1^3 - b1^4 - a2 b2 + 2 a1 b1 b2 + 3 b1^2 b2 -
b2^2, -a2 b1^3 + a1 b1^4 + b1^5 + 2 a2 b1 b2 - 3 a1 b1^2 b2 -
4 b1^3 b2 + a1 b2^2 + 3 b1 b2^2}, v]


Convert to ARMAProcess with orders (1,1):

In[39]:= ARMAProcess[arma, {1, 1}]

Out[39]= ARMAProcess[(1 + (a1^2 + a2 + a1 b1 + b2)/(-a1 - b1)) (1 + (
a2 - a1 b1 - b1^2 + b2)/(-a1 - b1)) c, {-((
a1^2 + a2 + a1 b1 + b2)/(-a1 - b1))}, {(
a2 - a1 b1 - b1^2 + b2)/(-a1 - b1)}, v]
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2355906218290329, "perplexity": 12685.711676807285}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-27/segments/1656104249664.70/warc/CC-MAIN-20220703195118-20220703225118-00319.warc.gz"}