function [growth sd] = ag_growth(id,year,X)

% Create a balanced matrix of growth rates, where 0's fill in missing,
% which is ok b/c will sum over zeros and not count when taking averages

[h1,h2,ii]=unique(id);
[h1,h2,jj]=unique(year);

N=max(ii);
T=max(jj);

bigX=zeros(N,T);
bigX(sub2ind([N T],ii,jj))= X;

growth = sum(bigX,1);
sd = std(growth);

