Unexpected output containing plus, minus, and letters produced by subtracting one column of numbers from another in R










0














I have a data.frame containing a vector of numeric values (prcp_log).



 waterdate PRCP prcp_log
<date> <dbl> <dbl>
1 2007-10-01 0 0
2 2007-10-02 0.02 0.0198
3 2007-10-03 0.31 0.270
4 2007-10-04 1.8 1.03
5 2007-10-05 0.03 0.0296
6 2007-10-06 0.19 0.174


I then pass this data through Christiano-Fitzgerald band pass filter using the following command from the mfilter package.



library(mFilter)

US1ORLA0076_cffilter <- cffilter(US1ORLA0076$prcp_log,pl=180,pu=365,root=FALSE,drift=FALSE,
type=c("asymmetric"),
nfix=NULL,theta=1)


Which creates an S3 object containing, among other things, and vector of "trend" values and a vector of "cycle" values, like so:



head(US1ORLA0076_cffilter$trend)
[,1]
[1,] 0.05439408
[2,] 0.07275321
[3,] 0.32150292
[4,] 1.07958965
[5,] 0.07799329
[6,] 0.22082246

head(US1ORLA0076_cffilter$cycle)
[,1]
[1,] -0.05439408
[2,] -0.05295058
[3,] -0.05147578
[4,] -0.04997023
[5,] -0.04843449
[6,] -0.04686915


Plotted:



plot(US1ORLA0076_cffilter)


enter image description here



I then apply the following mathematical operation in attempt to remove the trend and seasonal components from the original numeric vector:



US1ORLA0076$decomp <- ((US1ORLA0076$prcp_log - US1ORLA0076_cffilter$trend) - US1ORLA0076_cffilter$cycle)


Which creates an output of values which includes unexpected elements such as dashes and letters.



head(US1ORLA0076$decomp)
[,1]
[1,] 0.000000e+00
[2,] 0.000000e+00
[3,] 1.387779e-17
[4,] -2.775558e-17
[5,] 0.000000e+00
[6,] 6.938894e-18


What has happened here? What do these additional characters signify? How can perform this mathematical operation and achieve the desired output of simply $log_prcp minus both the $tend and $cycle values?



I am happy to provide any additional info that will help right away, just ask.










share|improve this question



















  • 1




    This is scientific notation. To turn it off use options(scipen = 999)
    – Harro Cyranka
    Nov 12 '18 at 20:12






  • 1




    Are you referring to the "e-" and "e+"? They are the exponent form. You can take it to mean "10 to the power of"
    – SmitM
    Nov 12 '18 at 20:13











  • Is the meaning and usage of this notation in R documented somewhere where I can read more about it? What is it called / what should I search for? @HarroCyranka
    – Clayton Glasser
    Nov 12 '18 at 20:19










  • These decomp figures are so tiny that I suspect your filter is overfitting and your trend is capturing the signal AND the noise, so that there's only a floating point rounding error left, in the 17th or 18th decimal place.
    – Jon Spring
    Nov 12 '18 at 20:19







  • 1




    I found this website that may be valuable: burns-stat.com/documents/tutorials/impatient-r/…
    – Harro Cyranka
    Nov 12 '18 at 20:29
















0














I have a data.frame containing a vector of numeric values (prcp_log).



 waterdate PRCP prcp_log
<date> <dbl> <dbl>
1 2007-10-01 0 0
2 2007-10-02 0.02 0.0198
3 2007-10-03 0.31 0.270
4 2007-10-04 1.8 1.03
5 2007-10-05 0.03 0.0296
6 2007-10-06 0.19 0.174


I then pass this data through Christiano-Fitzgerald band pass filter using the following command from the mfilter package.



library(mFilter)

US1ORLA0076_cffilter <- cffilter(US1ORLA0076$prcp_log,pl=180,pu=365,root=FALSE,drift=FALSE,
type=c("asymmetric"),
nfix=NULL,theta=1)


Which creates an S3 object containing, among other things, and vector of "trend" values and a vector of "cycle" values, like so:



head(US1ORLA0076_cffilter$trend)
[,1]
[1,] 0.05439408
[2,] 0.07275321
[3,] 0.32150292
[4,] 1.07958965
[5,] 0.07799329
[6,] 0.22082246

head(US1ORLA0076_cffilter$cycle)
[,1]
[1,] -0.05439408
[2,] -0.05295058
[3,] -0.05147578
[4,] -0.04997023
[5,] -0.04843449
[6,] -0.04686915


Plotted:



plot(US1ORLA0076_cffilter)


enter image description here



I then apply the following mathematical operation in attempt to remove the trend and seasonal components from the original numeric vector:



US1ORLA0076$decomp <- ((US1ORLA0076$prcp_log - US1ORLA0076_cffilter$trend) - US1ORLA0076_cffilter$cycle)


