function foc=nointang_resid(X,param);
%NoIntang    Residuals for the model without intangible capital that includes
%  _Resid    business and nonbusiness sectors.  For details see the 
%            appendix to:
%
%               Unmeasured Investment and the 1990s US Hours Boom
%               by Ellen McGrattan and Ed Prescott
                                                                                
%            Ellen R. McGrattan, 3-18-05
%            Revised, ERM, 9-3-07
%______________________________________________________________________________
%
% PARAMETERS

beta       = param(1);
delta      = param(2);
eta        = param(3);
gamma      = param(4);
psi        = param(5);
sigma      = param(6);
theta      = param(7);
kb0        = param(8);
T          = param(9);
inputs     = zeros(T,13);
inputs(:)  = param(10:9+13*T);
A          = inputs(:,1);
lwedge     = inputs(:,2);
xwedge     = inputs(:,3);
g          = inputs(:,4);
tauc       = inputs(:,5);
gtauh      = inputs(:,6);
gtaux      = inputs(:,7);
tauk       = inputs(:,8);
taup       = inputs(:,9);
taud       = inputs(:,10);
yn         = inputs(:,11);
xn         = inputs(:,12);
hn         = inputs(:,13);
deriv      = param(10+13*T);
bhat       = beta*(1+gamma)^(-sigma);
thet1      = 1-theta;
delt1      = 1-delta;
grate      = (1+eta)*(1+gamma);
tauh       = 1-(1-gtauh).*lwedge;
taux       = (1+gtaux)./xwedge-1;

%______________________________________________________________________________
%
% VARIABLES APPEARING IN RESIDUALS

kbn        = X(1:T);
hb         = X(T+1:2*T);
kb         = [kb0;kbn(1:T-1)];
xb         = grate*kbn-delt1*kb;
h          = hb+hn;
yb         = A.*kb.^theta.*hb.^thet1;
c          = yb+yn-xb-xn-g;
l          = 1-h;
uc         = c.^(-sigma).*l.^(psi*(1-sigma));
rb         = theta*yb./kb;
t          = 1:T-1;
t1         = 2:T;
xtau       = (1+taux).*(1-taud)./(1+tauc);
dtau       = (1-taud).*taup./(1+tauc);
ptau       = (1-taup).*(1-taud)./(1+tauc);

foc        = [[xtau(t).*uc(t)- ...
                   bhat*uc(t1).*(ptau(t1).*(rb(t1)-tauk(t1))+ ...
                            delt1*xtau(t1)+delta*dtau(t1));
                kbn(T)-deriv*kbn(T-1)];
              psi*(1+tauc).*c.*hb./yb-thet1*(1-tauh).*l]; 
