Warning: Rank deficient, rank = 2

Discussion in 'MATLAB' started by Karren, Nov 7, 2011.

  1. Karren

    Karren Guest

    Hi there,

    I'm trying to determine the price of convertible bonds using Least squares Monte Carlo simulation model of Longstaff & Schwartz (2001). I've been running the following codes for a couples of convertible bond and the results are just fine.

    Coupon = CouponRate * X;
    DailyCoupon = Coupon/360;
    CouponCF = zeros(NRepl, NSteps);
    CouponCF:),1) = DailyCoupon;

    for i = 2: 1: NSteps
    CouponCF:), i) = CouponCF:), i-1) + DailyCoupon;
    end

    nudt = (mu-0.5*sigma^2)*dt;
    sidt = sigma*sqrt(dt);
    RandMat = randn(round(NRepl/2), NSteps);
    Increments = [nudt + sidt*RandMat ; nudt - sidt*RandMat];
    LogPaths = cumsum([log(S0)*ones(NRepl,1) , Increments] , 2);
    SPaths = exp(LogPaths);
    %Calculate the conversion value of each simulated path
    ConversionValue = SPaths * ConversionRatio;
    ConversionValue:),1) = []; % get rid of starting prices
    % Risk neutral discounting factor.
    discount = exp(-r*dt);
    % discount rates over different time intervals
    discountVet = exp(-r*dt*(1:NSteps)');
    a = zeros(3,1); % regression parameters
    % At maturity, the price of a convertible bond equals to the max of
    % conversion value(CV) or redemption value(X), adjusting for coupon
    % payment.
    CashFlows = max(ConversionValue:),NSteps), X);
    TotalCF = CashFlows + CouponCF:),NSteps);

    % First set exercise time at expiration for convenience.
    ExerciseTime = NSteps*ones(NRepl,1);

    % Work backward through the stock prices until step = 1.
    for step = NSteps-1:-1:1
    InMoney = find(ConversionValue:),step) > X);
    XData = ConversionValue(InMoney,step)+ CouponCF(InMoney, step);
    YData = TotalCF(InMoney).* discountVet(ExerciseTime(InMoney) - step);
    RegrMat = [ones(length(XData),1), XData, XData.^2]; % Design matrix for pure quadratic regression.
    a = RegrMat \ YData; % Regression parameters.
    ContinuationValue = RegrMat * a; % Regression predicted CF.
    Exercise = find(XData > ContinuationValue);
    k = InMoney(Exercise);
    ExerciseTime(k) = step;
    TotalCF(k) = XData(Exercise);
    end % for
    CBprice = mean(TotalCF.*discountVet(ExerciseTime));

    But when I try to run for a convertible bond with the following features,
    a warning message pops up. For eg.

    Warning: Rank deficient, rank = 2, tol = 2.740245e+002.

    % Convertible bond features.
    mu = 0.5574; % Expected return.
    sigma = 1.5514; % Volatility.
    ConversionRatio = 97.2640; %Predetermined conversion ratio.
    ConversionPrice = 10.210; % Conversion price at offering.
    X = 1000;
    CouponRate = 4.75/100;
    S0 = 8.130; % Spot price.
    NSteps = 2462; % Number of time increment.
    NRepl = 10000; % Number of simulated paths.
    T = NSteps/360; % Maturity in years.
    dt = T/NSteps; % Time increment.
    r = 4.671510/100; % Risk-free rate.

    The error message also claims that the rank deficient is at a = RegrMat \ YData; % Regression parameters.

    I really need some advice to solve the problem.

    Karren
     
    Karren, Nov 7, 2011
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.