passing multiple group parameters to nlmefitsa

1 visualizzazione (ultimi 30 giorni)
Rui
Rui il 16 Ott 2014
Dear all,
I find that I cannot pass multiple group parameters to nlmefitsa (MATLAB 2014a). Only the first parameter is passed to nlmefitsa. I checked source code of nlmefit, and see this
if isempty(v)
v = zeros(NGroups,0);
elseif ndims(v)>2 || ~isnumeric(v) || ~isreal(v) || size(v,1) ~= max(Id)
error(message('stats:nlmefitsa:BadV'));
elseif length(v)>NGroups
v = v(uId); % remove unused groups
end
by definition, V is an M-by-G matrix of G group-specific predictor variables for each of % the M groups in the data.
Then length(V) will be G (assume my G > M).
The code "V = V(uID)" will remove part of my V matrix, as such, only truncated group parameters are passed to nlmefitsa.
here is an example
subject = kron((1:3)',ones(4,1)); % 6 subjects measure at 4 times
time = kron(ones(3,1),(1:4)');
weight = [100 150 140 ]'; % group parameter 1
height = [100 150 140 ]'; % group parameter 2
height2 = [100 150 140 ]'; % group parameter 3
height3 = [100 150 140 ]'; % group parameter 4
height4 = [100 150 140 ]'; % group parameter 5
effect = [1 -1 0 ]'; % a "random" effect of each subject
y = 5 + effect(subject) - time + .03*weight(subject)+ .03*height(subject) + .03*height2(subject)+ .03*height3(subject)+ .03*height4(subject) + randn(size(subject));
model = @(phi,t,v) phi(1) + phi(2)*t + phi(3)*v(:,1) + phi(4)*v(:,2) + .03*v(:,3) +.03*v(:,4) + .03*v(:,5) ;
phi0 = [1 1 1 1];
[beta,PSI,stats,br] = nlmefitsa(time,y,subject,[weight height height2 height3 height4],model,phi0);
run it, i will get the error message that
Attempted to access v(:,2); index out of bounds because numel(v)=1.
Is this a bug? can anyone help me?
Rui

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by