Predict response given new input data | GLME

2 ビュー (過去 30 日間)
Joel
Joel 2018 年 10 月 11 日
コメント済み: Joel 2018 年 10 月 11 日
I am trying to fit a model between a dependent variable (Y) and two predictor variables (X, Z) using GLME.
First I divided the data into training (80%) and validation (20%). I've fitted a GLME model to the training data:
X = Xtr % Validation portion of data (442x1);
Z = Ztr % Validation portion of data (442x1);
Y = Ytr % Validation portion of data (442x1);
trTable = table(Y,X,Z);
mdl_glme = fitglme(trTable,'Y ~ X + (1 | Z) + (-1 + X | Z)')'
Now I want to test this model on new (validation) data. This is where I run into problems. If I try:
X = Xval % Validation portion of data (110x1);
Z = Zval % Validation portion of data (110x1);
Y = Yval % Validation portion of data (110x1);
valTable = table(Y,X,Z);
ypred = predict(mdl_glme,valTable)
I get the following error:
Error using categorical (line 434)
Unable to create default category names. Specify category names using the CATEGORYNAMES
input argument.
Error in nominal (line 152)
b = b@categorical(a,args{:},'Ordinal',false);
Error in classreg.regr.LinearLikeMixedModel/makeInteractionVar (line 806)
G = nominal(ds.(interactionVars{1}));
Error in classreg.regr.LinearLikeMixedModel/extractGroupingInfo (line 205)
model.makeInteractionVar(ds,interactionVars);
Error in GeneralizedLinearMixedModel/predict (line 539)
ginfo = extractGroupingInfo(model,ds);
Though if I inspect trTable and valTable the only difference I can see is the number of rows:
442×3 table (trTable)
Y X Z
_________ _________ ________
1.2107 1.2011 0.098847
110×3 table (valTable)
Y X Z
_________ _________ ______
1.6064 1.6024 1.6024
I would be very grateful for any feedback and/or advice.
Regards J
  2 件のコメント
the cyclist
the cyclist 2018 年 10 月 11 日
Can you upload your dataset, or a minimal subset that exhibits the problem?
(Sometimes trying to find the minimal subset that causes the problem will actually help identify the cause.)
Joel
Joel 2018 年 10 月 11 日
Thanks! I really appreciate it! I will upload it first thing tomorrow morning as I do not have access to it at the moment (home computer).
Regards J

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSupport Vector Machine Regression についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by