help > Help with design matrix
Showing 1-5 of 5 posts
Jul 19, 2013 06:07 PM | Chenyang Zhan
Help with design matrix
Dear Andrew,
May I ask a question about design matrix?
In my connectivity comparision, gender is a confounding factor that needs to be considered. So I wrote a design matrix with four columns, the first indicates patient group, the second for control group, and third and fourth for male and female respectively. Part of the matrix is as below:
0 1 1 0
0 1 0 1
0 1 1 0
0 1 0 1
0 1 1 0
0 1 0 1
1 0 0 1
I planned to use contrast [-1, 1, 0, 0] to rule out gender bias and detect decreased connectivty in patient group. Does this make sense?
After I click the run button, an error message showed up "Design matrix not found or inconsistent". If my design matrix only contains the first two column, it was running great with contrast [-1, 1] and gave me beautiful results. Would you please advise where my problems are??
Really appreciate your help!!
CY
May I ask a question about design matrix?
In my connectivity comparision, gender is a confounding factor that needs to be considered. So I wrote a design matrix with four columns, the first indicates patient group, the second for control group, and third and fourth for male and female respectively. Part of the matrix is as below:
0 1 1 0
0 1 0 1
0 1 1 0
0 1 0 1
0 1 1 0
0 1 0 1
1 0 0 1
I planned to use contrast [-1, 1, 0, 0] to rule out gender bias and detect decreased connectivty in patient group. Does this make sense?
After I click the run button, an error message showed up "Design matrix not found or inconsistent". If my design matrix only contains the first two column, it was running great with contrast [-1, 1] and gave me beautiful results. Would you please advise where my problems are??
Really appreciate your help!!
CY
Jul 20, 2013 12:07 PM | Andrew Zalesky
RE: Help with design matrix
Dear CY,
Simply delete the last column of your design matrix and use the contrast [-1, 1, 0]. So the design matrix would be:
0 1 1
0 1 0
0 1 1
0 1 0
0 1 1
0 1 0
1 0 0
This will control for the confound of gender. Note that this design assumes the effect of being male (or female) is the same in both the patient and control groups.
It is possible to use a design that allows for the effect of being male (or female) to differ between the patient and control groups; but given that you have a group with only sample, this is probably not a desirable design in your case.
Andrew
Simply delete the last column of your design matrix and use the contrast [-1, 1, 0]. So the design matrix would be:
0 1 1
0 1 0
0 1 1
0 1 0
0 1 1
0 1 0
1 0 0
This will control for the confound of gender. Note that this design assumes the effect of being male (or female) is the same in both the patient and control groups.
It is possible to use a design that allows for the effect of being male (or female) to differ between the patient and control groups; but given that you have a group with only sample, this is probably not a desirable design in your case.
Andrew
Jul 23, 2013 02:07 PM | Chenyang Zhan
RE: Help with design matrix
Thank you, Andew! It worked, and your advice is really helpful!!
Can I ask one more silly question? How should I calculate the p value for a selected T test threshold? I guess I need to know the degree of freedom. Is that the smaller one of (n1-1) or (n2-1), with n1 and n2 being the number of people in control and experiment groups?
Thanks again!
CY
Can I ask one more silly question? How should I calculate the p value for a selected T test threshold? I guess I need to know the degree of freedom. Is that the smaller one of (n1-1) or (n2-1), with n1 and n2 being the number of people in control and experiment groups?
Thanks again!
CY
Jul 23, 2013 11:07 PM | Andrew Zalesky
RE: Help with design matrix
Dear CY,
Reporting the corresponding p-value for your t-statistic threshold is not essential. But if you want to do it, the degrees of freedom should be n1+n2-1.You can get the one-tailed p-value by typing this at the Matlab prompt: 1-tcdf(Tvalue,n1+n2-1)
Andrew
Originally posted by Chenyang Zhan:
Reporting the corresponding p-value for your t-statistic threshold is not essential. But if you want to do it, the degrees of freedom should be n1+n2-1.You can get the one-tailed p-value by typing this at the Matlab prompt: 1-tcdf(Tvalue,n1+n2-1)
Andrew
Originally posted by Chenyang Zhan:
Thank you, Andew! It worked, and your advice is
really helpful!!
Can I ask one more silly question? How should I calculate the p value for a selected T test threshold? I guess I need to know the degree of freedom. Is that the smaller one of (n1-1) or (n2-1), with n1 and n2 being the number of people in control and experiment groups?
Thanks again!
CY
Can I ask one more silly question? How should I calculate the p value for a selected T test threshold? I guess I need to know the degree of freedom. Is that the smaller one of (n1-1) or (n2-1), with n1 and n2 being the number of people in control and experiment groups?
Thanks again!
CY