Utility function IsNA()

This new function has been released a while back but never announced:

IsNA(expr,replacement_value): returns the value of expr if it’s not NA, otherwise it returns replacement_value

Sometimes it is desirable to supply replacement values when NA’s (Not Available) are encountered. First a primer on NA values:

A ratio gets a value of NA when it cannot be computed or it’s missing from the statements. Many NA’s also happen during pre-annoucements when a company reports incomplete statements. NA values are a real problem when ranking because that particular factor will get the lowest rank of all. This can cause false signals and higher turnover. In screening any NA in the formula will cause the stock to be filtered out.

You can now use IsNA() to replace NA with a better value.

For example there are currently over 5000 stocks with Yield = NA. To substitute 0 enter:

IsNA(Yield,0)

NOTE: Previously you had to type Eval(Yield=NA,0,Yield)

Is this function to be used only in Ranking Systems? I may be having a dense moment, but offhand I don’t see how it would be used in Buy or Sell rules. Perhaps some examples?

Jerrod and All,

As I see it, it’s a good thing that Marco is aware of this. He’s in a privileged position, because he’s able to see all the Reuters data.

Problem #1: We, users, are totally unaware that a problem exists. We’re unaware, because we cannot see the raw fundamentals data that comes from Reuters.

Problem #2: Let’s suppose stocks A, B, C, and D have EPS%ChgTTM values of -2, -1.25, +1.2, and NA, respectively. Then the P123 computer will assign the highest rank to stock C (because it’s +1.2), and the lowest rank to stock D (because it’s an NA)…

Solution: However, if this ranking is not what you want, then you can write “IsNA(EPS%ChgTTM,0)”. Then the P123 computer will assign the highest rank to stock C (because it’s +1.2), and the lowest rank to stock A (because it’s -2).

Problem #3: How do you add something like IsNA(EPS%ChgTTM,0)?

Solution: Marco, feel free to jump in here and tell us what the real deal is. But my guess is…

If there’s an EPS%ChgTTM > x.xx in your buy rules, then you might want to experiment, and add IsNA(EPS%ChgTTM,0) to your buy rules. Preferably just before your EPS%ChgTTM > x.xx rule.

Or, if you’ve got an EPS%ChgTTM > x.xx in your sell rules, then you might want to experiment, and add IsNA(EPS%ChgTTM,0) to your sell rules. Preferably just before your EPS%ChgTTM > x.xx rule.

Marco, feel free to jump in, and tell us what the real deal is – but my guess is, this “IsNA(xxxxxxx,0)” can be applied to all factors, all buy rules, all sell rules, and all nodes in all ranking sytems.

As I see it, the choice is up to you, the user. You, the user, don’t have to make any changes in your sims, ports, or ranking systems. However, now you’ve got a bit of additional freedom to experiment. And, who knows, you might find that, by including this IsNA(xxxxxx,0) in you buy rules, sell rules, and/or ranking systems, you may see additional improvements in the annualized returns of some or all of your ports.

I hope this helps.

Robert

All,

In our Buy and Sell rules, I believe I’ve already figured out the use of this IsNA() function.

However, what about our Ranking Systems? In other words, how do you use it in your Ranking Systems?

Example: Let’s experiment on the “Sales%ChgTTM” node of the “Growth” folder in one of P123’s well-known ranking systems, called “Foolish 8”.

Let’s say, we copy and save it as, “Copy of Foolish 8”. Then, in “Copy of Foolish 8”, "we open a “Text Editor”. Now, in the Text Editor, what do we say? Let’s say, we type…

[b](IsNA(Sales%ChgTTM,0)) &[/b] Sales%ChgTTM

This script would make sense to me. However, when I click on the “Update” button in the Text Editor, I get the following error message:

Problem:“ERROR: In ‘StockFactor’. Stock Factor ‘(IsNA(Sales%ChgTTM,0)) & Sales%ChgTTM’ is invalid.”

Which means, “Sorry, guy, you can’t do that.”

Now, what do you do?

Any thoughts…

Ideas… or experiences?

In other words, how do you do it?

Robert

Hi Robert, enter it as a formula instead of as a factor and IsNA will work in a ranking system. Here I made a public version of Foolish with your formula added. Kurt

Hi Kurt, With your help, it is working now. Working like charm. There are no more error messages. Thank you. – Robert

Still don’t get it. Is this best used in Ranking System, Portfolio or Screener.

It seems this is a function you want to happen before the ranking starts.

I don’t really want to give it a weight inside a ranking system.

What am i missing.