Yanni
June 15, 2022, 7:01am
1
I have a set of time series data, which is the result of rolling regression, but some values are equal to 0. Is there any way to make these values not equal to 0?
0.678381848
0.698492668
0.774965327
0.767932055
0.802818131
0.782082661
0.786376696
0.772711555
0.825326482
0.429966983
0.369878256
0.143088442
0
0.427885146
0
0
0
0.222640205
0.611751119
0.829285752
0.914277054
0.857415164
0.880801407
0.961729734
0.954150056
0.928363388
what would you wish them to be ?
Yanni
June 15, 2022, 8:51am
3
I wish no 0 in the data and other data unchanged, or is there any way to make it look smooth?
like this then
#problem
(somevec <- rep(0:5,2))
#solution
somevec[somevec>0]
Yanni
June 15, 2022, 9:09am
5
Thank you very much for your reply. I know what you mean, but I wish the number of observations not to decrease, that is to say the total number of observations remains the same.
Then you seem to be asking for the impossible.
to change the data and to not change the data...
I suppose that depends on how willing you are to distort your non-zero data.
i.e. a loess smoothing
somevec <- c(0.678381848,
0.698492668,
0.774965327,
0.767932055,
0.802818131,
0.782082661,
0.786376696,
0.772711555,
0.825326482,
0.429966983,
0.369878256,
0.143088442,
0,
0.427885146,
0,
0,
0,
0.222640205,
0.611751119,
0.829285752,
0.914277054,
0.857415164,
0.880801407,
0.961729734,
0.954150056,
0.928363388)
library(tidyverse)
ggplot(data = enframe(somevec),
mapping = aes(x=name,y=value)) +
geom_point() +
geom_smooth(method = "loess",se = FALSE)
Yanni
June 15, 2022, 9:33am
8
Wow~ That sounds like a good idea. Thank you very much for your reply.
system
Closed
July 6, 2022, 9:33am
9
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.