Frequency parameter of `ts()` and `findfrequency()` in R

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












Is the result obtained in findfrequency() function of forecast package and the frequency parameter of ts() the same?










share|cite|improve this question









New contributor




user224318 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    up vote
    1
    down vote

    favorite












    Is the result obtained in findfrequency() function of forecast package and the frequency parameter of ts() the same?










    share|cite|improve this question









    New contributor




    user224318 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Is the result obtained in findfrequency() function of forecast package and the frequency parameter of ts() the same?










      share|cite|improve this question









      New contributor




      user224318 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Is the result obtained in findfrequency() function of forecast package and the frequency parameter of ts() the same?







      r time-series forecasting






      share|cite|improve this question









      New contributor




      user224318 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|cite|improve this question









      New contributor




      user224318 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|cite|improve this question




      share|cite|improve this question








      edited 3 hours ago









      SecretAgentMan

      533120




      533120






      New contributor




      user224318 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 hours ago









      user224318

      61




      61




      New contributor




      user224318 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user224318 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user224318 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          It probably should be, but there are no guarantees that it has to be.



          findfrequency will return the period with the maximum spectral amplitude of the signal provided as an input. It is relative straight-forward calculation using the results from spec.ar where we estimate the spectral density associated with each candidate frequency of a time-series model from auto-regressive fit. Assuming that our raw signal, x, having assumed frequency 1, we use it as input to spec.ar:



          specARresults <- spec.ar(x)


          then then results from findfrequency are simply:



          1 / specARresults$freq[which.max(specARresults$spec)]


          i.e. the inverse of the frequency having the highest spectral density. And as the inverse of a frequency is a period we get our result. :) (Side-note: Why findfrequency returns a period eludes me.)



          We can theoretically use this result as input to ts's argument about frequency but we do not have to. The frequency we use to ts is probably better to relate to our actual problem. For example, we might have daily expenditure data that happen to have a strong weekly pattern (cause people spend more on weekends). If we do not care for a weekly pattern though, it might be more relevant for us to analyse them assuming a period of 365 days.






          share|cite|improve this answer




















          • Welcome to the CV community!
            – usεr11852
            2 hours ago










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "65"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          user224318 is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f373011%2ffrequency-parameter-of-ts-and-findfrequency-in-r%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote













          It probably should be, but there are no guarantees that it has to be.



          findfrequency will return the period with the maximum spectral amplitude of the signal provided as an input. It is relative straight-forward calculation using the results from spec.ar where we estimate the spectral density associated with each candidate frequency of a time-series model from auto-regressive fit. Assuming that our raw signal, x, having assumed frequency 1, we use it as input to spec.ar:



          specARresults <- spec.ar(x)


          then then results from findfrequency are simply:



          1 / specARresults$freq[which.max(specARresults$spec)]


          i.e. the inverse of the frequency having the highest spectral density. And as the inverse of a frequency is a period we get our result. :) (Side-note: Why findfrequency returns a period eludes me.)



          We can theoretically use this result as input to ts's argument about frequency but we do not have to. The frequency we use to ts is probably better to relate to our actual problem. For example, we might have daily expenditure data that happen to have a strong weekly pattern (cause people spend more on weekends). If we do not care for a weekly pattern though, it might be more relevant for us to analyse them assuming a period of 365 days.






          share|cite|improve this answer




















          • Welcome to the CV community!
            – usεr11852
            2 hours ago














          up vote
          2
          down vote













          It probably should be, but there are no guarantees that it has to be.



          findfrequency will return the period with the maximum spectral amplitude of the signal provided as an input. It is relative straight-forward calculation using the results from spec.ar where we estimate the spectral density associated with each candidate frequency of a time-series model from auto-regressive fit. Assuming that our raw signal, x, having assumed frequency 1, we use it as input to spec.ar:



          specARresults <- spec.ar(x)


          then then results from findfrequency are simply:



          1 / specARresults$freq[which.max(specARresults$spec)]


          i.e. the inverse of the frequency having the highest spectral density. And as the inverse of a frequency is a period we get our result. :) (Side-note: Why findfrequency returns a period eludes me.)



          We can theoretically use this result as input to ts's argument about frequency but we do not have to. The frequency we use to ts is probably better to relate to our actual problem. For example, we might have daily expenditure data that happen to have a strong weekly pattern (cause people spend more on weekends). If we do not care for a weekly pattern though, it might be more relevant for us to analyse them assuming a period of 365 days.






          share|cite|improve this answer




















          • Welcome to the CV community!
            – usεr11852
            2 hours ago












          up vote
          2
          down vote










          up vote
          2
          down vote









          It probably should be, but there are no guarantees that it has to be.



          findfrequency will return the period with the maximum spectral amplitude of the signal provided as an input. It is relative straight-forward calculation using the results from spec.ar where we estimate the spectral density associated with each candidate frequency of a time-series model from auto-regressive fit. Assuming that our raw signal, x, having assumed frequency 1, we use it as input to spec.ar:



          specARresults <- spec.ar(x)


          then then results from findfrequency are simply:



          1 / specARresults$freq[which.max(specARresults$spec)]


          i.e. the inverse of the frequency having the highest spectral density. And as the inverse of a frequency is a period we get our result. :) (Side-note: Why findfrequency returns a period eludes me.)



          We can theoretically use this result as input to ts's argument about frequency but we do not have to. The frequency we use to ts is probably better to relate to our actual problem. For example, we might have daily expenditure data that happen to have a strong weekly pattern (cause people spend more on weekends). If we do not care for a weekly pattern though, it might be more relevant for us to analyse them assuming a period of 365 days.






          share|cite|improve this answer












          It probably should be, but there are no guarantees that it has to be.



          findfrequency will return the period with the maximum spectral amplitude of the signal provided as an input. It is relative straight-forward calculation using the results from spec.ar where we estimate the spectral density associated with each candidate frequency of a time-series model from auto-regressive fit. Assuming that our raw signal, x, having assumed frequency 1, we use it as input to spec.ar:



          specARresults <- spec.ar(x)


          then then results from findfrequency are simply:



          1 / specARresults$freq[which.max(specARresults$spec)]


          i.e. the inverse of the frequency having the highest spectral density. And as the inverse of a frequency is a period we get our result. :) (Side-note: Why findfrequency returns a period eludes me.)



          We can theoretically use this result as input to ts's argument about frequency but we do not have to. The frequency we use to ts is probably better to relate to our actual problem. For example, we might have daily expenditure data that happen to have a strong weekly pattern (cause people spend more on weekends). If we do not care for a weekly pattern though, it might be more relevant for us to analyse them assuming a period of 365 days.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered 2 hours ago









          usεr11852

          17k13670




          17k13670











          • Welcome to the CV community!
            – usεr11852
            2 hours ago
















          • Welcome to the CV community!
            – usεr11852
            2 hours ago















          Welcome to the CV community!
          – usεr11852
          2 hours ago




          Welcome to the CV community!
          – usεr11852
          2 hours ago










          user224318 is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          user224318 is a new contributor. Be nice, and check out our Code of Conduct.












          user224318 is a new contributor. Be nice, and check out our Code of Conduct.











          user224318 is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f373011%2ffrequency-parameter-of-ts-and-findfrequency-in-r%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery