A modeller recently asked; [color=#8040FF]I’m having trouble with the SEX categorical covariate. I got it entered as categorical, but then it asks questions I don’t know how to answer. Should I be using codes of 0 and 1 for male and female? What is the category name and variable? Variables only seems to accept 0 or 1 and I’m not sure what should go in the category name. The covariate is named SEX when entries of “M” and “F.” What goes where?[/color] The contents of categorical variables have to be numeric (ex., 0, 1, 2, 3, …). In the Covar. Type tab, you enter something like Name Value M 1 F 0 for the purpose of labelling, but also to specify that the variable is to be treated as categorical. Note that it doesn’t matter what the values are, because each category of such covariates is like a 0/1 indicator variable. You can see in the Parameters Tab > Structure tab that there are logical expressions containing the “==” comparison operator when a categorical covariate is specified. (in your case - where you have M and F inside the SEX column in the dataset, they will need to change the M’s to 1’s and F’s to 0’s prior to being linked to the model. This can be done using a custom column transformation with the formula [color=#008080]if(SEX=“M”,1,0))[/color] Hope that helps, we’re drafting some revisions to the documentation on the Phoenix NLME Data Structures so hopefully you can find this information out more easily in future. Simon.
Hello Simon, Thank you for the very help explanation on the categorical covariates! I have a more specific code question regarding the logical expression you referred to: I would like to use genotyping data on the gene UGT1A1, for instance, as a covariate. I will have subjects in my dataset that are wild type coded as =0, heterozygous coded as =1 and homozygous for the defective gene coded as =2 and I will be using this command to code this covariate: stparm(CL20 = tvCL20 * exp(dCL20dUGT1A11*(UGT1A1==1)) * exp(dCL20dUGT1A12*(UGT1A1==2)) * exp(nCL20)) where CL20 is clearance. Now, my understanding is (and correct me if I am wrong) that for individuals with =0, the code will look like that: CL20 = tvCL20 * exp(nCL20) for individuals with =1, the code will look like that: CL20 = tvCL20 * exp(dCL20dUGT1A11*(UGT1A1==1)) * exp(nCL20) and for individuals with =2, the code will look like that: CL20 = tvCL20 * exp(dCL20dUGT1A11*(UGT1A1==2)) * exp(nCL20) Is this correct? Thank you in advance for your reply! Eleftheria