Hi,
I am learning how to use linear mixed effect model to test two set of datas.
Suppose I have my table like this, where data1 and data2 are what I want to compare and see if they are different. 'sampleID' records from which object the data is collected.
'data1' 'data2' 'SampleID'
0.516889740895640 0.495026736720585 '3'
0.568247158919234 0.553939998754281 '3'
0.384527694682852 0.639242823546553 '2'
0.243338708824316 0.477584777544589 '2'
0.388269268112705 0.772324689922884 '1'
0.346430703280194 0.752582761153593 '1'
0.563529866967876 0.847575046711875 '1'
I believe sampleID will have random effects on both data1 and data2, therefore I am considering using mixed effect model instead of t test to run statistical checks.
To the best of my understanding, I wrote the follow code. However, I don't know how can I get the p value which I can get from a normal t test. Can anyone let me know how to interpret the results?
lme = fitlme(tb,'data1~data2+(data2|SampleID)+(data1|SampleID)')
The output is:
lme =
Linear mixed-effects model fit by ML
Model information:
Number of observations 7
Fixed effects coefficients 2
Random effects coefficients 12
Covariance parameters 7
Formula:
data1 ~ 1 + data2 + (1 + data2 | SampleID) + (1 + data1 | SampleID)
Model fit statistics:
AIC BIC LogLikelihood Deviance
-111.09 -111.58 64.546 -129.09
Fixed effects coefficients (95
Name Estimate SE tStat DF pValue Lower Upper
{'(Intercept)'} 0.53456 1.1255e-07 4.7494e+06 5 7.8541e-33 0.53456 0.53456
{'data2' } -2.6199e-14 1.6541e-07 -1.5839e-07 5 1 -4.2519e-07 4.2519e-07
Random effects covariance parameters (95
Group: Eye (3 Levels)
Name1 Name2 Type Estimate Lower Upper
{'(Intercept)'} {'(Intercept)'} {'std' } 3.8333e-15 NaN NaN
{'data2' } {'(Intercept)'} {'corr'} -0.98044 NaN NaN
{'data2' } {'data2' } {'std' } 5.7463e-15 NaN NaN
Group: Eye (3 Levels)
Name1 Name2 Type Estimate Lower Upper
{'(Intercept)'} {'(Intercept)'} {'std' } 0.34995 NaN NaN
{'data1' } {'(Intercept)'} {'corr'} -1 NaN NaN
{'data1' } {'data1' } {'std' } 0.65465 NaN NaN
Group: Error
Name Estimate Lower Upper
{'Res Std'} 4.8154e-08 NaN NaN
Then I checked the tutorial, there is a case which is very similar to what I want:
Test if there is any difference between the evening and morning shifts.
pVal = coefTest(lme,[0 1 -1])
pVal = 3.6147e-04
This small p-value indicates that the performance of the operators are not the same in the morning and the evening shifts.
However, I am having difficulty understanding what is [0 1 -1] means.
Can anybody help? Thank you.