Which creates an output of values which includes unexpected elements such as dashes and letters.



head(US1ORLA0076$decomp)
[,1]
[1,] 0.000000e+00
[2,] 0.000000e+00
[3,] 1.387779e-17
[4,] -2.775558e-17
[5,] 0.000000e+00
[6,] 6.938894e-18


What has happened here? What do these additional characters signify? How can perform this mathematical operation and achieve the desired output of simply $log_prcp minus both the $tend and $cycle values?



I am happy to provide any additional info that will help right away, just ask.










share|improve this question



















  • 1




    This is scientific notation. To turn it off use options(scipen = 999)
    – Harro Cyranka
    Nov 12 '18 at 20:12






  • 1




    Are you referring to the "e-" and "e+"? They are the exponent form. You can take it to mean "10 to the power of"
    – SmitM
    Nov 12 '18 at 20:13











  • Is the meaning and usage of this notation in R documented somewhere where I can read more about it? What is it called / what should I search for? @HarroCyranka
    – Clayton Glasser
    Nov 12 '18 at 20:19










  • These decomp figures are so tiny that I suspect your filter is overfitting and your trend is capturing the signal AND the noise, so that there's only a floating point rounding error left, in the 17th or 18th decimal place.
    – Jon Spring
    Nov 12 '18 at 20:19







  • 1




    I found this website that may be valuable: burns-stat.com/documents/tutorials/impatient-r/…
    – Harro Cyranka
    Nov 12 '18 at 20:29














0












0








0







I have a data.frame containing a vector of numeric values (prcp_log).



 waterdate PRCP prcp_log
<date> <dbl> <dbl>
1 2007-10-01 0 0
2 2007-10-02 0.02 0.0198
3 2007-10-03 0.31 0.270
4 2007-10-04 1.8 1.03
5 2007-10-05 0.03 0.0296
6 2007-10-06 0.19 0.174


I then pass this data through Christiano-Fitzgerald band pass filter using the following command from the mfilter package.



library(mFilter)

US1ORLA0076_cffilter <- cffilter(US1ORLA0076$prcp_log,pl=180,pu=365,root=FALSE,drift=FALSE,
type=c("asymmetric"),
nfix=NULL,theta=1)


Which creates an S3 object containing, among other things, and vector of "trend" values and a vector of "cycle" values, like so:



head(US1ORLA0076_cffilter$trend)
[,1]
[1,] 0.05439408
[2,] 0.07275321
[3,] 0.32150292
[4,] 1.07958965
[5,] 0.07799329
[6,] 0.22082246

head(US1ORLA0076_cffilter$cycle)
[,1]
[1,] -0.05439408
[2,] -0.05295058
[3,] -0.05147578
[4,] -0.04997023
[5,] -0.04843449
[6,] -0.04686915


Plotted:



plot(US1ORLA0076_cffilter)


enter image description here



I then apply the following mathematical operation in attempt to remove the trend and seasonal components from the original numeric vector:



US1ORLA0076$decomp <- ((US1ORLA0076$prcp_log - US1ORLA0076_cffilter$trend) - US1ORLA0076_cffilter$cycle)


Which creates an output of values which includes unexpected elements such as dashes and letters.



head(US1ORLA0076$decomp)
[,1]
[1,] 0.000000e+00
[2,] 0.000000e+00
[3,] 1.387779e-17
[4,] -2.775558e-17
[5,] 0.000000e+00
[6,] 6.938894e-18


What has happened here? What do these additional characters signify? How can perform this mathematical operation and achieve the desired output of simply $log_prcp minus both the $tend and $cycle values?



I am happy to provide any additional info that will help right away, just ask.










share|improve this question















I have a data.frame containing a vector of numeric values (prcp_log).



 waterdate PRCP prcp_log
<date> <dbl> <dbl>
1 2007-10-01 0 0
2 2007-10-02 0.02 0.0198
3 2007-10-03 0.31 0.270
4 2007-10-04 1.8 1.03
5 2007-10-05 0.03 0.0296
6 2007-10-06 0.19 0.174


I then pass this data through Christiano-Fitzgerald band pass filter using the following command from the mfilter package.



library(mFilter)

US1ORLA0076_cffilter <- cffilter(US1ORLA0076$prcp_log,pl=180,pu=365,root=FALSE,drift=FALSE,
type=c("asymmetric"),
nfix=NULL,theta=1)


Which creates an S3 object containing, among other things, and vector of "trend" values and a vector of "cycle" values, like so:



head(US1ORLA0076_cffilter$trend)
[,1]
[1,] 0.05439408
[2,] 0.07275321
[3,] 0.32150292
[4,] 1.07958965
[5,] 0.07799329
[6,] 0.22082246

head(US1ORLA0076_cffilter$cycle)
[,1]
[1,] -0.05439408
[2,] -0.05295058
[3,] -0.05147578
[4,] -0.04997023
[5,] -0.04843449
[6,] -0.04686915


