error Undefined operator '.*' for input arguments of type 'table'.
Afficher commentaires plus anciens
Hi guys,
I am still a beginner with Matlab and I am trying to use the IP-VAR toolbox of Weber and Towbin ( http://sebastianweber.weebly.com/codes.html) . Unfortunatly I am running into an error when I am estimating my InteractPvar. The error indicates " error Undefined operator '.*' for input arguments of type 'table'. "
Does anyone know what is happening here? I have indicated the line with the Error below.
Many thanks in advance!
Kind regards,
Kiethan
%-----------------------------------------------------------------------------------------------------
% CREATE REGRESSORS
%----------------------------------------------------------------------------------------------------
for i=1:lag+1
Xn(i).X = [];
end
for i=1:lag+1
for j=1:I
X=[];
for nx=1:Kx
Xh=[];
for nint=1:Ki
start = 1+lag+(j-1)*time;
ende = j*time;
if i==lag+1
Xh=[Xh ydata(i+(j-1)*time:j*time-lag-1+i,nx).*Idata(start:ende,nint)];
else
% --> this is the line with the error according to Matlab --> Xh=[Xh xdata(i+(j-1)*time:j*time-lag-1+i,nx).*Idata(start:ende,nint)];
end
end
if i==lag+1
Xh=[ydata(i+(j-1)*time:j*time-lag-1+i,nx) Xh];
else
Xh=[xdata(i+(j-1)*time:j*time-lag-1+i,nx) Xh];
end
X=[X Xh];
end
Xhelp(j).X(:,:) = X;
Xn(i).X = [Xn(i).X
Xhelp(j).X];
clear X
end
XX(i).X = Xn(i).X;
clear Xhelp(j).X Xn(i).X
end
% added to include interaction
Idata2=[];
for i=1:I
start = (i-1)*time;
ende = i*time;
Idatah = Idata(1+lag+start:ende,:); % Idata(1+lag+(j-1)*time:j*time,:) for time t;
Idata2= [Idata2
Idatah];
clear Idatah
end
% Create intercept
X = ones(size(XX(1).X,1),1);
% Create intercept interactions
Xinter=[];
for nint=1:Ki
Xinter=[Xinter X.*Idata2(:,nint)]; % added to include interaction
end
X=[X Xinter]; % added to include interaction
%don't include constant (for fixed effects)
%X=[Xinter];
% Create Regressors (NOTE: THE ORDER IS REVERSED, i.e. XX(2).X is the first
% lag in a PVAR(2) and XX(1).X is the second lag!!)
for i=1:lag+1
X = [XX(i).X X];
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Tables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!