scoring system based on 0/1 ranks

I am looking to develop a score that outputs 1 or 0 for each component. ( Like Piotroski’s F score)

How does one go about doing that?

Traditional ranking will not work

The way that I usually do it is in the screener. Use SetVar:

SetVar(@1,MktCap>2000)
SetVar(@2,ROI%TTM>5)

The final rule of a scoring system will then be:

@1+@2>=1

Or whatever the scoring will be.

Use this to see the value:

ShowVar(@score,@1+@2)

There will be a column in the screener report Screen Factors that will be headed @score, with the value. In this case that value will be 0,1 or 2.

You can also do this in custom formulas, particularly if you need it as part of a strategy.

Custom Formula 1
Name: 1
Formula: MktCap>2000

Custom Formula 2
Name: 2
Formula: ROI%TTM>5

Custom Formula 3
Name: Score
Formula: $1+$2

The rule (screen or strategy) would then be:

$Score>=1

And $Score can be used in screen reports.

Note that in general you’d probably have more than two terms for this (otherwise it’s easier to just use an “or”). Note also that a scoring value of this sort will be lousy for purposes of ranking because of the limited number of discrete values. This will be true of most scoring systems.

This may be inelegant, but here’s my formula for the g-score:

eval(roa%ttm>roa%ttmind,1,0)+eval(frank(“(opercashflttm+cashfrinvestttm)/asttotttm”,#industry,#desc)>50,1,0)+eval(opercashflttm>netincbxorttm,1,0)+eval(frank(“$incomevariability”,#industry,#desc)<50,1,0)+eval(frank(“$salesvariability”,#industry,#desc)<50,1,0)+eval(frank(“capexttm/asttotttm”,#industry,#desc)>50,1,0)+eval(frank(“isna(randda,0)/asttota”,#industry,#desc)>50,1,0)+eval(frank(“isna(sgandaa,0)/asttota”,#industry,#desc)>50,1,0)

That’s one way of doing things. Paul’s way is more elegant but this way you only need one custom formula.

Hi all

@Yuvaltaylor, many thanks for your great reply. I am trying also to model the G-Score. However, i got an error for the below:

Formula:
eval(frank(“$incomevariability”,#industry,#desc)<50,1,0)

Error:
Ranking failed on 01/01/2005: In ‘ROA 5y Variability < Industry Average’-> Error near ‘$incomevariability’: Invalid command ‘$incomevariability’

Any idea on how to fix this? Many thanks for your time!

that’s a custom formula I wrote. the formula is:

loopsum(“abs(netincbxor(ctr,qtr)-netincbxor(ctr+1,qtr))”,4,0)/netincbxorttm

Go to Research / Components / Formulas, then click new. You can input it there and use it.

If you’re confused about what it does or how it works, just let me know, but see https://www.portfolio123.com/doc/doc_detail.jsp?factor=LoopSum&popUpFullDesc=1

Thanks for this Yuval. I will try it and see if ti works. Appreciated.

Yuval, you have 2 custom formulas in the expression. The other one is $salesvariability.

If you are interested in G-Score, I recommend my recent backtest and article of Mohanram’s G-Score at [url=https://www.fatpitchfinancials.com/3197/mohanram-g-score-backtest-part-2/]https://www.fatpitchfinancials.com/3197/mohanram-g-score-backtest-part-2/[/url]

Please let me know if you have any questions about it. Some of my formulas ended up a bit different than Yaval’s.

Yuval, thanks for this.

2 quick questions:

  1. what is eval(frank(“isna(randda,0)/asttota”,#industry,#desc)>50,1,0) doing?
  2. In you income variability formula: lets take example of 2 companies
    • company A which has the X change in income every quarter
    • Company B has +X and -X alternating quarters
      Both companies would have same score. Is this correct? and does that capture the spirit of the paper?

thank you

Monraham wanted the ratio of R&D to assets to be less than the industry median. When I wrote this formula, it seemed to me that there was no distinction between companies with RandDA = 0 and RandDA = NA–in other words, they were equivalent. But in a ranking system, NA would be ranked lower than 0, which would mean that in industries in which nobody spent any money on R&D, 0 R&D companies would rank higher than NA R&D companies. That’s why I put IsNA(RandD,0) there. The rest of the formula simply says that if a company spends more money on R&D than the median in the industry it gets a point and if it doesn’t, it doesn’t.

The answer to the second question is yes and yes.

Thanks Yuval, that helps. Are you using NA’s are negative then? I mean is that the default in Frank?

Yes, with FRank NAs are always ranked lowest.

Yuval,

As a side question would it be possible to add an option in FRank to force “NA neutral” (like for the ranking systems)?

I will put it as a request but was curious to get your take on feasibility first given what you guys already have on your to-do list?

The business case is to be able to replicate in custom universes exactly all the possible outputs of a ranking system.

Thank you,

JMH

I’m afraid I don’t understand the “business case” here. And given what we have on our to-do list, I can’t see this being a very high priority. I wish I could be more helpful!

All,

JMH is the most polite person on the form with the most polite way of asking for something. He didn’t even ask for anything here. He just politely wants to know how much trouble it would be.

And obviously, if there is a reason to do this with ranks (which P123 does) if might be useful with Frank. There can be no doubt that this is a reasonable thing for JMH to want.

If I used Frank I would want to set it as neutral for NAs for a number of specific purposes. Fortunately for me, not for any purpose that cannot use regular rank at this time.

Very good thing for me as not having this option in the ranking system would cost me tens of thousands of dollars per year.

I am not a professional programmer, but how NAs are to be handled has been one of the first things discussed in any (all) programming course(s) I have ever taken. It is one of the most basic thing to be considered in programming. It should be a consideration for everyone—not just JMH.

The business case would be that JMH is a long-time user that has been, not just polite, but a strong vocal supporter of P123 and is making a reasonable request here.

There may be other higher priorities but there is a business case. Of that there can be no doubt.

Best,

Jim

As the booleans True and False are the integers 1 and 0 in P123 rule language like in many programming languages, you can remove most, if not all, eval functions from the formula, which will greatly improve readability and also allow putting more code in the maximum length of a formula.
Basically eval(roa%ttm>roa%ttmind,1,0) and roa%ttm>roa%ttmind are equal, even when one side of the “>” is “NA”.