Plotted:



plot(US1ORLA0076_cffilter)


enter image description here



I then apply the following mathematical operation in attempt to remove the trend and seasonal components from the original numeric vector:



US1ORLA0076$decomp <- ((US1ORLA0076$prcp_log - US1ORLA0076_cffilter$trend) - US1ORLA0076_cffilter$cycle)


Which creates an output of values which includes unexpected elements such as dashes and letters.



head(US1ORLA0076$decomp)
[,1]
[1,] 0.000000e+00
[2,] 0.000000e+00
[3,] 1.387779e-17
[4,] -2.775558e-17
[5,] 0.000000e+00
[6,] 6.938894e-18


What has happened here? What do these additional characters signify? How can perform this mathematical operation and achieve the desired output of simply $log_prcp minus both the $tend and $cycle values?



I am happy to provide any additional info that will help right away, just ask.







r subtraction bandpass-filter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 20:53

























asked Nov 12 '18 at 20:08









Clayton Glasser

518




518







  • 1




    This is scientific notation. To turn it off use options(scipen = 999)
    – Harro Cyranka
    Nov 12 '18 at 20:12






  • 1




    Are you referring to the "e-" and "e+"? They are the exponent form. You can take it to mean "10 to the power of"
    – SmitM
    Nov 12 '18 at 20:13











  • Is the meaning and usage of this notation in R documented somewhere where I can read more about it? What is it called / what should I search for? @HarroCyranka
    – Clayton Glasser
    Nov 12 '18 at 20:19










  • These decomp figures are so tiny that I suspect your filter is overfitting and your trend is capturing the signal AND the noise, so that there's only a floating point rounding error left, in the 17th or 18th decimal place.
    – Jon Spring
    Nov 12 '18 at 20:19







  • 1




    I found this website that may be valuable: burns-stat.com/documents/tutorials/impatient-r/…
    – Harro Cyranka
    Nov 12 '18 at 20:29













  • 1




    This is scientific notation. To turn it off use options(scipen = 999)
    – Harro Cyranka
    Nov 12 '18 at 20:12






  • 1




    Are you referring to the "e-" and "e+"? They are the exponent form. You can take it to mean "10 to the power of"
    – SmitM
    Nov 12 '18 at 20:13











  • Is the meaning and usage of this notation in R documented somewhere where I can read more about it? What is it called / what should I search for? @HarroCyranka
    – Clayton Glasser
    Nov 12 '18 at 20:19










  • These decomp figures are so tiny that I suspect your filter is overfitting and your trend is capturing the signal AND the noise, so that there's only a floating point rounding error left, in the 17th or 18th decimal place.
    – Jon Spring
    Nov 12 '18 at 20:19







  • 1




    I found this website that may be valuable: burns-stat.com/documents/tutorials/impatient-r/…
    – Harro Cyranka
    Nov 12 '18 at 20:29








1




1




This is scientific notation. To turn it off use options(scipen = 999)
– Harro Cyranka
Nov 12 '18 at 20:12




This is scientific notation. To turn it off use options(scipen = 999)
– Harro Cyranka
Nov 12 '18 at 20:12




1




1




Are you referring to the "e-" and "e+"? They are the exponent form. You can take it to mean "10 to the power of"
– SmitM
Nov 12 '18 at 20:13





Are you referring to the "e-" and "e+"? They are the exponent form. You can take it to mean "10 to the power of"
– SmitM
Nov 12 '18 at 20:13













Is the meaning and usage of this notation in R documented somewhere where I can read more about it? What is it called / what should I search for? @HarroCyranka
– Clayton Glasser
Nov 12 '18 at 20:19




Is the meaning and usage of this notation in R documented somewhere where I can read more about it? What is it called / what should I search for? @HarroCyranka
– Clayton Glasser
Nov 12 '18 at 20:19












These decomp figures are so tiny that I suspect your filter is overfitting and your trend is capturing the signal AND the noise, so that there's only a floating point rounding error left, in the 17th or 18th decimal place.
– Jon Spring
Nov 12 '18 at 20:19





These decomp figures are so tiny that I suspect your filter is overfitting and your trend is capturing the signal AND the noise, so that there's only a floating point rounding error left, in the 17th or 18th decimal place.
– Jon Spring
Nov 12 '18 at 20:19





1




1




I found this website that may be valuable: burns-stat.com/documents/tutorials/impatient-r/…
– Harro Cyranka
Nov 12 '18 at 20:29





I found this website that may be valuable: burns-stat.com/documents/tutorials/impatient-r/…
– Harro Cyranka
Nov 12 '18 at 20:29













0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
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',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269366%2funexpected-output-containing-plus-minus-and-letters-produced-by-subtracting-on%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269366%2funexpected-output-containing-plus-minus-and-letters-produced-by-subtracting-on%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto