filter data by average moving box
ma(x, n)
a vector
A number to identify the size of the moving box.
The filtered data
ma(rnorm(1000),5)
#> Time Series:
#> Start = 1
#> End = 1000
#> Frequency = 1
#> [1] 0.075648077 0.385939990 0.516584363 0.449327383 0.735365947
#> [6] 0.161006973 -0.253246508 -0.552311963 -0.606757828 -0.970913215
#> [11] -0.259200042 -0.440350935 -0.420675216 0.052942076 0.170298710
#> [16] 0.021503558 0.661791892 0.532366028 0.195646066 0.641443977
#> [21] 0.522914543 0.199666850 0.550175758 0.847368184 0.332156977
#> [26] 0.411151610 0.679489193 0.425686114 0.115532461 0.114505628
#> [31] -0.255121121 -0.244022518 0.327980692 0.188521987 0.114345343
#> [36] 0.598066022 0.545463614 -0.245211093 -0.155281311 -0.542513437
#> [41] -0.643518625 -0.576121941 -0.335305878 -0.419606871 0.467389941
#> [46] 0.293302931 0.246510379 0.260718895 0.180719533 -0.514410698
#> [51] -0.473058597 -0.601246978 -0.529276268 -0.640563684 -0.596261752
#> [56] -0.663194946 -0.790336274 -0.810375332 -0.549377214 -0.449191297
#> [61] -0.352657425 0.213725010 0.280355624 0.235733585 0.472089594
#> [66] 0.669715274 0.440703354 0.532252263 0.593876730 0.511598500
#> [71] 0.159501721 -0.329826929 -0.503114180 -0.624507403 -0.786183761
#> [76] -0.377228234 0.177103862 0.381146817 0.428878846 0.553367094
#> [81] 0.588754169 0.359893494 0.162514061 0.421599295 0.173949773
#> [86] -0.319576918 -0.355974900 -0.319939522 -0.368146961 -0.357454222
#> [91] -0.071463019 0.046666656 0.525105850 0.436729725 0.594300451
#> [96] 0.918136460 0.940134624 0.968307146 0.912424257 1.034159045
#> [101] 0.785173821 0.810556367 0.743369723 0.695935664 0.955048684
#> [106] 0.902752715 0.782958393 0.253855602 0.533688620 0.043373170
#> [111] 0.160611441 0.133074023 0.054972018 -0.541543034 0.156787785
#> [116] -0.124427467 -0.159727002 0.252766902 0.484714762 -0.051543413
#> [121] 0.144762256 0.452564386 0.347411255 0.425131564 0.107469093
#> [126] 0.040395332 -0.134149184 -0.037287557 0.161479793 0.575975399
#> [131] 0.143996372 0.313428007 -0.134075817 -0.289588870 -0.715388304
#> [136] -0.211135493 -0.446189891 -0.313927947 -0.204899501 0.029460348
#> [141] -0.116779987 -0.205304868 0.016597195 0.139858832 0.053512847
#> [146] -0.083822704 -0.138760982 -0.283149989 -0.521598796 -0.155231514
#> [151] -0.213562662 -0.007181679 0.070510136 -0.074390525 -0.146533124
#> [156] 0.024851271 -0.025831022 -0.099974927 0.197695089 0.192061584
#> [161] 0.389898716 0.421173900 0.328732302 -0.102842056 -0.132780257
#> [166] -0.642221160 -0.931216330 -0.851075138 -0.786364888 -0.285286131
#> [171] 0.160363589 0.199615348 0.332524548 0.335563776 -0.380050583
#> [176] -0.412962681 -0.197353498 -0.128834379 -0.044269184 0.271331645
#> [181] 0.243329818 0.300289423 0.031225111 0.436046325 0.555091386
#> [186] 0.659134921 0.299713809 0.506565259 0.026365782 -0.347785626
#> [191] -0.326688525 -0.016163971 -0.220544801 -0.324434269 -0.176850297
#> [196] -0.793132285 -0.586666433 -0.695922661 -0.547802906 -0.517975914
#> [201] -0.044211014 -0.219551976 -0.226637989 0.143310086 0.039429929
#> [206] -0.080608110 -0.156274000 0.009916143 -0.233103334 -0.161487220
#> [211] 0.227246282 0.117812764 0.256575172 0.219710834 -0.156627556
#> [216] -0.590883536 -0.416231497 -0.638879724 -0.586881116 -0.076779298
#> [221] -0.056523205 0.004902989 0.252170026 0.431283032 0.227367336
#> [226] 0.333242136 0.002009507 0.233236823 -0.100501610 0.157448819
#> [231] 0.163879454 0.274377874 0.045010270 0.179463223 -0.012467788
#> [236] 0.201535093 0.234611960 -0.030326964 -0.323836612 -0.361215957
#> [241] -0.601750630 -0.676638150 -0.535689632 0.097145981 0.058804763
#> [246] 0.541669858 0.492695491 0.278411639 -0.138441491 -0.246017524
#> [251] -1.052571707 -1.086880405 -1.077730528 -1.214014411 -1.070019105
#> [256] -0.984856985 -0.593266095 -0.290011076 0.117071590 0.115123875
#> [261] 0.686185586 0.646240930 0.401564916 0.352773335 0.348117796
#> [266] 0.045010572 -0.109915234 0.134334983 -0.170157932 -0.020883284
#> [271] -0.108437053 0.190577451 -0.133445351 0.270821857 0.090285843
#> [276] 0.341355944 0.116147246 0.178218515 0.101476366 0.237364847
#> [281] 0.078968450 0.153660772 0.221163244 -0.220529588 -0.544313864
#> [286] -0.324794642 -0.743958543 -1.036655938 -0.888697252 -1.091320708
#> [291] -1.113275080 -0.476606293 -0.146804516 -0.198202888 0.093822637
#> [296] 0.037789744 -0.182584760 -0.113621451 0.206857037 0.075559966
#> [301] -0.479480466 -0.591627637 -0.406202831 -0.487489102 -0.181136266
#> [306] 0.496091883 0.548105884 0.564705024 1.133610211 0.959035199
#> [311] 0.595421572 0.481033852 0.281571780 -0.249242412 0.295017196
#> [316] 0.454502834 0.486383255 0.824542749 0.856698201 0.386094887
#> [321] 0.456265727 0.541756387 0.061119309 -0.194307900 -0.011184170
#> [326] 0.041188617 -0.244755600 0.094511940 0.600298251 0.342593301
#> [331] -0.068530784 0.236607159 0.109623428 -0.152841236 0.051160923
#> [336] -0.042358788 -0.105712519 -0.314218757 -0.513221033 -0.628185093
#> [341] -0.124553480 -0.166318019 0.320591801 0.346594077 0.177509407
#> [346] -0.160409246 0.189413502 -0.380094512 -0.361921586 0.042582537
#> [351] 0.349169146 -0.069607293 0.306663742 0.335889930 0.068365896
#> [356] 0.051160978 0.136840995 -0.313333066 0.092118269 -0.155093494
#> [361] -0.322753557 -0.363147163 0.043032397 -0.649578419 -0.715252331
#> [366] -0.609024378 -0.167338015 -0.147689151 -0.143555700 0.285273725
#> [371] 0.343256332 -0.089245135 -0.316242118 0.251739199 0.525174572
#> [376] 0.514665181 0.432399595 0.707067314 0.337084406 0.171291881
#> [381] -0.001594258 0.332374911 0.096465046 0.445747663 0.293774574
#> [386] 0.372353461 0.042540996 0.186691154 -0.269649932 -0.351418302
#> [391] -0.312137235 0.003339162 -0.266617057 -0.146212408 0.070295434
#> [396] -0.180294126 -0.347122896 -0.231465062 0.079039307 0.012096614
#> [401] -0.331838503 -0.471803232 -0.256890791 -0.757014571 -0.810406466
#> [406] -0.372352803 -0.260526895 -0.505813908 -0.103206802 0.024979640
#> [411] -0.154709474 -0.218722961 -0.207819262 -0.722519580 -0.525967230
#> [416] -0.296621865 -0.428641444 -0.101886046 0.519240708 0.161516758
#> [421] 0.206480190 0.140128457 -0.405496090 -0.694481913 -0.735982636
#> [426] -0.612209581 -0.227377599 0.147587020 0.223802918 0.485701719
#> [431] 0.475547517 0.302237742 0.037300970 0.162612606 -0.176082910
#> [436] -0.319656478 -0.642601266 -0.815566638 -1.121586295 -0.659556262
#> [441] -0.667198613 -0.474859329 -0.016822055 0.457150007 -0.281515432
#> [446] -0.037810287 0.532190576 0.350674724 0.083945334 0.199141851
#> [451] 0.397013506 0.147916482 0.136856325 0.276465407 0.812800483
#> [456] 0.362265031 0.031811051 0.041875458 0.086809006 0.002265346
#> [461] 0.037670662 -0.193004451 -0.074005941 -0.623259045 -0.388621229
#> [466] -0.378897460 0.040847088 -0.298486078 -0.033577809 -0.441654424
#> [471] -0.641349120 -0.571707014 -0.234004165 -0.073843968 0.139246416
#> [476] 0.137133363 0.241195384 0.094398174 -0.046928086 -0.303050126
#> [481] -0.025019079 -0.140398413 -0.063187870 0.082784267 0.363864331
#> [486] 0.249399539 0.386932902 0.452540914 0.300864203 0.112259321
#> [491] 0.127240748 -0.214137818 -0.231514388 -0.199000122 -0.099600574
#> [496] 0.131728800 0.353929339 0.018148578 0.022978991 -0.239932129
#> [501] -0.520090749 -0.198702634 0.137480440 0.127642765 0.244419955
#> [506] 0.206283112 -0.051072184 -0.287437142 -0.189670948 -0.126502595
#> [511] -0.029132605 -0.516596434 -0.311424388 -0.974875282 -1.266095669
#> [516] -1.396501435 -0.646567101 -0.673213130 -0.159100267 0.575725527
#> [521] 0.415561367 0.236645600 0.239570989 0.494147649 0.238120307
#> [526] 0.382496523 -0.169588650 0.181331618 0.182825853 0.079358872
#> [531] 0.348882659 0.625424943 0.140827290 0.225398803 0.305704101
#> [536] 0.475608510 0.656893085 0.651768612 0.601432095 0.563887184
#> [541] 0.184338704 -0.240259196 0.064764642 0.113941840 -0.100734623
#> [546] 0.019929547 0.513862050 0.733991235 0.445916095 0.448455420
#> [551] 0.231970087 -0.038603357 -0.474896552 -0.648439510 -0.756201226
#> [556] -0.671439191 -0.736358379 -0.724476872 -0.757696053 -0.738308187
#> [561] -0.552001919 -0.357709644 -0.729495591 -0.433141292 -0.482037893
#> [566] -0.667528323 -0.719065869 -0.119668952 -0.471190402 -0.466231251
#> [571] -0.202791971 -0.493314932 -0.808019694 -0.598872537 -0.733316883
#> [576] -0.923993626 -0.421906804 -0.269602728 -0.269585764 -0.041255612
#> [581] 0.199463259 0.394874502 0.246796893 0.275980567 0.110359722
#> [586] 0.022489684 -0.448100131 -0.327962954 -0.152321501 0.043935956
#> [591] -0.002197502 -0.094922524 0.223443785 0.193438169 0.041403156
#> [596] -0.202364395 -0.167273468 -0.194051619 -0.108521494 0.400009538
#> [601] 0.553579637 0.987062735 0.854993374 1.108961631 0.749142904
#> [606] 0.929864852 0.665135851 0.542101179 0.099832824 0.321081267
#> [611] -0.113733491 0.152220160 -0.072131491 -0.044558341 -0.168646622
#> [616] -0.099204506 -0.416905991 -0.345506906 -0.409073969 -0.678221334
#> [621] -0.848483597 -0.685597456 -0.381058184 -0.293860811 -0.058108617
#> [626] 0.660435117 0.538056336 0.630709480 0.753937193 0.549998359
#> [631] 0.215450681 0.297290954 -0.267061171 -0.749334718 -0.567885440
#> [636] -0.485744695 -0.873657881 -0.552488477 -0.261804953 0.001905582
#> [641] -0.124368053 0.095584058 0.188066922 0.296067838 -0.028423354
#> [646] 0.061019688 0.457872354 0.178094199 0.112001239 -0.021933489
#> [651] 0.136185463 -0.093398664 -0.212114210 -0.137348059 0.190303087
#> [656] 0.381231350 0.055437842 0.580544407 0.494559081 0.468264903
#> [661] 0.061747231 0.321866940 0.230323151 0.166780924 0.330059429
#> [666] 0.247522679 0.068861082 -0.340761114 -0.517407707 -0.796739302
#> [671] -0.968709466 -0.890887708 -0.323065362 -0.275781053 0.302551897
#> [676] 0.730303059 0.517990075 -0.087819552 0.349463903 -0.257290687
#> [681] -0.303444056 0.123353379 0.383904248 0.294111642 0.279272234
#> [686] -0.162719596 -0.393094156 -0.761809934 -1.051768638 -0.952706172
#> [691] -0.648789031 -0.564137549 -0.253972233 0.172043773 0.134924388
#> [696] 0.120554758 -0.344433313 -0.313181255 -0.221403212 -0.352279537
#> [701] -0.200039142 -0.029699076 0.380463206 0.232274243 0.450203167
#> [706] 0.353695811 0.682797620 0.213078146 0.074241538 0.026330436
#> [711] -0.160931680 -0.448616343 -0.432339339 -0.552800929 -0.496694147
#> [716] -0.515032949 -0.259698068 -0.225648889 -0.005347496 0.116371204
#> [721] 0.329290867 0.130373988 0.481985179 0.259319998 0.396252314
#> [726] 0.399855390 0.623075897 0.172683608 0.715594125 0.531861902
#> [731] 0.350247746 0.553885143 0.754672146 0.187777175 -0.215915117
#> [736] -0.083953109 -0.373970561 -0.164234740 -0.381045587 -0.467597343
#> [741] -0.655906117 -0.388976021 -0.386612021 0.082993879 0.290836821
#> [746] 0.343018970 0.137113573 -0.252767199 -0.069936224 -0.078992020
#> [751] 0.456439421 0.441505647 0.780750689 0.418440672 -0.021879552
#> [756] -0.241971838 -0.430292839 -0.877098046 -0.790000734 -0.253284331
#> [761] -0.505156277 -0.348979081 0.062782942 -0.167604841 0.071793326
#> [766] 0.088000208 0.071976074 -0.196311988 0.128801940 -0.301677451
#> [771] -0.656586440 -0.562460888 -0.262019883 -0.403572052 -0.130461778
#> [776] 0.179872513 0.173625681 -0.116661927 -0.071346527 0.107613325
#> [781] 0.452564078 0.546615999 0.866682701 0.599018054 0.455854341
#> [786] 0.125218401 0.133991513 0.201922689 0.673832773 0.763116271
#> [791] 0.776089653 0.710600688 0.617615872 0.547373426 0.808054111
#> [796] 0.515115642 0.332009037 0.285583614 0.140204642 -0.295301316
#> [801] 0.378817703 0.418353425 0.652251954 0.414655669 0.659519188
#> [806] 0.361443834 -0.040176637 0.008892836 0.087481224 -0.157493298
#> [811] -0.297832749 0.377821225 -0.470991070 -0.434041542 -0.523232853
#> [816] -0.516746468 -0.624862146 0.152160668 0.244793246 0.493381396
#> [821] 0.891687962 0.905772669 0.633213188 0.601518464 0.644984320
#> [826] 0.364074139 -0.046246182 -0.113555303 -0.200688753 -0.196479934
#> [831] -0.218371636 0.289589259 0.441334469 0.250291233 0.547301874
#> [836] 0.879037067 0.686756826 0.361212565 0.632604782 0.461828605
#> [841] 0.171524690 0.378413443 0.574556578 0.533489871 0.056691505
#> [846] 0.119317824 -0.405557600 -0.210207737 -0.071391878 0.118735826
#> [851] 0.180995962 0.558473068 0.283648236 0.080928952 0.120192038
#> [856] -0.187331988 -0.659354777 -0.831736994 -0.442624402 -0.718839407
#> [861] -0.375290471 0.252864848 0.795448829 0.472710906 0.599924077
#> [866] 0.282684590 0.478161811 -0.057375877 -0.180220397 -0.234377181
#> [871] -0.151514753 -0.967532756 -0.846912074 -0.941785684 -1.051652786
#> [876] -0.945848459 -0.603018124 -0.338768071 -0.301030181 -0.068664870
#> [881] -0.095103291 0.028250359 -0.331037058 -0.149652979 -0.206699622
#> [886] -0.481052224 -0.634237897 -0.211167174 0.022152347 0.127325142
#> [891] 0.112916876 0.022185144 -0.293907895 -0.168969884 -0.266160338
#> [896] 0.005512922 0.256750393 0.022235061 -0.403748008 -0.547660528
#> [901] -0.761697544 -0.791639085 -0.313021058 0.232321848 0.382504240
#> [906] 0.760145752 0.723340836 0.595701253 0.184628603 0.328193579
#> [911] 0.206020358 0.170286432 0.119792107 0.130339730 0.070197005
#> [916] 0.053484411 0.174439905 0.183659693 -0.118521000 0.354797661
#> [921] 0.500400536 0.164560982 0.205941438 0.343986603 0.379713821
#> [926] 0.028815731 -0.008756984 -0.224732766 -0.297440077 -1.118096955
#> [931] -0.882026208 -0.465900911 -0.141737354 -0.099451887 -0.039233863
#> [936] -0.193875271 -0.207028817 -0.492589341 -0.530831285 -0.346977186
#> [941] -0.193622940 0.047283748 0.347804902 0.503076206 0.896391700
#> [946] 0.974698888 0.899187472 0.296733366 0.120628254 0.030122635
#> [951] -0.082850068 -0.020830447 0.492746262 0.518842530 0.562752158
#> [956] 0.681030497 0.228765309 0.633359381 0.908634576 0.579342324
#> [961] 0.287251940 0.431048271 -0.071373430 -0.457125557 -0.139063142
#> [966] -0.036307950 -0.294287938 -0.313725554 -0.029005532 -0.352259137
#> [971] -0.212718998 -0.062276999 0.047154534 -0.034290918 -0.213114192
#> [976] -0.151154382 -0.392021629 -0.454176191 -0.536787199 0.086920796
#> [981] 0.055960411 0.386461407 0.136941689 0.576009917 0.454748248
#> [986] 0.980966536 0.989586857 1.363430592 1.235803618 0.740438135
#> [991] -0.233898770 -0.334705799 -0.331340626 0.074464356 0.286150405
#> [996] 0.423854909 0.276530987 0.216841273 -0.275231766 -0.264070023