Error in nlmefit function vectorizeSinglePhiGroupX
显示 更早的评论
Hi, I am trying to use nlmefit to do a linear random effects model of some data using the following command:
beta = nlmefit(a,b,grp,[],@(PHI,X)(X*PHI),[1 0]);
where
a=[0 1 2 0 1 2 0 1 0 1]'; b=[6.4512 5.9866 4.8052 7.0858 6.2563 5.5702 7.0976 7.7617 5.8512 7.1175]'; grp=['ABC' 'ABC' 'ABC' 'ADW' 'ADW' 'ADW' 'AEC' 'AEC' 'AEL' 'AEL'];
a,b, and grp have been shortened for brevity, they are actually 118x1 vectors.
I get the following error that I do not understand:
In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in nlmefit>getFcns/vectorizeSinglePhiGroupX (line 1367)
fval(k) = model(phi(i,:),X(k,:),V(i,:));
Error in nlmefit>getFcns/computeFAllAndCount (line 1450)
f = modelVectorizedAllGroups(phi, X, VVectorized);
Error in nlmefit>@(Beta,b)computeFAllAndCount(phiAllGroupsFcn(Beta,b)) (line 1459)
computeFAllGroupsFcn = @(Beta,b) computeFAllAndCount(phiAllGroupsFcn(Beta,b));
Error in nlmefit>@(Beta)computeFAllGroupsFcn(Beta,bDummy) (line 478)
model = @(Beta) computeFAllGroupsFcn(Beta, bDummy);
Error in nlmefit>LMfit (line 1752)
yfit = model(beta);
Error in nlmefit (line 481)
Beta_hat = LMfit(Y,Beta_hat,LMfitOptions,model,jacobian);
Thanks in advance for any clues!
Erin
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Nonlinear Regression 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!