Closed dkunichoff closed 4 years ago
df$wfhz <- ifelse(df$data.sex==1, who_value2zscore(df$data.cm, df$data.kg, x_var = "htcm", y_var = "wtkg", sex = "Male"), who_value2zscore(data$cm, data$kg, x_var = "htcm", y_var = "wtkg", sex = "Female"))
df$wfaz <- ifelse(df$data.sex==1, who_value2zscore(df$data.DayOldatVisit, df$data.kg, x_var = "agedays", y_var = "wtkg", sex = "Male"), who_value2zscore(df$data.DayOldatVisit, df$data.kg, x_var = "agedays", y_var = "wtkg", sex = "Female"))
Can you provide a reproducible example that shows this behavior?
Hi, Thanks for getting back to me. Below is a sample run with some values directly from my data but I’m also attaching a screenshot of my data which might help. In the screenshot, wfhz_trial is the variable produced from the weight-for-height function. You’ll also see that the percentile function (wfhztile) also didn’t work on many rows. I tried another z-score calculator (variable: wfhz) from the package zscorer and that seemed to work much more effectively. Additionally, weight-for-age (variable: wfaz) from growthstandards package does work. Any and all help with this will be appreciated as I can’t figure out what the issue is.
weight <- c(5.0355,5.7105,9.2520,7.2855) height <- c(59.0550,60.9600,80.0100,63.5000) sex <- c(2,2,2,1) trial <- data.frame(weight,height,sex) trial$wfhz <- ifelse(trial$sex==1, who_value2zscore(trial$height, trial$weight, x_var = "htcm", y_var = "wtkg", sex = "Male"), who_value2zscore(trial$height, trial$weight, x_var = "htcm", y_var = "wtkg", sex = "Female")) print.data.frame(trial)
weight height sex wfhz 1 5.0355 59.055 2 NA 2 5.7105 60.960 2 NA 3 9.2520 80.010 2 -1.152997 4 7.2855 63.500 1 NA
Dennis Kunichoff, MPH Assistant Research Scientist
NYU Langone Health Division of Biostatistics Department of Population Health 180 Madison Avenue, 9th floor, 9-36A
T: 646-501-3637 Dennis.kunichoff@nyulangone.org
From: hafen notifications@github.com Sent: Wednesday, September 25, 2019 8:44 PM To: ki-tools/growthstandards growthstandards@noreply.github.com Cc: Kunichoff, Dennis Dennis.Kunichoff@nyulangone.org; Author author@noreply.github.com Subject: Re: [ki-tools/growthstandards] Some z-scores not being created (#5)
Can you provide a reproducible example that shows this behavior?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ki-2Dtools_growthstandards_issues_5-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DANJCNQOJVHWS64BZHRSF67LQLQAV5A5CNFSM4IZRLVA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7T3SNA-23issuecomment-2D535279924&d=DwMCaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=8yrSy1bejjLI7TwZaZ3VfSKXetO9VwAyM6v2xAIdLaE&m=B9z1W15zgsx7OHMftk27GGzw1kHmZ71lTtU7441MMSQ&s=G4UA3S6CQWbUjeWE0KCzMIFUEO0wf-Xmxig0hZUggac&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ANJCNQPWR6YYPCPNOX7DCUDQLQAV5ANCNFSM4IZRLVAQ&d=DwMCaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=8yrSy1bejjLI7TwZaZ3VfSKXetO9VwAyM6v2xAIdLaE&m=B9z1W15zgsx7OHMftk27GGzw1kHmZ71lTtU7441MMSQ&s=B5YsY5ajZg5Lq9BmV028YVP4q7YN9oLrJclX8lijITQ&e=.
Hi,
I just wanted to follow up on this issue I had. I played with the data a little bit after sending this to you and changed the weights I listed in the data I made to values of 9 and above and found that the function was able to compute z-scores for them all. I’m still confused as to why this is happening because it’s computing other values that have weights <9kg, and the other function still works on those values too. Please let me know if you’ve been able to figure anything out. Thanks, again, for your help. Much appreciated, Dennis
Dennis Kunichoff, MPH Assistant Research Scientist
NYU Langone Health Division of Biostatistics Department of Population Health 180 Madison Avenue, 9th floor, 9-36A
T: 646-501-3637 Dennis.kunichoff@nyulangone.org
From: Kunichoff, Dennis Sent: Thursday, September 26, 2019 4:04 PM To: 'ki-tools/growthstandards' reply@reply.github.com Subject: RE: [ki-tools/growthstandards] Some z-scores not being created (#5)
Hi, Thanks for getting back to me. Below is a sample run with some values directly from my data but I’m also attaching a screenshot of my data which might help. In the screenshot, wfhz_trial is the variable produced from the weight-for-height function. You’ll also see that the percentile function (wfhztile) also didn’t work on many rows. I tried another z-score calculator (variable: wfhz) from the package zscorer and that seemed to work much more effectively. Additionally, weight-for-age (variable: wfaz) from growthstandards package does work. Any and all help with this will be appreciated as I can’t figure out what the issue is.
weight <- c(5.0355,5.7105,9.2520,7.2855) height <- c(59.0550,60.9600,80.0100,63.5000) sex <- c(2,2,2,1) trial <- data.frame(weight,height,sex) trial$wfhz <- ifelse(trial$sex==1, who_value2zscore(trial$height, trial$weight, x_var = "htcm", y_var = "wtkg", sex = "Male"), who_value2zscore(trial$height, trial$weight, x_var = "htcm", y_var = "wtkg", sex = "Female")) print.data.frame(trial)
weight height sex wfhz 1 5.0355 59.055 2 NA 2 5.7105 60.960 2 NA 3 9.2520 80.010 2 -1.152997 4 7.2855 63.500 1 NA
Dennis Kunichoff, MPH Assistant Research Scientist
NYU Langone Health Division of Biostatistics Department of Population Health 180 Madison Avenue, 9th floor, 9-36A
T: 646-501-3637 Dennis.kunichoff@nyulangone.orgmailto:Dennis.kunichoff@nyulangone.org
From: hafen notifications@github.com<mailto:notifications@github.com> Sent: Wednesday, September 25, 2019 8:44 PM To: ki-tools/growthstandards growthstandards@noreply.github.com<mailto:growthstandards@noreply.github.com> Cc: Kunichoff, Dennis Dennis.Kunichoff@nyulangone.org<mailto:Dennis.Kunichoff@nyulangone.org>; Author author@noreply.github.com<mailto:author@noreply.github.com> Subject: Re: [ki-tools/growthstandards] Some z-scores not being created (#5)
Can you provide a reproducible example that shows this behavior?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ki-2Dtools_growthstandards_issues_5-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DANJCNQOJVHWS64BZHRSF67LQLQAV5A5CNFSM4IZRLVA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7T3SNA-23issuecomment-2D535279924&d=DwMCaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=8yrSy1bejjLI7TwZaZ3VfSKXetO9VwAyM6v2xAIdLaE&m=B9z1W15zgsx7OHMftk27GGzw1kHmZ71lTtU7441MMSQ&s=G4UA3S6CQWbUjeWE0KCzMIFUEO0wf-Xmxig0hZUggac&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ANJCNQPWR6YYPCPNOX7DCUDQLQAV5ANCNFSM4IZRLVAQ&d=DwMCaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=8yrSy1bejjLI7TwZaZ3VfSKXetO9VwAyM6v2xAIdLaE&m=B9z1W15zgsx7OHMftk27GGzw1kHmZ71lTtU7441MMSQ&s=B5YsY5ajZg5Lq9BmV028YVP4q7YN9oLrJclX8lijITQ&e=.
Sorry for the delay on this. Just a quick check: Are these observations from children younger than 2 years old or older than 2? If younger than 2, use x_var = "lencm"
. If older than 2, I need to do some more investigation.
I have fixed a bug that, when only a single value exists for a combination of x_var
/y_var
/sex
, values provided that are outside the range of the charts provided by WHO can still receive a value by trying to extrapolate outside the range. Now a message is omitted (in all cases) when values are provided outside the range and are set to NA.
For example:
weight <- c(5.0355, 5.7105, 9.2520, 7.2855)
height <- c(59.0550, 60.9600, 80.0100, 63.5000)
sex <- c("Female", "Female", "Female", "Male")
trial <- data.frame(weight, height, sex, stringsAsFactors = FALSE)
trial$wfhz <- who_value2zscore(trial$height, trial$weight,
x_var = "lencm", y_var = "wtkg", sex = trial$sex)
trial
## weight height sex wfhz
## 1 5.0355 59.055 Female -1.2472843
## 2 5.7105 60.960 Female -0.7626076
## 3 9.2520 80.010 Female -0.9874578
## 4 7.2855 63.500 Male 0.6482668
trial$wfhz <- who_value2zscore(trial$height, trial$weight,
x_var = "htcm", y_var = "wtkg", sex = trial$sex)
## Observations with htcm value of 59.055, 60.96 are outside the range of the standard. Setting to NA.
## Observations with htcm value of 63.5 are outside the range of the standard. Setting to NA.
trial
## weight height sex wfhz
## 1 5.0355 59.055 Female NA
## 2 5.7105 60.960 Female NA
## 3 9.2520 80.010 Female -1.152997
## 4 7.2855 63.500 Male NA
Thanks so much! This helped and now I can compute all my values. Also made sure to use the appropriate height x_var, thanks for that. Your help is very much appreciated.
Best, Dennis
Dennis Kunichoff, MPH Assistant Research Scientist
NYU Langone Health Division of Biostatistics Department of Population Health 180 Madison Avenue, 9th floor, 9-36A
T: 646-501-3637 Dennis.kunichoff@nyulangone.org
From: hafen notifications@github.com Sent: Tuesday, October 1, 2019 6:55 PM To: ki-tools/growthstandards growthstandards@noreply.github.com Cc: Kunichoff, Dennis Dennis.Kunichoff@nyulangone.org; Author author@noreply.github.com Subject: Re: [ki-tools/growthstandards] Some z-scores not being created (#5)
I have fixed a bug that, when only a single value exists for a combination of x_var/y_var/sex, values provided that are outside the range of the charts provided by WHO can still receive a value by trying to extrapolate outside the range. Now a message is omitted (in all cases) when values are provided outside the range and are set to NA.
For example:
weight <- c(5.0355, 5.7105, 9.2520, 7.2855)
height <- c(59.0550, 60.9600, 80.0100, 63.5000)
sex <- c("Female", "Female", "Female", "Male")
trial <- data.frame(weight, height, sex, stringsAsFactors = FALSE)
trial$wfhz <- who_value2zscore(trial$height, trial$weight,
x_var = "lencm", y_var = "wtkg", sex = trial$sex)
trial
trial$wfhz <- who_value2zscore(trial$height, trial$weight,
x_var = "htcm", y_var = "wtkg", sex = trial$sex)
trial
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ki-2Dtools_growthstandards_issues_5-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DANJCNQLDL2PTRGITC2ZGBT3QMPINHA5CNFSM4IZRLVA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEADAJ6A-23issuecomment-2D537265400&d=DwMCaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=8yrSy1bejjLI7TwZaZ3VfSKXetO9VwAyM6v2xAIdLaE&m=FeN_p7icHfx6xCfNnY1lTapdkz3SyWw7e0I99zihJY4&s=681eAj2xGSlyPkXgKHEzPNiwhou9fGWQf-EE0uKqIIA&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ANJCNQJSDFTFQQQFFBL4HLLQMPINHANCNFSM4IZRLVAQ&d=DwMCaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=8yrSy1bejjLI7TwZaZ3VfSKXetO9VwAyM6v2xAIdLaE&m=FeN_p7icHfx6xCfNnY1lTapdkz3SyWw7e0I99zihJY4&s=qNPdH4wvvsEAtiYoWY3dfrRUzUurjQSI3RQz-LyNCuQ&e=.
Great!
I have a dataset with height (cm) and weight (kg) and sex (f/m) and the command who_value2zscore() is failing to calculate the z-scores. My data is in all the correct formats (numeric for the weight/height and within the ranges) and the code I'm running is fine. Additionally, I have used the same line of code on other data and have had no problem AND have no problem getting calculations for weight-for-age when using my age-days variable. There doesn't seem to be a logic behind which ones it leaves out except that all the observations are generally smaller weights than those that get calculated. My code below: