Author Archives: bhyde

R scoping, assignment, confusion

In R lexical variables are implicitly introduced by assignment. It also appears that lexical variables default to the value they had in the enclosing scope.

> b = 2
> g <- function () { print(b); b <- 3; print(b) }
> b
[1] 2
> g()
[1] 2
[1] 3
> b
[1] 2
>

It’s unclear from that example if the first print of b in the function is referring to outer or the inner b.

But this example makes my brain hurt. Here we have x, who’s value is a matrix. When we assign to it even a single element of the matrix in the function it appears that R copies the entire matrix.

> x <- matrix(1:4,c(2,2))
> x
[,1] [,2]
[1,] 1 3
[2,] 2 4
> x[2,2] <- 22
> x
[,1] [,2]
[1,] 1 3
[2,] 2 22
> f <- function (z) { x[1,1] <- z; c(x[1,1],x[2,2]) }
> f(11)
[1] 11 22
> x
[,1] [,2]
[1,] 1 3
[2,] 2 22
>

It this point it unclear on how to write functions that have side effects on data structures. That certainly is a strange state to get into. The language reference manual talks about scopes, but it spends all its calories on explaining closures. If you read the help for the assignment operator help(“<-“) you discover there are actually five operators with two semantics.

> f <- function (z) { x[1,1] <<- z; c(x[1,1],x[2,2]) }
> f(11)
[1] 11 22
> x
[,1] [,2]
[1,] 11 3
[2,] 2 22

Notice the “< <-" operator. It preempts creating something in the inner most scope of the function. Instead it will run outward looking for an existing data structure to modify, finally creating a fresh variable in the global scope. The five operators are <-, ->, <<-, ->>, and =. The = looks like a vestigial organ; it’s identical to <- except for some severe limits on what contexts you can us it in.

I don’t think I quite have this all figured out yet. In this example we make a list of two elements, but we also give names to those
elements.

> guys = list(who = c("tom", "john"), age=c(12, 14))
> guys
$who
[1] "tom" "john"

$age
[1] 12 14

> names(guys)
[1] "who" "age"

We can then “attach” to that data structure so we can use the name directly.

> attach(guys)
> who
[1] "tom" "john"
> age
[1] 12 14
> mean(age)
[1] 13

Something similar to the automatic copy of a lexical variable is going on here as well.

> age[1] <- 13
> age
[1] 13 14
> guys$age[1]
[1] 12
> detach(guys)
> guys
$who
[1] "tom" "john"

$age
[1] 12 14

That’s kind of neat. The attach creates a scratch workspace where you can tinker with a data structure without doing damage to your master copy.

All this suggests to me that there might be a lot of lazy evaluation going on here. That’s plausible since we saw promises in the basic type suite.

None of this surprises me, this is the kind of stuff that happens in a very domain specific special purpose language. I just wish it was explained someplace in a way I could understand.

But our lemmings can fly!

I recently bought (via eBay) a copy of The Complete Cartoons of the New Yorker. All the cartoons are on two CD (as PDF) and selected cartoons are in a very big heavy book. I copied them off the CDs and I’ve been paging thru them. They are a fascinating historical document. For example there is a period in the late 50s of cartoons about the rest of the world hating us that could be recycled today.

I can’t, of course, show you any of these – but they are great fun for visual thinking.

There is a cartoon who’s caption reads “What the Lemmings think.” and it shows the river of lemmings pouring off the cliff, into flight, and up into the heavens. I was reminded of that by the Robert X. Cringely essay today that reports that there is 20+ billion dollars of VC money that just has to be invested in the next 12 months, but the poor lemmings haven’t found a cliff yet. He, tongue firmly in cheek, recommends cell-processors.

Since the week demands it he also has a few choice words about HP’s troubles.

Knowing she was not what she was claiming to be, Carly’s management technique was to be charming and brutal, to throw HP through a succession of mergers and reorgs that kept any potential adversary from gaining a power base. Note that this week, there simply is no clear internal successor as CEO, nor is the company even thinking of looking inside because any talent there was run off long ago.

The big problem with running a company this way is that it always ends badly

That sounds about right. HP’s course changes have seemed pretty clueless over the last few years and I’ve certainly seen that pattern more than once in my life. Trouble is, the behavior management exhibits in that scenario is almost identical to the behavior when the firm has severe group-think, it’s business model is dried up, and a huge course correction is it’s only hope. At that point management is more like a convivial but suddenly desperate animal and that just looks like a convivial but basically clueless act.

Triangles

I’ve always enjoyed being a smart aleck about dialectics; injecting a third into the midst of the mud wresting that others like to do.

So the middleman in the midst of buyers and sellers is partially of that kind.

But I think’s helpful to spend some time aggregating the tools to work on problems in a less polarized manner. Toward that end I’ve been baiting various groups for examples of sets of three. I’d prefer ones that bring rich metaphors along with them. The three colors for example do that.

One example was delightfully way to do this is illustrated by: GM, Chrystler, and Ford; the three big car makers in the US. If you have a concentrated industry you get a small number of big players. That’s one of the extreme power-law cases and of course you can then go find lots of other power-law sets and pop off the top three.

For example english from here.

  • Spoken: the, I, you
  • Written: the, of, and
  • Nouns: time, year, people
  • Verbs: be, have, do
  • Adjectives: other, good, new
  • Adverbs: so, up, then
  • Pronouns: it, i, you
  • Determiners: the, a, his
  • Determiner/Pronouns: this, that, which
  • Prepositions: of, in, to
  • Conjunctions: and, that, but
  • Interjections: yeah, oh, no

“Yeah”, “Oh” … “No!” That’s practically the example i started with.

I want out!

Bruce Schneier writes about his desire to let go of the tarbaby.

Months have passed, and I no longer want an ongoing relationship with the e-commerce site. I don’t want a username and password. I don’t want them to have my credit-card number on file. I’ve received my purchase, I’m happy, and I’m done. — …more

This is one of the design problems in the identity space I find most puzzling. The business forces are reasonably straight forward; the commercial firm’s valuation is dependent on the # of relationships it “owns.” That creates a powerful incentive for the firm to create sticky relationships and then a powerful incentive for it to work those relationships over time.

The relationships are a problem because they create risks. For example after a few years, when it becomes obvious your never coming back to do more business, the firm is sorely tempted to try some spamming action to garner some value out of the relationship. I had AT&T credit card, for example, that I stopped using. As each year would pass they would try more and more obnoxious ways of capturing some value out of the relationship. Finally they started calling me and trying to sell me life insurance! They had sold my name to some telemarketing life insurance company along with permission for that company to calm they were “AT&T”.

Bruce talks about the risk that something bad will happen with the account.

Near as I can tell, the username and password I typed into that e-commerce site puts my credit card at risk until it expires. If the e-commerce site uses a system that debits amounts from my checking account whenever I place an order, I could be at risk forever. (The US has legal liability limits, but they’re not that useful. According to Regulation E, the electronic transfers regulation, a fraudulent transaction must be reported within two days to cap liability at US$50; within 60 days, it’s capped at $500. Beyond that, you’re out of luck.)

I don’t think that’s exactly right. I believe that the credit card consumer protections (at least currently in the US) are somewhat stronger than the electronic transfer ones. On the other hand the debit card rules aren’t.

But, consumer protection is the right stick to hit this problem with. I can not see any way the market forces are going to resolve this problem.

The problem is that a relationship creates some rights to hold data and do stuff with that data. For example the right to send me email announcing that something I ordered has been shipped. The right to retain my shipping address so they can expedite future sales. These rights of data retention and action need to decay. Traditionally mother nature saw to it that they would decay, but no more. Technology tends to do the inverse. The data doesn’t tend to decay, it tends to spread. These organizations don’t forget, they gossip.

Large relationship aggregators need to be brought to heel. It is not in their localized best interest for that to happen. The only player in the game with the power to do that are governments.

Oh wait! I forgot I’m supposed to make this a law: “Let go, damn it!”

invisible

R has a function called invisible. Cool, I’ve never seen a language with that before. As far as I can tell this must place the object into a set that is then ignored by the printing machinery. I’m guessing that this set is cleared when ever the read/eval/print loop comes around for another bite to eat. … hm, looks like only the top level of the printing machinery cares.

> 1;2;invisible(3);invisible(4);5
[1] 1
[1] 2
[1] 5
>

Most of the GUI systems I’ve worked on had an invisible predicate used by the rendering mechanism. You need it first to keep from spending huge amounts of time rendering things too small to be seen. Once you have it you start using it give your views an attitude. Sending a message to the read/eval/print loop as to what to do the result being computed; I don’t think I’ve ever seen that before. Interesting idea.

R

I’ve been trying to add R to the tool bench I keep in my noodle. I’ve heard very good things about it, but my first impressions were crummy. The tutorial is weak, there’s no wiki, no IRC channel, the help list is hosted at Yahoo, the book is hundred bucks – mixed signals. And then, it’s community is full of very smart stats dudes, which is scary – they have special words for everything!

Finally I got around to reading the language reference manual. Oh boy! You can tell a lot about a language from the primitive types. In addition to the expected usual boring junk notice these: closure, promise, language, special, environment, expression, weakref. It’s the guest list for a really good party!

Great sentence: “All objects except NULL can have one or more attributes attached to them. Attributes are stored as a list where all elements are named.” You can build some really nice data structures given that, for example custom class systems. So when you want to have, oh time series, you can slip them in “The tsp attribute is used to hold parameters of time series, start, end, and frequency. This construction is mainly used to handle series with periodic substructure such as monthly or quarterly data.” Without messing with the language kernel.

Then somebody is having fun.

> class(d2)
[1] “data.frame”
> typeof(d2)
[1] “list”
> attributes(attributes(d2))
$names
[1] “names” “class” “row.names”

or

> 0:1
[1] 0 1
> 0:10
[1] 0 1 2 3 4 5 6 7 8 9 10
> 2*1:3
[1] 2 4 6
> 0:1*1:10
[1] 0 2 0 4 0 6 0 8 0 10
>

Very amusing, I like a cheerful language.

Power-law tagging – part 2

Click here for a more exacting illustration of the power-law distribution of tags for things posted at del.icio.us.

Two things to note. When you click thru to the page at del.icio.us that provides a summary of the postings for a given URL the tags show are a subset of the full set of tags used. The chart shows all the tags used.

Second notice that the model of these as power-law doesn’t fit once you include the tags used only once. I think that’s probably because those tags are often used by users to denote some very personal function. For example they might tag a page monday to indicate that they plan to return to this item next monday. But, that’s just a guess.

These lines are similar to the one you get if you plot the usage frequency of words in English or other languages. These lines appear to be slightly steeper, but not much. I’m still surprised how similar they are.

An Example of Boundry Formation

Tilly’s book on violence taught me something.  Keep a watch out for the work in progress of building boundaries between or withing groups. Tilly, since he’s working on violence, calls the people who do this work “political entrepreneurs and violence specialists.” I encountered a particularly excellent example of this today.

Until I got to this section in the piece I didn’t realize that boundary activation was part of the author’s agenda.

For my purposes, it’s irrelevant what boundary was being reenforced here. I want to focus on the tool, not what’s getting built. So I’ve modified the example. The boundary is now dogs and cats. The author is a cat.

In dog activist circles, prestige and legitimacy often accrues to those who most successfully express an oppositional identity. The way the equation works within the movement is that the more opposition you express, the more canine you become. Anti-cat racism within the pack is largely perpetrated by people-such as Fido who are insecure in their own canine identity. Hence Fido indicts the fluffy cat Army by fabricating a new, even more disturbing atrocity, thus raising the stakes on canine grievances, in order to garner acclaim as a real dog activist whose legitimacy is beyond question. Given the canine movement’s anti-intellectual environment, few are likely to bother tracking down Fido’s citations, especially considering that his core audience is already primed to believe such accusations against the cat government.

You gotta admire the structure of that beast. It heightens a boundary while suggesting that boundary activation (aka oppositional identity) is vile. Most of the meat of the sentence is devoted to suggesting that Fido is insecure, not a real activist. That the dog community is anti-intellectual and “unlikely to bother”. It reenforces the value of the cat side by suggesting that they aren’t lazy, that they are intellectual. It then creates a sense of urgency by reminding us that dogs have an army and, oh no, a government. Marvelous!

Note also how the political entrepreneur is projecting his own insecurities. This kind of projection is very common in the boundary building trades. He’s right of course. Prestige and legitimacy, inside of group, often does accrue to those who do this work.

empty slots, option spaces, and the cowboy myth

What percentage of the expansion slots on PCs lie empty? 90%, 98%? That’s a lot of empty real estate! Who’s paying for that and why? Think of what all that empty real estate costs to create!

