Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Missing values in internal rate of return calculation

From   Tanja Berg <>
Subject   st: Missing values in internal rate of return calculation
Date   Wed, 23 May 2012 19:25:17 +0200


I want to do an internal rate of return calculation in Mata.

That is what I have programmed so far:

v=st_data(.,"zspread pricenew cf1-cf16 spot1-spot16 mat1-mat16")

function y(zspread,v) {



for (i=1;i<=rows(v);i++) {

The variable "zspread" is the internal rate of return I want to get.
But I always get missing values for the zspread. I think this is the case because my data I imported from Stata includes missing values, but I can't just delete the observations with missing values because all the observations include at least one missing value.
I tried to replace the missing values by zero, but then I get zero as a result for the "zspread".

Is it possible that Mata can somehow ignores missing values and calculate only with the data available for each observation??

I really need your help! I am searching the web for hours and can't find any solution for this problem.
It has to work somehow.

Thanks and regards!

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index