No BSD License  

Highlights from
Compute PSA-benchmarked prepayment metrics

image thumbnail
cprpsa(month,psa)
function[cpr] = cprpsa(month,psa)
% CPRPSA    PSA-benchmarked conditional prepayment rate
% INPUTS  : month - month(s), n*1 vector
%           psa   - PSA factor
% OUTPUTS : cpr   - monthly CPR, n*1 vector
% EXAMPLE : cpr(5,100), cpr(1:30,150)
% AUTHOR  : Dimitri Shvorob, dimitri.shvorob@vanderbilt.edu, 9/20/07
if ~isvector(month)
   error('Input argument "month" must be a scalar or vector')
end
if any(month ~= floor(month) | month < 0)
   error('Input argument "month" must contain non-negative integers')
end
if ~isscalar(month) || psa < 0
   error('Input argument "psa" must be a positive scalar')
end
i = ones(length(month),1);
j = min([i month(:)/30],[],2);
cpr = .0006*psa*j;

Contact us