diff --git a/_gclassify_sga.ado b/_gclassify_sga.ado index 6d59512..9272dd0 100644 --- a/_gclassify_sga.ado +++ b/_gclassify_sga.ado @@ -1,6 +1,6 @@ capture program drop _gclassify_sga capture program drop SGA_Badsyntax -*! version 0.3.0 (SJxx-x: dmxxxx) +*! version 0.3.1 (SJxx-x: dmxxxx) program define _gclassify_sga version 16 preserve diff --git a/_gclassify_stunting.ado b/_gclassify_stunting.ado index d433d41..ef99e12 100644 --- a/_gclassify_stunting.ado +++ b/_gclassify_stunting.ado @@ -1,5 +1,5 @@ capture program drop _gclassify_stunting -*! version 0.3.0 (SJxx-x: dmxxxx) +*! version 0.3.1 (SJxx-x: dmxxxx) program define _gclassify_stunting version 16 preserve @@ -50,18 +50,22 @@ program define _gclassify_stunting else StuntingSex_Badsyntax marksample touse - tempvar pma_weeks z_PNG z_WHO z + tempvar pma_weeks pma_wks_floored z_NBS z_PNG z_WHO z qui { - gen double `pma_weeks' = floor((`age_days' + `gest_days') / 7) + gen double `pma_weeks' = (`age_days' + `gest_days') / 7 + gen double `pma_wks_floored' = floor(`pma_weeks') + + egen double `z_NBS' = ig_nbs(`input', "lfga", "v2z"), /// + gest_days(`gest_days') sex(`sex') sexcode(m="`male'", f="`female'") egen double `z_PNG' = ig_png(`input', "lfa", "v2z"), /// - xvar(`pma_weeks') sex(`sex') sexcode(m="`male'", f="`female'") + xvar(`pma_wks_floored') sex(`sex') sexcode(m="`male'", f="`female'") egen double `z_WHO' = who_gs(`input', "lhfa", "v2z"), /// xvar(`age_days') sex(`sex') sexcode(m="`male'", f="`female'") - - gen double `z' = `z_PNG' if /// - `gest_days' >= 182 & `gest_days' < 259 & /// + + gen double `z' = `z_NBS' if `age_days' == 0 + replace `z' = `z_PNG' if `age_days' > 0 & `gest_days' < 259 & /// `pma_weeks' >= 27 & `pma_weeks' <= 64 - replace `z' = `z_WHO' if `gest_days' >= 259 | /// + replace `z' = `z_WHO' if `age_days' > 0 & `gest_days' >= 259 | /// (`gest_days' < 259 & `pma_weeks' > 64) generate `type' `return' = . diff --git a/_gclassify_svn.ado b/_gclassify_svn.ado index d13d155..7a71414 100644 --- a/_gclassify_svn.ado +++ b/_gclassify_svn.ado @@ -1,6 +1,6 @@ capture program drop _gclassify_svn capture program drop SVN_Badsyntax -*! version 0.3.0 (SJxx-x: dmxxxx) +*! version 0.3.1 (SJxx-x: dmxxxx) program define _gclassify_svn version 16 preserve diff --git a/_gclassify_wasting.ado b/_gclassify_wasting.ado index 9ab7a95..8ba13f2 100644 --- a/_gclassify_wasting.ado +++ b/_gclassify_wasting.ado @@ -1,5 +1,5 @@ capture program drop _gclassify_wasting -*! version 0.3.0 (SJxx-x: dmxxxx) +*! version 0.3.1 (SJxx-x: dmxxxx) program define _gclassify_wasting version 16 preserve @@ -54,25 +54,22 @@ program define _gclassify_wasting tempvar z z_WHO_wfh z_WHO_wfl z_png qui { + egen double `z_png' = ig_png(`weight_kg', "wfl", "v2z"), /// + xvar(`lenht_cm') sex(`sex') sexcode(m="`male'", f="`female'") egen double `z_WHO_wfl' = who_gs(`weight_kg', "wfl", "v2z"), /// xvar(`lenht_cm') sex(`sex') sexcode(m="`male'", f="`female'") egen double `z_WHO_wfh' = who_gs(`weight_kg', "wfh", "v2z"), /// xvar(`lenht_cm') sex(`sex') sexcode(m="`male'", f="`female'") - egen double `z_png' = ig_png(`weight_kg', "wfl", "v2z"), /// - xvar(`lenht_cm') sex(`sex') sexcode(m="`male'", f="`female'") tempvar pma_weeks use_png use_who - gen double `pma_weeks' = floor((`age_days' + `gest_days') / 7) - gen byte `use_png' = 1 if `gest_days' >= 182 & `gest_days' < 259 & /// + gen double `pma_weeks' = (`age_days' + `gest_days') / 7 + gen byte `use_png' = 1 if `gest_days' < 259 & /// `pma_weeks' >= 27 & `pma_weeks' <= 64 gen double `z' = . replace `z' = `z_png' if `use_png' == 1 - replace `z' = `z_WHO_wfl' if `gest_days' >= 259 & /// - `age_days' < 731 - replace `z' = `z_WHO_wfh' if `gest_days' >= 259 & /// - `age_days' >= 731 - + replace `z' = `z_WHO_wfl' if `use_png' != 1 & `age_days' < 731 + replace `z' = `z_WHO_wfh' if `use_png' != 1 & `age_days' >= 731 gen `type' `return' = . replace `return' = -1 if float(`z') <= -2 diff --git a/_gclassify_wfa.ado b/_gclassify_wfa.ado index 42b369e..94b8c3e 100644 --- a/_gclassify_wfa.ado +++ b/_gclassify_wfa.ado @@ -1,5 +1,5 @@ capture program drop _gclassify_wfa -*! version 0.3.0 (SJxx-x: dmxxxx) +*! version 0.3.1 (SJxx-x: dmxxxx) program define _gclassify_wfa version 16 preserve @@ -17,7 +17,7 @@ program define _gclassify_wfa error 198 } - syntax [if] [in], GEST_days(varname numeric) age_days(varname) /* + syntax [if] [in], GEST_days(varname numeric) age_days(varname numeric) /* */ sex(varname) SEXCode(string) [OUTliers BY(string)] if `"`by'"' != "" { @@ -36,7 +36,7 @@ program define _gclassify_wfa WFASex_Badsyntax } local male "`3'" - local female "`6'" + local female "`6'" } else if "`1'" == substr("female",1,length("`1'")) { if "`2'" ~= "=" | "`5'" ~= "=" | /* @@ -51,21 +51,24 @@ program define _gclassify_wfa marksample touse - tempvar pma_weeks acronym z_WHO z_PNG z standard + tempvar pma_weeks pma_wks_floored z_NBS z_PNG z_WHO z qui { - gen double `pma_weeks' = floor((`age_days' + `gest_days') / 7) + gen double `pma_weeks' = (`age_days' + `gest_days') / 7 + gen double `pma_wks_floored' = floor(`pma_weeks') + + egen double `z_NBS' = ig_nbs(`weight_kg', "wfga", "v2z"), /// + gest_days(`gest_days') sex(`sex') sexcode(m="`male'", f="`female'") egen double `z_PNG' = ig_png(`weight_kg', "wfa", "v2z"), /// - xvar(`pma_weeks') sex(`sex') sexcode(m="`male'", f="`female'") - egen double `z_WHO' = who_gs(`weight_kg', "wfa", "v2z"), xvar(`age_days') /// - sex(`sex') sexcode(m="`male'", f="`female'") - - gen double `z' = `z_PNG' if /// - `gest_days' >= 182 & `gest_days' < 259 & /// - `pma_weeks' >= 27 & `pma_weeks' < 64 - replace `z' = `z_WHO' if /// - `gest_days' < 182 | `gest_days' >= 259 | `pma_weeks' < 27 | /// - `pma_weeks' >= 64 + xvar(`pma_wks_floored') sex(`sex') sexcode(m="`male'", f="`female'") + egen double `z_WHO' = who_gs(`weight_kg', "wfa", "v2z"), /// + xvar(`age_days') sex(`sex') sexcode(m="`male'", f="`female'") + gen double `z' = `z_NBS' if `age_days' == 0 + replace `z' = `z_PNG' if `age_days' > 0 & `gest_days' < 259 & /// + `pma_weeks' >= 27 & `pma_weeks' <= 64 + replace `z' = `z_WHO' if `age_days' > 0 & `gest_days' >= 259 | /// + (`gest_days' < 259 & `pma_weeks' > 64) + generate `type' `return' = . replace `return' = -1 if float(`z') <= -2 replace `return' = -2 if float(`z') <= -3 diff --git a/_gig_nbs.ado b/_gig_nbs.ado index 9d877d7..7ca4083 100644 --- a/_gig_nbs.ado +++ b/_gig_nbs.ado @@ -1,7 +1,7 @@ capture program drop _gig_nbs capture program drop Badsexvar_nbs capture program drop Badsyntax_nbs -*! version 0.3.0 (SJxx-x: dmxxxx) +*! version 0.3.1 (SJxx-x: dmxxxx) program define _gig_nbs version 16 preserve diff --git a/_gig_png.ado b/_gig_png.ado index 1c4816f..ab3195e 100644 --- a/_gig_png.ado +++ b/_gig_png.ado @@ -1,7 +1,7 @@ capture program drop _gig_png capture program drop Badsexvar_png capture program drop Badsyntax_png -*! version 0.3.0 (SJxx-x: dmxxxx) +*! version 0.3.1 (SJxx-x: dmxxxx) program define _gig_png version 16 preserve diff --git a/_gwho_gs.ado b/_gwho_gs.ado index c480818..d9c6553 100644 --- a/_gwho_gs.ado +++ b/_gwho_gs.ado @@ -1,7 +1,7 @@ capture program drop _gwho_gs capture program drop Badsexvar_who capture program drop Badsyntax_who -*! version 0.3.0 (SJxx-x: dmxxxx) +*! version 0.3.1 (SJxx-x: dmxxxx) program define _gwho_gs version 16 preserve diff --git a/benchmarking/benchmark.do b/benchmarking/benchmark.do index 683fe5c..8dd4c45 100644 --- a/benchmarking/benchmark.do +++ b/benchmarking/benchmark.do @@ -13,39 +13,47 @@ be checked out on the R package website in the benchmarking article (https://lshtm-gigs.github.io/gigs/) */ +clear all +foreach file in "_gclassify_sga.ado" "_gclassify_svn.ado" /// + "_gclassify_stunting.ado" "_gclassify_wasting.ado" /// + "_gclassify_wfa.ado" /// + "_gig_nbs.ado" "_gig_png.ado" "_gwho_gs.ado" /// + "gigs_ipolate_coeffs.ado" { + run "`file'" +} -// gigs 0.3.0: -// foreach i in 1 10 100 500 1000 5000 10000 25000 50000 75000 100000 { -// use "benchmarking/bench_dataset.dta", clear -// qui drop if _n > `i' -// di "Number of inputs: `i'" -// bench, reps(25) restore last: /// -// qui egen double z_gigs = who_gs(y, "wfa", "v2z"), /// -// xvar(x) sex(sex) sexcode(m=M, f=F) -// } +foreach i in 1 10 100 500 1000 5000 10000 25000 50000 75000 100000 { + use "benchmarking/bench_dataset.dta", clear + qui drop if _n > `i' + di "Number of inputs: `i'" + bench, reps(25) restore last: /// + qui egen double z_gigs = who_gs(y, "wfa", "v2z"), /// + xvar(x) sex(sex) sexcode(m=M, f=F) +} +// gigs 0.3.1: // Number of inputs: 1 // Average over 25 runs: 0.008 seconds // Number of inputs: 10 -// Average over 25 runs: 0.010 seconds +// Average over 25 runs: 0.009 seconds // Number of inputs: 100 -// Average over 25 runs: 0.010 seconds +// Average over 25 runs: 0.009 seconds // Number of inputs: 500 -// Average over 25 runs: 0.011 seconds +// Average over 25 runs: 0.010 seconds // Number of inputs: 1000 -// Average over 25 runs: 0.013 seconds +// Average over 25 runs: 0.012 seconds // Number of inputs: 5000 // Average over 25 runs: 0.028 seconds // Number of inputs: 10000 -// Average over 25 runs: 0.048 seconds +// Average over 25 runs: 0.047 seconds // Number of inputs: 25000 -// Average over 25 runs: 0.107 seconds +// Average over 25 runs: 0.106 seconds // Number of inputs: 50000 -// Average over 25 runs: 0.205 seconds +// Average over 25 runs: 0.204 seconds // Number of inputs: 75000 -// Average over 25 runs: 0.313 seconds +// Average over 25 runs: 0.310 seconds // Number of inputs: 100000 -// Average over 25 runs: 0.431 seconds +// Average over 25 runs: 0.410 seconds // zanthro 1.0.2: // foreach i in 1 10 100 500 1000 5000 10000 25000 50000 75000 100000 { @@ -90,6 +98,30 @@ egen z_anthro = zanthro(y, wa, WHO), xvar(x) gender(sex) /// // OLD VERSIONS OF GIGS -------------------------------------------------------- // Kept to note how development is progressing +// gigs 0.3.0: +// Number of inputs: 1 +// Average over 25 runs: 0.008 seconds +// Number of inputs: 10 +// Average over 25 runs: 0.010 seconds +// Number of inputs: 100 +// Average over 25 runs: 0.010 seconds +// Number of inputs: 500 +// Average over 25 runs: 0.011 seconds +// Number of inputs: 1000 +// Average over 25 runs: 0.013 seconds +// Number of inputs: 5000 +// Average over 25 runs: 0.028 seconds +// Number of inputs: 10000 +// Average over 25 runs: 0.048 seconds +// Number of inputs: 25000 +// Average over 25 runs: 0.107 seconds +// Number of inputs: 50000 +// Average over 25 runs: 0.205 seconds +// Number of inputs: 75000 +// Average over 25 runs: 0.313 seconds +// Number of inputs: 100000 +// Average over 25 runs: 0.431 seconds + // gigs 0.2.4: // Number of inputs: 1 // Average over 25 runs: 0.016 seconds diff --git a/classify_sga.sthlp b/classify_sga.sthlp index a3c955d..ad6ac94 100644 --- a/classify_sga.sthlp +++ b/classify_sga.sthlp @@ -1,14 +1,13 @@ {smcl} -{* *! version 0.3.0 24 Sep 2023}{...} +{* *! version 0.3.1 22 Nov 2023}{...} {vieweralsosee "" "--"}{...} {vieweralsosee "gigs: Classification functions" "help classify_sga"}{...} -{viewerjumpto "Syntax" "ig_nbs##syntax"}{...} -{viewerjumpto "Description" "ig_nbs##description"}{...} -{viewerjumpto "Functions" "ig_nbs##functions"}{...} -{viewerjumpto "Options" "ig_nbs##options"}{...} -{viewerjumpto "Available Standards" "ig_nbs##standards"}{...} -{viewerjumpto "Remarks" "ig_nbs##remarks"}{...} -{viewerjumpto "Examples" "ig_nbs##examples"}{...} +{viewerjumpto "Syntax" "classify_sga##syntax"}{...} +{viewerjumpto "Description" "classify_sga##description"}{...} +{viewerjumpto "Functions" "classify_sga##functions"}{...} +{viewerjumpto "Options" "classify_sga##options"}{...} +{viewerjumpto "Remarks" "classify_sga##remarks"}{...} +{viewerjumpto "Examples" "classify_sga##examples"}{...} {hi:help classify_sga, help classify_svn, help classify_stunting, help classify_wasting, help classify_wfa}{right: ({browse "https://www.overleaf.com/project/641db63564edd62fb54c963b":SJXX-X: st0001})} {hline} @@ -117,10 +116,11 @@ example, {cmd:weight_kg}, {cmd:mean_wgt}). {p 4 4 2}{hi:classify_stunting(}{varname}{cmd:)} is used to classify stunting in - infants up to five years old using the INTERGROWTH-21st standards for postnatal - growth or WHO Child Growth Standards as appropriate. It produces a variable - with the following values and labels, where 'outlier' classifications are only - applied if the {cmd:outliers} option is specified by the user. + infants up to five years old using appropriate INTERGROWTH-21st/WHO + length/height-for-age standards for each observation, based on their + gestational age and age in days. It produces a variable with the following + values and labels, where 'outlier' classifications are only applied if the + {cmd:outliers} option is specified by the user. {col 20}Value{col 27}Label{col 45}{it:Z}-score range {col 20}{hline 38} @@ -135,10 +135,12 @@ example, {cmd:meaninflen}, {cmd:lenht}). {p 4 4 2}{hi:classify_wasting(}{varname}{cmd:)} is used to classify wasting in - infants up to five years old using the WHO Child Growth Standards for - weight-for-length and weight-for-height as appropriate. It produces a variable - with the following values and labels, where 'outlier' classifications are only - applied if the {cmd:outliers} option is specified by the user. + infants up to five years old using the INTERGROWTH-21st Postnatal Growth/WHO + Child Growth standards for weight-for-length and weight-for-height as + appropriate, based on each observation's gestational age and age in days. It + produces a variable with the following values and labels, where 'outlier' + classifications are only applied if the {cmd:outliers} option is specified by + the user. {col 20}Value{col 27}Label{col 45}{it:Z}-score range {col 20}{hline 38} @@ -154,8 +156,9 @@ example, {cmd:weight_kg}, {cmd:mean_wgt}). {p 4 4 2}{hi:classify_wfa(}{varname}{cmd:)} is used to classify weight-for-age - in infants up to five years old using the INTERGROWTH-21st standards for - postnatal growth or WHO Child Growth Standards as appropriate. It produces a + in infants up to five years old using the INTERGROWTH-21st Newborn + Size/Postnatal Growth standards or WHO Child Growth Standards as appropriate, + based on each observation's gestational age and age in days. It produces a variable with the following values and labels, where 'outlier' classifications are only applied if the {cmd:outliers} option is specified by the user. @@ -169,13 +172,21 @@ {pmore}This function takes one argument: -{pmore}{varname}is the variable name for weight in kg in your dataset (for +{pmore}{varname} is the variable name for weight in kg in your dataset (for example, {cmd:weight_kg}, {cmd:mean_wgt}). {marker options}{...} {title:Options} {dlgtab:Non-specific} +{phang}{opt gest:_days(varname numeric)} specifies gestational age in days for + newborns. In {cmd:classify_sga()} and {cmd:classify_sga()},any value outside + the range of valid gestational ages as specified in the + {help ig_nbs##tab1:ig_nbs() documentation} will return a missing value. In the + other classification functions, this variable is used to compute post-menstrual + ages, and therefore determines which growth standard is applied for each + observation. + {phang}{opt sex(varname)} specifies the sex variable. It can be int, byte, or string. The codes for {cmd:male} and {cmd:female} must be specified by the {hi:sexcode()} option. @@ -185,37 +196,31 @@ in either order, and the comma is optional. Quotes around the codes are not allowed, even if your sex variable is a string. -{dlgtab:Size-for-GA/SVN classification} - -{phang}{opt gest:_days(varname numeric)} specifies gestational age in days for - newborns. Any value outside the range of valid gestational ages as specified in - the {help ig_nbs##tab1:ig_nbs() documentation} will return a missing value. - -{dlgtab:Wasting classification} - -{phang}{opt gest:_days(varname numeric)} specifies the gestational age at - birth in days for each observation. +{dlgtab:Wasting, stunting, weight-for-age (underweight) classifications} {phang}{opt age_days(varname numeric)} specifies age in days for each + observation. This variable is used to compute post-menstrual + ages, and therefore determines which growth standard is applied for each observation. -{dlgtab:Stunting classification} +{dlgtab:Wasting classification} {phang}{opt lenht:_cm(varname numeric)} specifies the length or height in cm for - each observation. The method used to obtain these values should be recorded in - {cmd:lenht method()}. - -{dlgtab:Weight-for-age classification} - -{phang}{opt gest:_days(varname numeric)} specifies the gestational age at - birth in days for each observation. - -{phang}{opt age_days(varname numeric)} specifies age in days for each - observation. + each observation. It is assumed that where {hi:age_days()} is less than 731, + recumbent length measurements are provided, and that where {hi:age_days()} is + more than or equal to 731, standing height measurements are provided. {marker remarks}{...} {title:Remarks} +{pstd}These functions apply z-scoring based on the gestational age and age in + days of each observation. In general, observations with a gestational age of + zero days are analysed with {cmd:ig_nbs()}. Preterm infants with a + post-menstrual age of 27 to 64 weeks (inclusive) are analysed with + {cmd:ig_png()}. Term infants and preterm infants over 64 weeks' PMA are + analysed with {cmd:who_gs()}. Check out the source code on GitHub to see which + standards are applied in each function. + {pstd}These functions will return missing values where values are outside the ranges specified for the {help ig_nbs##tab1:gigs conversion functions}, but otherwise will not automatically detect data errors. Ensure you check your @@ -227,17 +232,20 @@ {pstd}Classifying SGA, where {cmd:sex} contains the codes {cmd:1} and {cmd:2}:{p_end} {phang2}{cmd:. egen sga = classify_sga(weight_kg), gest_days(ga_days) sex(sex) sexcode(male=1, female=2)} +{pstd}Include severe SGA classifications with the {opt:severe} option:{p_end} +{phang2}{cmd:. egen sga = classify_sga(weight_kg), gest_days(ga_days) sex(sex) sexcode(male=1, female=2) severe} + {pstd}Classifying stunting, where {cmd:sex} contains the codes {cmd:M} and {cmd:F}:{p_end} {phang2}{cmd:. egen stunting = classify_stunting(weight_kg), gest_days(ga_days) age_days(age) sex(sex) sexcode(male=M, female=F)} -{pstd}Classifying wasting, where {cmd:sex} contains the codes {cmd:M} and {cmd:F}:{p_end} -{phang2}{cmd:. egen wasting = classify_wasting(weight_kg), lenht(lenht_cm) sex(sex) sexcode(male=M, female=F)} +{pstd}Classifying wasting, where {cmd:sex} contains the codes {cmd:m} and {cmd:f}:{p_end} +{phang2}{cmd:. egen wasting = classify_wasting(weight_kg), lenht_cm(lenht_cm) gest_days(ga_days) age_days(age) sex(sex) sexcode(male=m, female=f)} -{pstd}You can use just the first letters of the {cmd:sexcode()} and {cmd:lenhtcode()} arguments instead:{p_end} -{phang2}{cmd:. egen wasting = classify_wasting(weight_kg), lenht(lenht_cm) sex(sex) sexcode(m=Male, f=Female)} +{pstd}You can use just the first letters of the {cmd:lenht_cm()}, {cmd:gest_days()}, and {cmd:sexcode()} arguments instead:{p_end} +{phang2}{cmd:. egen wasting = classify_wasting(weight_kg), lenht(lenht_cm) gest(ga_days) age_days(age) sex(sex) sexc(m=Male, f=Female)} -{pstd}Classifying weight-for-age, where {cmd:sex} contains the codes {cmd:Male} and {cmd:Female}:{p_end} -{phang2}{cmd:. egen wfa = classify_wfa(weight_kg), gest_days(ga_days) age_days(age) sex(sex) sexcode(m=Male, f=Female)} +{pstd}Request that gigs classifies outlier/implasuible values with the {opt:outliers} option:{p_end} +{phang2}{cmd:. egen wasting = classify_wasting(weight_kg), lenht(lenht_cm) gest(ga_days) age_days(age) sex(sex) sexc(m=Male, f=Female) outliers} {marker authors}{...} {title:Authors} diff --git a/gigs.pkg b/gigs.pkg index db05b53..00bfba1 100644 --- a/gigs.pkg +++ b/gigs.pkg @@ -1,4 +1,4 @@ -v 0.3.0 +v 0.3.1 d 'GIGS': Newborn and infant growth assessment using international growth standards d d gigs provides a single, simple interface for working with outputs from the INTERGROWTH-21st project and the WHO Child Growth standards. You will find functions for converting between anthropometric measures (e.g. weight or length) to z-scores and centiles, and the inverse. Also included are functions for classifying newborn and infant growth according to DHS guidelines. diff --git a/gigs.sthlp b/gigs.sthlp index 4e03dca..031b52d 100644 --- a/gigs.sthlp +++ b/gigs.sthlp @@ -1,5 +1,5 @@ {smcl} -{* *! version 0.3.0 14 Nov 2023}{...} +{* *! version 0.3.1 22 Nov 2023}{...} {vieweralsosee "" "--"}{...} {vieweralsosee "gigs: Conversion functions" "help ig_nbs"}{...} {vieweralsosee "gigs: Classification functions" "help classify_sga"}{...} @@ -48,7 +48,6 @@ {pstd}London, U.K.{p_end} {pstd}eric.ohuma@lshtm.ac.uk{p_end} - {title:Also see} {p 4 14 2}Conversion functions: {help ig_nbs:documentation} diff --git a/gigs_ipolate_coeffs.ado b/gigs_ipolate_coeffs.ado index dd7d2cd..b57f762 100644 --- a/gigs_ipolate_coeffs.ado +++ b/gigs_ipolate_coeffs.ado @@ -1,4 +1,4 @@ -*! version 0.3.0 (SJxx-x: dmxxxx) +*! version 0.3.1 (SJxx-x: dmxxxx) version 16 mata: mata set matastrict on diff --git a/ig_nbs.sthlp b/ig_nbs.sthlp index 4bfb13a..32ccd96 100644 --- a/ig_nbs.sthlp +++ b/ig_nbs.sthlp @@ -1,5 +1,5 @@ {smcl} -{* *! version 0.3.0 14 Nov 2023}{...} +{* *! version 0.3.1 22 Nov 2023}{...} {vieweralsosee "" "--"}{...} {vieweralsosee "gigs: Classification functions" "help classify_sga"}{...} {viewerjumpto "Syntax" "ig_nbs##syntax"}{...} @@ -146,7 +146,6 @@ also {it:fcn} dependent. the acronym argument (see {help ig_nbs##tab1:Table 1}) will return a missing value. - {marker standards}{...} {title:Available Standards} @@ -200,7 +199,10 @@ also {it:fcn} dependent. {pstd}These functions will return missing values where values are outside the ranges given above, but otherwise will not automatically detect data errors. Ensure you check your data before using these functions or you may - receive incorrect results. + receive incorrect results. Additionally, when providing centiles to the + function with {cmd: "c2v"}, ensure your inputs are between 0 and 1, or the + function will return missing values (e.g. for 25th centile, use 0.25; for 95th + centile, use 0.95). {marker examples}{...} {title:Examples} diff --git a/make.do b/make.do index 7303387..e77c9ca 100644 --- a/make.do +++ b/make.do @@ -3,7 +3,7 @@ // DO NOT FORGET to update the version of the package, if changed! // for more information visit http://github.com/haghish/github -make gigs, replace toc pkg version(0.3.0) /// +make gigs, replace toc pkg version(0.3.1) /// license("GNU General Public License v3.0") /// author("S. R. Parker") /// affiliation("London School of Hygiene and Tropical Medicine") /// diff --git a/prep_gigs-stata.do b/prep_gigs-stata.do index c357c32..23bd7df 100644 --- a/prep_gigs-stata.do +++ b/prep_gigs-stata.do @@ -1,6 +1,6 @@ // Moves and zips files into a shareable zipped version of the package. This // is necessary whilst we wait to make the code fully open-source. -local version = "0.3.0" +local version = "0.3.1" local zipfolder = "stata-gigs_`version'" cap rmdir `zipfolder' mkdir `zipfolder' diff --git a/stata.toc b/stata.toc index cc97e82..2978670 100644 --- a/stata.toc +++ b/stata.toc @@ -1,4 +1,4 @@ -v 0.3.0 +v 0.3.1 d Materials by S. R. Parker d London School of Hygiene and Tropical Medicine d simon.parker@lshtm.ac.uk diff --git a/test-gigs.do b/test-gigs.do index 5746c54..707eef0 100644 --- a/test-gigs.do +++ b/test-gigs.do @@ -14,7 +14,7 @@ foreach file in "_gclassify_sga.ado" "_gclassify_svn.ado" /// // Install rsource (R from Stata) if not already installed // cap ssc install rsource, replace -// 1. Generate .dta files with standards using "z2v/c2v" conversions +// 1. Generate .dta files with standards using "z2v/c2v" conversions local outputs "tests/outputs" cap mkdir "`outputs'" foreach standard in "who_gs" "ig_nbs" "ig_png" "interpolation" { @@ -23,7 +23,7 @@ foreach standard in "who_gs" "ig_nbs" "ig_png" "interpolation" { run "tests/test-`standard'.do" } -// 2. Compare to standards in gigs R package +// 2. Compare to standards in gigs R package local test_rscript "tests/test_stata_outputs.R" if "`c(os)'"=="MacOSX" | "`c(os)'"=="UNIX" { noi rsource using "`test_rscript'", /// @@ -33,7 +33,7 @@ if "`c(os)'"=="MacOSX" | "`c(os)'"=="UNIX" { } else if "`c(os)'"=="Windows" { // Windows - local rversion "4.3.1" // Set to version on own system + local rversion "4.3.2" // Set to version on own system noi rsource using "`test_rscript'", /// noloutput /// rpath("C:\Program Files\R\R-`rversion'\bin\x64\Rterm.exe") /// @@ -41,4 +41,4 @@ else if "`c(os)'"=="Windows" { } // 3. Test classification functions -do "tests/test-classification.do" \ No newline at end of file +run "tests/test-classification.do" \ No newline at end of file diff --git a/tests/inputs/tester_sga.dta b/tests/inputs/tester_sga.dta index 7ba52e6..76e7577 100644 Binary files a/tests/inputs/tester_sga.dta and b/tests/inputs/tester_sga.dta differ diff --git a/tests/inputs/tester_stunting.dta b/tests/inputs/tester_stunting.dta index 6cf03bd..dc81eb9 100644 Binary files a/tests/inputs/tester_stunting.dta and b/tests/inputs/tester_stunting.dta differ diff --git a/tests/inputs/tester_svn.dta b/tests/inputs/tester_svn.dta index bc0ef88..d373464 100644 Binary files a/tests/inputs/tester_svn.dta and b/tests/inputs/tester_svn.dta differ diff --git a/tests/inputs/tester_wasting.dta b/tests/inputs/tester_wasting.dta index 283ab93..e4fb734 100644 Binary files a/tests/inputs/tester_wasting.dta and b/tests/inputs/tester_wasting.dta differ diff --git a/tests/test-classification.do b/tests/test-classification.do index 9059323..018a5fa 100644 --- a/tests/test-classification.do +++ b/tests/test-classification.do @@ -88,4 +88,4 @@ foreach classification in "SGA" "SVN" "Stunting" "Wasting" "WFA" { else { noi di as text "{bf: `classification' passed.}" } -} \ No newline at end of file +} diff --git a/tests/test_stata_outputs.R b/tests/test_stata_outputs.R index 94fe64a..a568b15 100644 --- a/tests/test_stata_outputs.R +++ b/tests/test_stata_outputs.R @@ -211,7 +211,7 @@ interpolation <- mapply(FUN = compare_interpolation, standards, acronyms, sexes) if (!interactive()) Sys.sleep(wait_time_secs) cli::cli_h1(text = "Overall") -overall <- c(ig_nbs, ig_png, who_gs, interpolation) +overall <- unlist(c(ig_nbs, ig_png, who_gs, interpolation)) if (all(overall)) { cli::cli_alert_success(text = "All tests passed!") } else { @@ -220,5 +220,3 @@ if (all(overall)) { num_failed <- num_overall - num_passed cli::cli_alert_danger(text = "{num_failed} of {num_overall} test{?s} failed.") } - -if (!interactive()) Sys.sleep(time = 20) \ No newline at end of file