Define a Linear Mixed-Effects Model with fitlme for a random effects model with a one fixed effect and one random intercept
I am trying to determine how to define the formula for the "fitlme" function, which will then be passed into the "randomEffects" function. I have read through the documentation for the "fitlme" function and the documentation on the webpage "Prepare Data for Linear Mixed-Effects Models." However, I am still unsure how to proceed.
Background:
Our laboratory performed volumetric optical imaging on 15 brain tissue samples (five samples were from disease A, five were from disease B, and five were from healthy controls). For each tissue sample, we virtually divided the volumetric optical images into uniform cubic sub samples. For each sub-sample, we calculated a single value for a particular vascular metric. This resulted in a vector of continuous values for each tissue sample.
Goal:
Now, I want to compare the vascular metrics between each disease group and the control group (i.e. disease A vs. control and disease B vs. control). My goal is to determine whether the vascular metric changes signficantly between the disease groups and the control group. I contacted a statistician, who recommended using a random effects model. They recommended defining the following:
response = array of values for the vascular metric
fixed effect = group (disease A, disease B, or control)
random effect = subject identifier
I am now trying to determine how to implement this in Matlab via the "fitlme" function.
Using the "fitlme" function:
Defining the table:
I created two separate tables, one for comparing disease A vs. the control group and a second for comparing disease B vs. the control group. The first column of the tables represents the group identifier (disease_A, disease_B, or control). The second column is the subject identifier (1-15). The third column is a concatenated vector of all of the subsamples across all of the subjects in the respective groups.
Defining the formula:
I am unsure how to define the formula that defines the linear mixed effects model. I would like to set the vector of subsamples as the response variable (y), the vector of groups as the fixed effect, and the subject identifier as the random effect. From reading the documentatoin, I believe this would correspond to the following:
fml = ‘subsamples ~ subID + (subID|groups)’;
I implemented this and then ran the following code to obtain the estimates of random effects and related statistics:
lme = fitlme(tbl,fml);
[B, Bnames, stats] = randomEffects(lme);
The code ran successfully, and now I am trying to determine whether I correctly initialized the formula. The contents of the "stats" struct for comparing one of the disease groups to control are shown below. The group labels are "AD" and "HC". The value ‘subID’ refers to the subject ID.
Questions:
Am I correctly defining the formula (fml) for fitting the LME model? I am also open to using the "fitlmematrix" if that is more straightforward. I also attempted to use "fitlmematrix," but I got even more confused on how to define the respective matrices, so I figured I would not include details in this post.
If the p-value (from the "stats" object) is less than my alpha, does this signify that the random effect (subject) does not significantly affect the response (vascular metrics)?
How do I test whether the fixed effect (group) has a significant affect on the response? Would this require defining a different formula for the fitlme function?I am trying to determine how to define the formula for the "fitlme" function, which will then be passed into the "randomEffects" function. I have read through the documentation for the "fitlme" function and the documentation on the webpage "Prepare Data for Linear Mixed-Effects Models." However, I am still unsure how to proceed.
Background:
Our laboratory performed volumetric optical imaging on 15 brain tissue samples (five samples were from disease A, five were from disease B, and five were from healthy controls). For each tissue sample, we virtually divided the volumetric optical images into uniform cubic sub samples. For each sub-sample, we calculated a single value for a particular vascular metric. This resulted in a vector of continuous values for each tissue sample.
Goal:
Now, I want to compare the vascular metrics between each disease group and the control group (i.e. disease A vs. control and disease B vs. control). My goal is to determine whether the vascular metric changes signficantly between the disease groups and the control group. I contacted a statistician, who recommended using a random effects model. They recommended defining the following:
response = array of values for the vascular metric
fixed effect = group (disease A, disease B, or control)
random effect = subject identifier
I am now trying to determine how to implement this in Matlab via the "fitlme" function.
Using the "fitlme" function:
Defining the table:
I created two separate tables, one for comparing disease A vs. the control group and a second for comparing disease B vs. the control group. The first column of the tables represents the group identifier (disease_A, disease_B, or control). The second column is the subject identifier (1-15). The third column is a concatenated vector of all of the subsamples across all of the subjects in the respective groups.
Defining the formula:
I am unsure how to define the formula that defines the linear mixed effects model. I would like to set the vector of subsamples as the response variable (y), the vector of groups as the fixed effect, and the subject identifier as the random effect. From reading the documentatoin, I believe this would correspond to the following:
fml = ‘subsamples ~ subID + (subID|groups)’;
I implemented this and then ran the following code to obtain the estimates of random effects and related statistics:
lme = fitlme(tbl,fml);
[B, Bnames, stats] = randomEffects(lme);
The code ran successfully, and now I am trying to determine whether I correctly initialized the formula. The contents of the "stats" struct for comparing one of the disease groups to control are shown below. The group labels are "AD" and "HC". The value ‘subID’ refers to the subject ID.
Questions:
Am I correctly defining the formula (fml) for fitting the LME model? I am also open to using the "fitlmematrix" if that is more straightforward. I also attempted to use "fitlmematrix," but I got even more confused on how to define the respective matrices, so I figured I would not include details in this post.
If the p-value (from the "stats" object) is less than my alpha, does this signify that the random effect (subject) does not significantly affect the response (vascular metrics)?
How do I test whether the fixed effect (group) has a significant affect on the response? Would this require defining a different formula for the fitlme function? I am trying to determine how to define the formula for the "fitlme" function, which will then be passed into the "randomEffects" function. I have read through the documentation for the "fitlme" function and the documentation on the webpage "Prepare Data for Linear Mixed-Effects Models." However, I am still unsure how to proceed.
Background:
Our laboratory performed volumetric optical imaging on 15 brain tissue samples (five samples were from disease A, five were from disease B, and five were from healthy controls). For each tissue sample, we virtually divided the volumetric optical images into uniform cubic sub samples. For each sub-sample, we calculated a single value for a particular vascular metric. This resulted in a vector of continuous values for each tissue sample.
Goal:
Now, I want to compare the vascular metrics between each disease group and the control group (i.e. disease A vs. control and disease B vs. control). My goal is to determine whether the vascular metric changes signficantly between the disease groups and the control group. I contacted a statistician, who recommended using a random effects model. They recommended defining the following:
response = array of values for the vascular metric
fixed effect = group (disease A, disease B, or control)
random effect = subject identifier
I am now trying to determine how to implement this in Matlab via the "fitlme" function.
Using the "fitlme" function:
Defining the table:
I created two separate tables, one for comparing disease A vs. the control group and a second for comparing disease B vs. the control group. The first column of the tables represents the group identifier (disease_A, disease_B, or control). The second column is the subject identifier (1-15). The third column is a concatenated vector of all of the subsamples across all of the subjects in the respective groups.
Defining the formula:
I am unsure how to define the formula that defines the linear mixed effects model. I would like to set the vector of subsamples as the response variable (y), the vector of groups as the fixed effect, and the subject identifier as the random effect. From reading the documentatoin, I believe this would correspond to the following:
fml = ‘subsamples ~ subID + (subID|groups)’;
I implemented this and then ran the following code to obtain the estimates of random effects and related statistics:
lme = fitlme(tbl,fml);
[B, Bnames, stats] = randomEffects(lme);
The code ran successfully, and now I am trying to determine whether I correctly initialized the formula. The contents of the "stats" struct for comparing one of the disease groups to control are shown below. The group labels are "AD" and "HC". The value ‘subID’ refers to the subject ID.
Questions:
Am I correctly defining the formula (fml) for fitting the LME model? I am also open to using the "fitlmematrix" if that is more straightforward. I also attempted to use "fitlmematrix," but I got even more confused on how to define the respective matrices, so I figured I would not include details in this post.
If the p-value (from the "stats" object) is less than my alpha, does this signify that the random effect (subject) does not significantly affect the response (vascular metrics)?
How do I test whether the fixed effect (group) has a significant affect on the response? Would this require defining a different formula for the fitlme function? fitlme, fitlmematrix, randomeffects MATLAB Answers — New Questions