Separate the given sample into 2 subsamples: one, for which the residuals are below zero and another, for which they are above zero. Create variable Unscrambled.Selection.Sequence estimating switching between the two subsamples (1 corresponds to the positive residual case and 0 corresponds to the negative residual case).
head(Unscrambled.Selection.Sequence,30)
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
## 0 0 1 0 1 1 1 0 0 1 1 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1
## 27 28 29 30
## 0 0 0 0
and my data is:
dput(head(Unscrambled.Selection.Sequence, 30))
c(`1` = 1, `2` = 1, `3` = 0, `4` = 0, `5` = 1, `6` = 1, `7` = 0,
`8` = 1, `9` = 0, `10` = 0, `11` = 0, `12` = 0, `13` = 1, `14` = 0,
`15` = 0, `16` = 0, `17` = 0, `18` = 0, `19` = 0, `20` = 0, `21` = 1,
`22` = 0, `23` = 0, `24` = 0, `25` = 1, `26` = 1, `27` = 0, `28` = 0,
`29` = 1, `30` = 1)
but if I do this way, only "FALSE" showed up instead of 0 or 1, so anyone know to make a group of residuals values to 0 when they are below 0. Thank you!