Skip to content

Commit

Permalink
Fix ewma testing for including 3 rows
Browse files Browse the repository at this point in the history
  • Loading branch information
delosh653 committed Aug 22, 2023
1 parent 8f8df59 commit 226ebf5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions R/infants_clean.R
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ cleanbatch_infants <- function(data.df,
data.df[valid_set & param == "HEIGHTCM" & sd.orig_uncorr > 8,
exclude := exc_nam]

print("Standard BIV")
print(data.df[param == "HEIGHTCM",c(ageyears, param, sd.orig_uncorr)])

# head circumference
data.df[valid_set & param == "HEADCM" & sd.orig_uncorr < -15,
exclude := exc_nam]
Expand Down Expand Up @@ -893,15 +890,15 @@ cleanbatch_infants <- function(data.df,

#15c: exclude agedays = 0 for ht, hc
#15d: calculate ewma -- run within a subject/parameter
df <- df[(param != "HEIGHTCM" | param != "HEADCM") & agedays != 0,
df[(param != "HEIGHTCM" | param != "HEADCM") & agedays != 0,
exclude := (function(df_sub) {
# save initial exclusions to keep track
ind_all <- copy(df_sub$index)
exclude_all <- copy(df_sub$exclude)

testing <- TRUE

while (testing & nrow(df_sub) > 3){
while (testing & nrow(df_sub) >= 3){
df_sub[, (ewma.fields) := as.double(NaN)]

# first, calculate which exponent we want to put through (pass a different
Expand Down Expand Up @@ -1162,7 +1159,7 @@ cleanbatch_infants <- function(data.df,

testing <- TRUE

while (testing & nrow(df_sub) > 3){
while (testing & nrow(df_sub) >= 3){
df_sub[, (ewma.fields) := as.double(NaN)]

# first, calculate which exponent we want to put through (pass a different
Expand Down

0 comments on commit 226ebf5

Please sign in to comment.