Categorical covariates in parameter estimation

3 views (last 30 days)
Hello,
Do the SimBIology parameter estimation functions support categorical covariates?
Thank you,
Abed
  2 Comments
Joe Myint
Joe Myint on 4 Nov 2023
Edited: Joe Myint on 4 Nov 2023
Hello Abed,
Take a look at this example and see if it is what you are looking for. This example shows how to estimate category-specific (such as young versus old, male versus female) parameters using PK profile data from multiple individuals.
Hope it helps, Joe
Abed Alnaif
Abed Alnaif on 9 Nov 2023
Thank you, Joe! I wasn't aware of this feature, and I think it will work for me. I'm going to try it.

Sign in to comment.

Accepted Answer

Arthur Goldsipe
Arthur Goldsipe on 6 Nov 2023
Do you want to do nonlinear regression or nonlinear mixed effects (NLME)? The feature Joe mentions in his comment only applies to nonlinear regression. If you want to use categorical covariates with sbiofitmixed (for NLME), then there's no direct support for categorical covariates. I have an idea for a workaround, but I'd need to think about it a little more. If you are interested in the workaround, please let me know and I can investigate it a bit further. It would also be helpful to know more about your covariate model. How many categories are in your categorical covariate? What does your covariate model look like?
  3 Comments
Jeremy Huard
Jeremy Huard on 23 Nov 2023
Edited: Jeremy Huard on 23 Nov 2023
I would recommend to convert categorical covariates into dummy variables or one-hot vectors, where each category is converted into a new binary column.
However, I would only use categories and all zeros would encode for the last category.
Please note that I will be using a dataset shipped with MATLAB that does not contain time courses. But the categorical variable it contains will help illlustrate the general idea.
load patients
T = table(Age,Height,Weight,Smoker,...
SelfAssessedHealthStatus,Location,...
'RowNames',LastName);
T = convertvars(T,@iscellstr,"string")
T = 100×6 table
Age Height Weight Smoker SelfAssessedHealthStatus Location ___ ______ ______ ______ ________________________ ___________________________ Smith 38 71 176 true "Excellent" "County General Hospital" Johnson 43 69 163 false "Fair" "VA Hospital" Williams 38 64 131 false "Good" "St. Mary's Medical Center" Jones 40 67 133 false "Fair" "VA Hospital" Brown 49 64 119 false "Good" "County General Hospital" Davis 46 68 142 false "Good" "St. Mary's Medical Center" Miller 33 64 142 true "Good" "VA Hospital" Wilson 40 68 180 false "Good" "VA Hospital" Moore 28 68 183 false "Excellent" "St. Mary's Medical Center" Taylor 31 66 132 false "Excellent" "County General Hospital" Anderson 45 68 128 false "Excellent" "County General Hospital" Thomas 42 66 137 false "Poor" "St. Mary's Medical Center" Jackson 25 71 174 false "Poor" "VA Hospital" White 39 72 202 true "Excellent" "VA Hospital" Harris 36 65 129 false "Good" "St. Mary's Medical Center" Martin 48 71 181 true "Good" "VA Hospital"
In the table above, the variable SelfAssessedHealthStatus contains 4 categories: Poor, Fair, Good, Excellent.
You can generate dummy variables for it with:
Tstatus = convertvars(T(:,"SelfAssessedHealthStatus"), "SelfAssessedHealthStatus","categorical");
Tstatus = onehotencode(Tstatus);
T = [Tstatus, T]
T = 100×10 table
Excellent Fair Good Poor Age Height Weight Smoker SelfAssessedHealthStatus Location _________ ____ ____ ____ ___ ______ ______ ______ ________________________ ___________________________ Smith 1 0 0 0 38 71 176 true "Excellent" "County General Hospital" Johnson 0 1 0 0 43 69 163 false "Fair" "VA Hospital" Williams 0 0 1 0 38 64 131 false "Good" "St. Mary's Medical Center" Jones 0 1 0 0 40 67 133 false "Fair" "VA Hospital" Brown 0 0 1 0 49 64 119 false "Good" "County General Hospital" Davis 0 0 1 0 46 68 142 false "Good" "St. Mary's Medical Center" Miller 0 0 1 0 33 64 142 true "Good" "VA Hospital" Wilson 0 0 1 0 40 68 180 false "Good" "VA Hospital" Moore 1 0 0 0 28 68 183 false "Excellent" "St. Mary's Medical Center" Taylor 1 0 0 0 31 66 132 false "Excellent" "County General Hospital" Anderson 1 0 0 0 45 68 128 false "Excellent" "County General Hospital" Thomas 0 0 0 1 42 66 137 false "Poor" "St. Mary's Medical Center" Jackson 0 0 0 1 25 71 174 false "Poor" "VA Hospital" White 1 0 0 0 39 72 202 true "Excellent" "VA Hospital" Harris 0 0 1 0 36 65 129 false "Good" "St. Mary's Medical Center" Martin 0 0 1 0 48 71 181 true "Good" "VA Hospital"
Now, we can use Poor as the reference group, meaning that when all other groups are 0, then the category is Poor:
T.Poor(:) = 0
T = 100×10 table
Excellent Fair Good Poor Age Height Weight Smoker SelfAssessedHealthStatus Location _________ ____ ____ ____ ___ ______ ______ ______ ________________________ ___________________________ Smith 1 0 0 0 38 71 176 true "Excellent" "County General Hospital" Johnson 0 1 0 0 43 69 163 false "Fair" "VA Hospital" Williams 0 0 1 0 38 64 131 false "Good" "St. Mary's Medical Center" Jones 0 1 0 0 40 67 133 false "Fair" "VA Hospital" Brown 0 0 1 0 49 64 119 false "Good" "County General Hospital" Davis 0 0 1 0 46 68 142 false "Good" "St. Mary's Medical Center" Miller 0 0 1 0 33 64 142 true "Good" "VA Hospital" Wilson 0 0 1 0 40 68 180 false "Good" "VA Hospital" Moore 1 0 0 0 28 68 183 false "Excellent" "St. Mary's Medical Center" Taylor 1 0 0 0 31 66 132 false "Excellent" "County General Hospital" Anderson 1 0 0 0 45 68 128 false "Excellent" "County General Hospital" Thomas 0 0 0 0 42 66 137 false "Poor" "St. Mary's Medical Center" Jackson 0 0 0 0 25 71 174 false "Poor" "VA Hospital" White 1 0 0 0 39 72 202 true "Excellent" "VA Hospital" Harris 0 0 1 0 36 65 129 false "Good" "St. Mary's Medical Center" Martin 0 0 1 0 48 71 181 true "Good" "VA Hospital"
During fitting, we can now use a covariate model such as:
Here, (the population estimate) will correspond to the case where SelfAssessedHealthStatus = Poor, will correspond to SelfAssessedHealthStatus = Fair, will correspond to SelfAssessedHealthStatus = Good, will correspond to SelfAssessedHealthStatus = Excellent.
I hope this helps.
Best regards,
Jérémy

Sign in to comment.

More Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 3 Nov 2023

Communities

More Answers in the  SimBiology Community

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!