ranova longitudinal data with just one group

6 views (last 30 days)
I am trying to use ranova (longitudinal data case) to analyze the effect of time on a measured variable. However, I have not found any explanation on how to call the function 'fitrm' it in the most simple case, when one has just one group. I explain the case.
Take as example the longitudinal example given at the 'ranova' documentation. One first loads the sample data:
load(fullfile(matlabroot,'examples','stats','longitudinalData.mat'));
Where the matrix Y contains response data for 16 individuals. The response is the blood level of a drug measured at five time points (time = 0, 2, 4, 6, and 8). Each row of Y corresponds to an individual, and each column corresponds to a time point. The first eight subjects are female, and the second eight subjects are male.
After defining the variable Gender and storing the data in a proper table format one can now call 'fitrm' as follows
rm = fitrm(t,'t0-t8 ~ Gender','WithinDesign',Time)
My question is, how would you call 'fitrm' if you do not have the Gender predictor variable, since I only have one group? Imagine my data contains just the blood level of the drug measured at five time points, without the Gender:
t = table(Y(:,1),Y(:,2),Y(:,3),Y(:,4),Y(:,5),...
'VariableNames',{'t0','t2','t4','t6','t8'});
I have tried variations of:
rm = fitrm(t,'t0-t8','WithinDesign',Time)
rm = fitrm(t,'WithinDesign',Time)
with no much success. Seems such an easy case, but I could not find the documentation anyway. Many thanks in advance for the help

Answers (1)

Saray Soldado Magraner
Saray Soldado Magraner on 24 Feb 2018
Ok I figured it out, simply :)
rm = fitrm(t,'t0-t8 ~1','WithinDesign',Time)

Tags

Community Treasure Hunt

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

Start Hunting!