Using strcat within the fitrm function

Hi All. Just wondering why I cannot use strcat function to create the second inout for the fitrm function.
CoV = {'Patient','Gender','Dg'};
CoV2B = 3;
Var2BanalysedA = {'Perc_Aff_t0'}; % Assessment at time 1
Var2BanalysedB = {'Perc_Aff_t1'}; % Assessment at time 2
Var2BanalysedC = {'Perc_Aff_t2'}; % Assessment at time 3
t = [Table_RMA(:,CoV2B),Table_RMA(:,Var2Banalysed), Table_RMA(:,Var2Banalysed+30),Table_RMA(:,Var2Banalysed+60)];
model = strcat(VN(Var2BanalysedA),'-',VN(Var2BanalysedC),'~',CoV(CoV2B));
M = dataset([1 2 3]','VarNames',{'Measurements'});
rm = fitrm(t,'Perc_Aff_t0-Perc_Aff_t2~Dg','WithinDesign',M);
I want to replace 'Perc_Aff_t0-Perc_Aff_t2~Dg' with 'model', Is that possible?

4 commentaires

KSSV
KSSV le 3 Sep 2018
What error you are getting?
Error using classreg.regr.FormulaProcessor (line 421)
The model specification must be a terms matrix, a model alias, or a model formula character vector.
Error in classreg.regr.MultivariateLinearFormula (line 46) f = f@classreg.regr.FormulaProcessor(varargin{:});
Error in RepeatedMeasuresModel.fit (line 1298) formula = classreg.regr.MultivariateLinearFormula(model,varNames);
Error in fitrm (line 67) s = RepeatedMeasuresModel.fit(ds,model,varargin{:});
Same error if I use
rm = fitrm(t,strcat(VN(Var2BanalysedA),'-',VN(Var2BanalysedC),'~',CoV(CoV2B)),'WithinDesign',M);
Walter Roberson
Walter Roberson le 4 Sep 2018
What is your function VN?

Connectez-vous pour commenter.

Réponses (1)

0 votes

Hi All, found the solution :). Perhaps the prob was my ignorance in using strings. rm = fitrm(t,modek{1},'WithinDesign',M); cheers
Eduardo

Catégories

En savoir plus sur Simulink dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by