I’d like to create a new binary variable that is derived from a continuous one, conditional on a third (also continuous) variable. Specifically, I’d like to create a variable
sga that is derived from
sga is small for gestational age, so the conditional variable is
ga (gestational age of the subject).
I was initially trying with the “standard” datashield but then realised it was possible to install
dsBetaTest on the node so was able to look at using some of the new fuctions - specifically, I tried using
ds.make.o(). However, I still cannot figure it out.
The logic I am trying to implement is as follows:
generated expected (
bw50c) birth weight for the subject (of
ga = Xwhere
Xis a continuous variable from 22 to 40) using a formula based on the known median birth weight at 40 weeks gestation
sgaindicator variable as follows:
sga == 1 if birth_weight < (bw50c - 3*sd)
sga == 0 if birth_weight >= (bw50c - 3*sd)
sdis a known standard deviation.
Is anyone able to advise if this is possible using available (including beta) datashield functions and, if so, how I might solve this? I am sure I am probably just being a bit dumb and overlooking something…
Thanks in advance!