Categorical Covariates

Hi,

Can you help me understand the syntax on how to set up categorical covariates as part of the model? For example, I am looking for conditional statements:

IF(GENDER=MALE) xxx
IF(GENDER=FEMALE) xxx etc

Thanks,
Pavan.

Hi Pavan,

You would want to modify this according to your use but here are a few examples:

In the @pre block in case the covariate coefficient on the population value has an additive effect. You can also parameterize that as having a proportional effect by replacing the additions by a multiplication where needed.

beta0 = tvbeta0 + (GENDER=="MALE") * maleparam + (GENDER=="FEMALE") * femaleparam

OR

beta0 = tvbeta0 
if GENDER=="MALE" 
  beta0 += maleparam 
else
  beta0 += femaleparam
end

OR

if GENDER=="MALE"
  beta0 += maleparam 
elseif GENDER=="FEMALE"
  beta0 += femaleparam
end

OR

beta0 = tvbeta0 + GENDER == "MALE" ? maleparam : femaleparam
2 Likes

Thanks Vaibhav. This is very helpful!

Pavan.