In that case the best way is to define the function to be evaluated as a M-file.
First, you define a fucntion that given the variables (a’,a,z) and some parameters computes the income tax liability:
function tax = f_income_tax(aprime,a,z,alpha,r,delta,tau)
% Linear income tax
w = (1-alpha)*((r+delta)/alpha)^(alpha/(alpha-1));
income = w*z+r*a;
% Here it will be more complicated: add tax brackets and tax rates
tax = tau*income;
end
Second, you add this function to the functions to evaluate
FnsToEvaluate.income_tax = @(aprime,a,z,alpha,r,delta,tau) f_income_tax(aprime,a,z,alpha,r,delta,tau);
Then the toolkit will compute the total income tax as AggVars.income_tax.Mean. The variable income_tax can be used as an input to general equilibrium conditions. Suppose for example you want to add a condition for government budget constraint:
GeneralEqmEqns.Gov = @(G,income_tax) G - income_tax;
where you impose that in equilibrium total income taxes equal government spending G.
Note: if your model features endogenous labor supply, the ‘always required variables’ are not (a’,a,z) but (d,a’,a,z).