Prev: Problem with angles of revolutional joints of a robot in simmechanics
Next: quick plot daily trend line from hourly database without reshape function?
From: Daniel on 1 Feb 2010 13:54 In my message above, the subject numbers should have been fully crossed with the different conditions. In the example below, there are two subjects in each condition (numbers 11, 12, 21, and 22) who underwent all levels of treatments A and B. The columns are Condition, Treatment A, Treatment B, and Subject: variables = [1 1 1 11 1 1 1 12 1 1 2 11 1 1 2 12 1 2 1 11 1 2 1 12 1 2 2 11 1 2 2 12 2 1 1 21 2 1 1 22 2 1 2 21 2 1 2 22 2 2 1 21 2 2 1 22 2 2 2 21 2 2 2 22] If you now run the following, you'll get the appropriate ANOVA table: anovan(y, [group subjects], 'random', 4,... 'nested', [0 0 0 0; 0 0 0 0; 0 0 0 0; 1 0 0 0],... 'varnames', {'Condition', 'A', 'B', 'Subject'}, 'model' ,'full') The problem with the first example was that each subject only completed one level of each treatment so it wasn't a repeated measures design. To make that work you have to increase the size of the design matrix and repeat the subject factor at each combination of treatments, e.g., 'hi' + 'may', 'lo' + 'may', 'hi' + 'june', and 'lo' + 'june'. Dan
From: StatLearner on 18 Feb 2010 16:26
On Feb 1, 1:54 pm, "Daniel" <danielDOTrDOTlit...(a)gmail.com> wrote: > In my message above, the subject numbers should have been fully crossed with the different conditions. In the example below, there are two subjects in each condition (numbers 11, 12, 21, and 22) who underwent all levels of treatments A and B. The columns are Condition, Treatment A, Treatment B, and Subject: > > variables = [1 1 1 11 > 1 1 1 12 > 1 1 2 11 > 1 1 2 12 > 1 2 1 11 > 1 2 1 12 > 1 2 2 11 > 1 2 2 12 > 2 1 1 21 > 2 1 1 22 > 2 1 2 21 > 2 1 2 22 > 2 2 1 21 > 2 2 1 22 > 2 2 2 21 > 2 2 2 22] > > If you now run the following, you'll get the appropriate ANOVA table: > anovan(y, [group subjects], 'random', 4,... > 'nested', [0 0 0 0; 0 0 0 0; 0 0 0 0; 1 0 0 0],... > 'varnames', {'Condition', 'A', 'B', 'Subject'}, 'model' ,'full') > > The problem with the first example was that each subject only completed one level of each treatment so it wasn't a repeated measures design. To make that work you have to increase the size of the design matrix and repeat the subject factor at each combination of treatments, e.g., 'hi' + 'may', 'lo' + 'may', 'hi' + 'june', and 'lo' + 'june'. > > Dan Hi Dan, You are of great help. Thank you so much. But, this is still a bit complicated for me to understand how you did this (specially matrix manipulation) Yes, I am exactly looking for what you are explaining here, but it is kind of difficult for me to understand it. I am trying to do repeated measure anova using "anovan". Here is what my data looks like. I have 2 groups Group 1 (control group) There are 15 subjects. There are 5 recording for each subject over time. Group 2 (treatment group) There are 13 subjects (different subjects) There are 5 recording for each subject over time. So, I want to find the effect of treatment(if there is any), effect of time(if there is any) and combined effect of treatment over time(interaction, if there is any). Can you please explain me the matrix arrangement for my querry. I will highly appreciate it. I have a solved example from a textbook and I want to try the same problem using "code" to make sure if the code will really work. Also, can you suggest me some good books on Advanced statistical analysis and methods, which explains everything in detail. I will really appreciate any help . Thanks. |