Error in displaying linear mixed effect model created with fitlme

3 views (last 30 days)
I am currently attempting to fit a linear mixed-effect model to my data, which consists of three predictor variables (sample, disease, intensity) and one response variable (response).
Previously I used two-way repeated measures ANOVAs to analyze this data, as my study design records responses from the same sample at multiple intensities. However, in this case the number of missing datapoints makes this impossible.
I have placed my data into a table called 'dataTable' after converting my predictor variables to categorical arrays and keeping my response variable in double format. All rows within my response array for which no response was recorded contains a 'NaN' value. Example:
Following the example of others, i generate a linear mixed model using the following code:
lme = fitlme(dataTable,'response ~ disease + intensity + (1|sample)');
This code successfully generates an lme object. However, attempting to display this object using display(lme), outputs the following to the command window:
lme =
Linear mixed-effects model fit by ML
Model information:
Number of observations 174
Fixed effects coefficients 10
Random effects coefficients 23
Covariance parameters 2
Formula:
sumPlats ~ 1 + disease + intensity + (1 | sample)
Model fit statistics:
AIC BIC LogLikelihood Deviance
1555.4 1593.3 -765.72 1531.4
Fixed effects coefficients (95% CIs):
Error using tcdf
Too many input arguments.
Error in classreg.regr.lmeutils.StandardLinearLikeMixedModel/fixedEffects (line 880)
P = 2*(tcdf(abs(T),DF,'upper'));
Error in classreg.regr.LinearLikeMixedModel/fixedEffects (line 2768)
fetable = fixedEffects(model.slme,alpha,dfmethod);
Error in LinearMixedModel/fixedEffects (line 2628)
[beta,betanames,fetable] =
fixedEffects@classreg.regr.LinearLikeMixedModel(model,varargin{:});
Error in LinearMixedModel/tstats (line 919)
[~,~,table] = fixedEffects(model);
Error in classreg.regr.CompactParametricRegression/get.Coefficients (line 240)
tbl = tstats(model);
Error in LinearMixedModel/displayFixedStats (line 1053)
ds = model.Coefficients;
Error in LinearMixedModel/disp (line 219)
displayFixedStats(model)
I'm not sure how to fix this problem. I've attempted this analysis by changing my predictor variables to nominal values, or keeping my intensity predictor variable in double format, with little success. Any help would be greatly appreciated.
  3 Comments
Michael Flood
Michael Flood on 24 Jul 2020
Hi Paul! I start off by importing my data from excel as individual column arrays of dimensions 207x1. 'sample', 'intensity' and 'response' are filled with double values, while 'disease' is already a categorical array after importing. I use the following code to generate my table.
>> sample = categorical(sample);
>> intensity = categorical(intensity);
>> dataTable = table(sample,disease,intensity,response);
I have also attempted the same without changing 'intensity' from a double to categorical array:
sample = categorical(sample);
dataTable = table(sample,disease,intensity,response);
But get similar results. Additionally, I have also attempted this process after removing all rows with 'NaN' values, but again get the same result (I believe fitlme excludes NaN-containing rows automatically). Hope this helps...
Michael Flood
Michael Flood on 25 Jul 2020
~update~ I had a buddy with a more recent version of Matlab run the same command on my data and it worked fine. I'm not sure why my version isn't working (MATLAB Version: 9.4.0.813654 (R2018a)), but I don't think it's worth the time trying to figure out why.
Thanks for your assistance Paul!
~Michael

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!