Slots and connectors create a set of options for the both the buyer and the market to play with. But why create those options if they are mostly not used? First let me work thru one explanation that I don’t find sufficient.

Options that don’t get used can be extremely valuable. For example, phones are almost never used call the fire department, but the option to make that call is still exceptionally highly valued. So, part of the answer is about risk. The empty slots lower the buyers’ perception of their risk. The slots as creating the option to solve problems; problems the buyer can not even name. That suggests that slots are more signal value and use value.

I don’t think that’s a strong enough value proposition to explain all this empty real estate. So let’s take another try; this time at the market dynamics rather than the individual buyer value.

Slots create options for the entire marketplace. In a sense they create the possibility that the market repair vendor errors. The slots a sign that the vendor is humble – i.e. willing to admit he can not do it all. But humble isn’t exactly right; the vendor is also signaling that he is generous. The slots say something about the abundance of value he is creating.

When the vendor creates a slot he’s relinquishing control over some amount of value creating energy implicit in his offering. At first glance that seems like an odd move on his part. Giving away the option to create value? Certainly the rational actor would horde those options. Presumably it is not just his humble nature that triggers this giving away.

That starts to get us closer to a plausible answer to the question of who’s paying for all this empty real estate and why?

Markets are not as simple as buyer v.s. seller! Most markets have a number of complementary players. It maybe we need to look these to find out who ordered the empty slots.

If the OS or CPU vendor is powerful he might force it. Both the OS vendor and the CPU vendor prefer an open hardware bus because it encourages a more commodity market in their complements. I suspect this is the key to puzzle. Microsoft/Intel ecology has so many empty slots. Other platforms have fewer. It’s no surprise then that the Apple keeps trying out product offerings with few or no slots.

In this model those slots are paid for by the hardware vendors to create a space of options who’s exercising creates value for the dominate market players, i.e. Microsoft and Intel. The landscape of empty slots is a substrate for a generative process, a process that adds to the network effect around their business model. Of course they are both so large that their business model is the industry’s business model.

Why do Macs have slots? I suspect that’s because the market expects it. That Apple garners little benefit from the slots, and it’s users don’t get much either. But it would be interesting to see statistics about how much of the slot landscape is filled in on both ecology. Of course Apple, like Linux does, benefits from the hardware vitality created in the Microsoft/Intel ecology so it’s a small price to pay.

The underlying idea in here is that the space of empty slots is like real estate. In an economic universe that implies that it serves an economic function. Typically that means somebody owns it. Somebody is maintaining it. Somebody it taking a tax off. Somebody benefits.

In the American story the huge swaths of unowned real estate that was left behind after European plagues wiped out the native american populations provided a very different dynamic from that seen in old Europe. All that land enabled made labor extremely valuable. The combination of ample options to move on, and high wages gave labor vastly increased freedom to experiment.

The same pattern exists on the landscape of empty slots. The space of empty slots lowers the barrier to experimenting. That output of that experimentation is valuable to those who create the landscape of empty slots. I.e. Microsoft and Intel.

Notice then what happens if the percentage slots begin to be filled in. If there is anything consistent about how they get filled in; for example they all start sporting graphic’s cards – that’s not stable. The industry will absorb any consistent slot usage into the core.

So then, is the space of empty slots a long tail? I.e. is their a generative process here who’s distribution is power-law which creates the occasional elite member, (in this case we could consider the graphic accelerator card as an example of a elite member). For this generative process to work it draws upon the power-law’s long tail of activity. In this case the long tail of activity actually has negative value. Since the majority of buyers don’t use the slots they are getting no value from them. The hardware makers are including them not because of buyer demand but because the dominate players in the market want them. The dominate players in the market want them because they tap into the the value created by the generative process that all that empty real estate creates.

Of course Moore’s law and his friends are all about creating huge swaths of empty real estate. So empty slots on motherboards are just one example.

Tag Markets

Of course all those tags are worth money.

… the price that advertisers paid for keywords dropped an average three percent,…

…28 percent drop in Telecom-Wireless products and services from $1.09 to $.79, possibly reflecting the trend to give cell phones as a gift during the holidays. … Consumer-Retail category … decreased … 11 percent

Fathom Online, a leading SEM, tracks keyword prices daily and even hourly to spot trends and to provide its clients advantageous buying opportunities.

— Fathom Online