# How baby names propagate as memes across the US

Tags

A good friend of mine sent me a link to an animated gif that shows the popularity of baby names across the US over time [1]. The visualization uses the Social Security Administration records to display the most popular female name in each state from the early 1950s through present. It’s interesting to see how the top names spread across states and eventually decline in popularity. Unfortunately my name isn’t the correct gender nor popular enough to make an appearance. Fueled by equal parts ego and curiosity, I wanted to see how a single name spreads across the nation based on it’s prevalence in each state. For instance, a common name like Brian never tops the list but still has ebbs and flows of popularity that are interesting to track.

### An Interactive Visualization

Hence I created a visualization that does just this. It uses the census data [2] from the early 1900s up until present, so any name present in that dataset can be visualized. There are more than 29,000 names available, not to mention some appearing in both genders. Instead of ranking the occurrences, I use the prevalence of a name (for a given gender and state) to determine the levels of the choropleth. The prevalence is thus binned into eight quantiles, plus a ninth for no data (i.e. 0 occurrences). This way you get a sense of the change in popularity of the name and how it spreads from state to state. This method provides deeper insights and more opportunities for exploration than simply viewing the top ranking names.

#### Geographic clustering

In fact, what is most interesting is to see how some names are popular in a specific geographic region while others are more broadly popular. Presumably the way names spread are governed by demographics, technology, and media. This is illustrated in the name Terrence, which is first popular in the Midwest in the 40s and 50s.

By the 80s, the name has declined in the Midwest and has become more popular in the South.

#### Media Influence

Other names are clearly influenced by media and popular culture. Go ahead and view the prevalence of Trinity (female) and Neo (male), both of which come onto the scene after the first Matrix movie. Similarly, the name River (male) becomes popular after the death of River Phoenix.

#### Gender Differences

Another insight is the difference in prevalence between the genders for a given name. Avery as a male name mostly appears in the South. By the 1950s it has spread North but not West. It isn’t until the late 1990s that the name has spread across most of the country.

Interestingly enough, the region that took the longest to be adopted is the same area where Avery is predominantly a female name. As a female name, it isn’t until the mid 1980s that the name becomes broadly considered a female name.

#### Other thoughts

I’m a sucker for inverse processes, so a natural follow up is to ask whether it is possible to predict age and state of birth based on a name. Some of the more unique names are so rare that you can deduce a person’s age and state of birth rather easily. Another question worth pursuing is what effect television had on the choice of names.

So what does all this mean for Brian? Sadly, Brian’s golden age was in the 70s and has been in decline ever since.

### Implementation Notes

There’s nothing too fancy in this visualization. The visualization itself is implemented in d3.js, while the data was processed in R. The source data from the SSA is CSV format. I use my Odessa package to convert this to a JSON-compatible structure. The reason is that behind the scenes I use the RJSONIO package, which unfortunately marshals data.frames in column-major format. Here’s an example:

> toJSON(data.frame(x=c('a','b','c'), y=1:3))
[1] "{\n \"x\": [ \"a\", \"b\", \"c\" ],\n\"y\": [ 1, 2, 3 ] \n}"


Most JSON representations of table structures are row-major. In this format, an array represents the table where each element of the array is a JSON object. Each object represents a record/row in the table. Hence, in Odessa, I provide a function called row_major that does this conversion.

> toJSON(row_major(data.frame(x=c('a','b','c'), y=1:3)))
[1] "[\n {\n \"x\": \"a\",\n\"y\": \"1\" \n},\n{\n \"x\": \"b\",\n\"y\": \"2\" \n},\n{\n \"x\": \"c\",\n\"y\": \"3\" \n} \n]"


Odessa has a number of useful functions for data management. Coupled with the recently published lambda.tools, they provide a powerful paradigm for working with data.

# How to estimate the total cost of healthcare and why metal levels are useless

This is part 2/3 in my series on healthcare costs. The analysis is driven by my own needs as an entrepreneur to find affordable healthcare. Part 1 explains why health exchanges are not well-functioning markets, part 2 addresses the issue of price transparency, and part 3 introduces a web app that estimates your annual healthcare costs.

The metal levels of Bronze, Silver, Gold, and Platinum (plus a fifth non-metal level, Catastrophic) were (presumably) introduced to help consumers compare different healthcare plans. The basic idea is that the metal level determines the balance between premium, copayment, and total out of pocket cost [1]. Behind the scenes, the metal level specifies the actuarial value of the plan, which is useful for insurance companies, but less so for buyers of insurance. The conventional wisdom is that if you go to the doctor a lot, then you should get a Gold or Platinum plan that has lower out-of-pocket costs, while you should get a Bronze or Silver plan if you don’t. This theory works well when employers paid most of the premium, but in the model where an individual pays the whole premium, the conventional wisdom doesn’t hold. Even worse, the metal levels tell you nothing about the expected annual cost of healthcare. Since metal levels also are not an indication of quality of service, they have no purpose other than to confuse people.

In the rest of this post, I detail a brief study I conducted on a subset of the health insurance plans available in New York via New York’s Official Health Plan Marketplace. I also provide some advice on estimating your annual healthcare costs, which lays the groundwork for a web app I’ll introduce in part 3. Note that none of the examples are endorsements for a given plan and are provided for educational purposes only.

### Bounding Healthcare Costs

What exactly is the total cost of healthcare? I define this as being the net sum of premiums, doctor’s visits, medication, etc., up to the out-of-pocket limit. Note that none of the 66 health plans available on the exchange provide out-of-network coverage, so the below analysis assumes exclusively in-network care. This analysis is also based on a family with no children. For single individuals the cost will be lower, while for families the cost will be higher.

While each family’s total cost of healthcare will vary, there are some absolute lower and upper bounds to the cost that apply to everyone. The minimum anybody pays for healthcare will be their annualized premium (i.e. 12 * monthly premium). On the upper end, the maximum anybody will pay will be the annualized premium plus the out-of-pocket limit. Let’s see what this looks like across the various health plans (click to enlarge).

This chart shows the annual premium for each plan plus the total out-of-pocket costs. The plans are then sorted by max total cost. On the face of it, the fact that a Platinum plan has the lowest total cost supports the conventional wisdom. Yet on the other end, the two most expensive plans are Gold! We also find that there are Bronze plans that have upper bounds that are less than Gold plans, despite the higher out-of-pocket limit.

The reason this is the case is that premiums matter. A lot. On average, the premium accounts for 46% of the total cost. The actual amount varies by plan, where Platinum plans are in the 70% range while Bronze are in the upper 30s. Couple this with the fact that the upper limit to the out-of-pocket limit is mandated by Federal law [2], you can imagine that the lower the premium, then the lower the overall cost.

And yet the 9 cheapest (in maximum annual cost) are Gold and Platinum plans, which have significantly higher premiums. How can this be? The reason has to do with probability. Keep in mind that the probability of paying at least the annual minimum is 1, but the probability of paying the annual maximum is significantly less than 1. So the likelihood of you paying the annual maximum is relatively low, unless you suffer from major illness or disease.

### Modeling The Cost of Care

Now that we know the upper limit isn’t a good indicator of our expected annual healthcare cost, we need to look for something better. There are numerous ways to model this ranging in level of sophistication. I chose a simple analysis based on how I assumed others would think about healthcare: about how many times do I see the doctor and specialists? I’m assuming that for most people these are the primary contributors to healthcare costs. (A more thorough analysis would introduce additional factors.)

In this model it is easy to construct a cost surface based on the number of doctor visits and the number of specialist visits. The absolute minimum cost is again the annual premium. This is what it looks like for EmblemHealth’s Platinum plan, which has the lowest annual maximum cost.

To understand this graph, the surface represents the accrued cost of healthcare based on the number of doctor and specialist visits. If you don’t go to the doctor at all, then the cost is the minimum point on the graph, which is equal to the annualized premium. Notice how the cost flattens out once the out-of-pocket limit is reached. I discovered that it’s really only the Platinum plans that reach this limit. Obviously if you factor in hospital stays and non-trivial surgery, these limits would be hit very quickly. But then you wouldn’t need this analysis as you would just look at the annual maximum.

Now look at EmblemHealth’s Gold plan. With the same number of doctor visits, the out-of-pocket limit is not reached, yet the total cost is essentially the same. However, the premium for the Gold plan is $921.70 versus$1108.44 per month for the Platinum. Hence, with the Gold plan, you’ll likely save about $2000 per year unless something catastrophic happens. In this case, you’ll spend about$2000 more than if you had the Platinum plan.

Each provider and plan has a different surface, which is dependent on their cost structure, particularly whether there are co-pays in addition to coinsurance. Another factor is due to the number of possible paths of acquiring service. As the number of doctor and specialist visits increases, there are more possible scenarios. Consider a situation where you see the doctor once and s/he tells you to go see a specialist. You see that specialist 4 times and then follow up with your primary care physician. Now suppose you were already seeing a specialist, so you see the specialist 4 times, followed by a doctor’s visit. Then you have your annual physical. While each of these scenarios results in 4 specialist visits and 2 doctor visits, the amount applied to your deductible is different. Hence the boundary that defines when the deductible is met will be different for each run of the simulation. As an example, this is the Empire Blue Cross/Blue Shield Silver plan.

For comparison, here is one of Empire’s Gold plans, which has a flat rate for all primary care doctor visits, which doesn’t contribute to the deductible. The effect of this is that the surface is now deterministic (and smooth), meaning that the deductible is completely determined by the number of specialist visits. I return to this in the Methodology section below.

The lesson here is that based on strictly primary care and specialist visits, it is unlikely that the out-of-pocket limit will be met unless something catastrophic happens. For one final comparison, here is what a Bronze plan looks like. This is for Health Republic, a new non-profit co-op provider.

Again we see a tapering effect once the deductible is met. However the change is not as pronounced since the coinsurance is 40%. Ouch. But hold on — the minimum annual cost is significantly less, despite the faster growth rate. In fact you need to spend about $6000 versus the Gold plan above before you start feeling the pain. This means that if you’re relatively healthy and don’t take risks, you’ll likely be ahead of the game with a Bronze plan (which is consistent with conventional wisdom). In short, when it comes to estimating costs for Silver, Gold, and Platinum plans, a good rule of thumb is to use the sum of the annualized premium plus the deductible as an estimate of maximum annual healthcare costs. Here is how the plans look when sorted by this metric. According to this view, Gold plans are cheapest, followed by Silver. This means that if you are price-sensitive and relatively healthy, the optimal choice is Silver. This generalization doesn’t hold for Bronze plans because the coinsurance is too high to ignore. An additional caveat is that you have prescription medication or play sports that may take you to the hospital, then you need to look at those costs as a more significant factor. ### Methodology #### Plan selection I only included 39 out of 66 total plans in my analysis. Most of the plans I omitted were plans that included coverage for children or dental. I didn’t include these in order to make the comparison more equitable. I should mention that the MetroPlus plans include Dental and Vision, while the others do not. Here are two contingency tables that show the breakdown across levels as well as provider. > table(plans$plan.level)

Bronze     Gold Platinum   Silver
12       11        3       13


The selection of Platinum plans is not representative primarily because I, personally, am not planning on buying a Platinum plan. If anyone would like to see a more comprehensive analysis, feel free to sponsor more research.

> table(plans$provider, plans$plan.level)

Bronze Gold Platinum Silver
Affinity                          1    1        0      1
EmblemHealth                      1    1        1      1
Empire BlueCross/Blue Shield      3    1        1      2
Fidelis                           1    1        0      2
Health Republic                   1    2        0      3
HealthFirst                       1    1        0      1
MetroPlus                         1    1        0      1
Oscar                             3    2        1      2
UnitedHealthcare                  0    1        0      0


#### Cost of care

The cost of primary and specialist care varies widely. According to one article [3], the average doctor’s visit is $104, while another cites$158. Since I live in New York City, I used $150 for a primary care visit and$325 for specialist. This is codified in a lambda.r type.

Ledger(primary.cost=150, specialist.cost=325) %as% {
list(cost=0, deductible=0, primary.visits=0, primary.cost=primary.cost,
specialist.visits=0, specialist.cost=specialist.cost)
}


Data for each health insurance plan was sourced from NY’s online health exchange. Below is the implementation for determining the cost of each visit based on the previous visits.

add_visit('primary', ledger, plan) %as% {
if (! is.na(plan$primary.cost) && ledger$primary.visits <= plan$primary.limit) { cost <- plan$primary.cost
} else if (ledger$deductible <= plan$deductible.family) {
cost <- ledger$primary.cost ledger$deductible <- ledger$deductible + cost } else { cost <- ledger$primary.cost * plan$coinsurance.pct } ledger$cost <- c(ledger$cost, cost) ledger$primary.visits <- c(ledger$primary.visits, 1) ledger$specialist.visits <- c(ledger$specialist.visits, 0) ledger } add_visit('specialist', ledger, plan) %as% { if (ledger$deductible <= plan$deductible.family) { cost <- ledger$specialist.cost
ledger$deductible <- ledger$deductible + cost
} else {
if (is.na(plan$coinsurance.pct)) cost <- ledger$specialist.cost
else
cost <- ledger$specialist.cost * plan$coinsurance.pct
}
ledger$cost <- c(ledger$cost, cost)
ledger$primary.visits <- c(ledger$primary.visits, 0)
ledger$specialist.visits <- c(ledger$specialist.visits, 1)
ledger
}


Calculating the total cost is then simply a fold operation.

#### Sampling paths to create a surface

As mentioned above, as the number of visits increase, the number of ways to get to that particular combination of visits increases. The number of paths is defined by

$p = \left\{ \begin{array}{ll} m & \mbox{if } n = 0 \\ n & \mbox{if } m = 0 \\ mn + 1 & \mbox{otherwise} \end{array} \right.$

where $m$ is the number of doctor visits and $n$ is the number of specialist visits. Hence the point with the most paths is when there are 20 doctor visits and 20 specialist visits, with a total of 101 possible paths. Theoretically this shouldn’t be an issue and the surface should be smooth. However, in my implementation (and probably in the real-world), the crossing of the deductible is not necessarily exact. Hence a portion of a payment that theoretically should be discounted may not be discounted. This is why the surface gets lumpy once the cost exceeds the deductible. While I didn’t verify it, presumably the maximum deviation then is going to be based on the highest cost, or $c_{\mbox{specialist}} - 1 = 324$.

### Conclusion

As this post shows, it takes a fair amount of work to estimate healthcare costs. The main takeaway is that if you are healthy, a good way to estimate your annual maximum healthcare bill is to sum the annualized premium with the deductible. The cost savings over a few years will likely pay for any catastrophic healthcare, although this will be less valid the older you get. If you or your family require a lot of care, then you need to estimate the number of visits per year and whether you expect any hospital visits.

In part 3 of this series, I’ll unveil a web application that performs these calculations in the browser, so that it is easier to estimate your healthcare costs. If there is enough interest, I’ll add more factors into the model so that it is more precise.

### References

[1] How do I choose Marketplace insurance? Healthcare.gov. Visited 13 February, 2014.
[2] Out-of-pocket maximum/limit. Healthcare.gov. Visited 13 February, 2014.
[3] Doctor Visit Costs. Debt.org. Visited 14 February, 2014.
[4] Guide to understanding health care costs. Fallon Health. Visited 14 February, 2014.

# Why healthcare exchanges are not well-functioning markets

This is part 1/3 in my series on healthcare costs. The analysis is driven by my own needs as an entrepreneur to find affordable healthcare. Part 1 introduces the problem with health exchanges, part 2 addresses the issue of price transparency, and part 3 introduces a web app that estimates your annual healthcare costs.

Politicians like to believe that if you build a marketplace, then a market economy will manifest, delivering all its glorious benefits. What they don’t seem to acknowledge is that for markets to work they need to be well-functioning, which means that the market must satisfy (most) of the conditions of pure competition [1, 2]. If these conditions are not satisfied, then it becomes significantly less likely that the invisible hand of Adam Smith will manifest, nor will prices reach fair value. Some of the (ideal) conditions that must be met are:

• No barriers of entry and exit
• Perfect information
• Zero transaction costs
• Homogeneous products
• No externalities

In practice, perfect competition cannot be attained given idealized conditions, yet there are reasonable approximations. The foreign exchange markets are generally considered to be the closest approximation of perfect competition. However, in health exchanges none of the above conditions, even in their approximate form, are satisfied. If a market is not well-functioning, then you cannot expect prices to be fair. Hence the claim that bringing health insurance onto a marketplace will increase competition is only half-true. In the sense that there will be more sellers, competition has increased, yet this does not imply that prices will reach equilibrium. Let’s see why.

The first thing to notice is that there are many buyers and few sellers. This is because it is difficult to create an insurance company. Not only do you need a lot of capital, but you have to create a network of providers that will accept your insurance. When there are few sellers in a market, collusion and price fixing can occur. This happens surprisingly often in industries like airlines [3, 4], semiconductors [5], and even perfume [6]. When looking at the premiums of healthcare plans in the same metal level, it is surprising how close the prices are.

#### No barriers of entry and exit

The difficulty of creating an insurance company is clearly a high barrier to entry for sellers. The consequence is that a seller has the opportunity to unilaterally control prices since competition is limited. In financial terms, this is known as cornering the market. While not necessarily illegal, it can obviously cause price distortions, not to mention lead to antitrust cases. Another consequence is that poor-performing providers can stay in business due to the lack of competition. This means there is a disincentive to improve since revenue can be generated at a lower cost (due to lower spending on providing quality services).

What about buyers? In theory, anyone can enter a market to buy an insurance product with ease. Technology glitches notwithstanding, this is largely a non-issue for buyers, except in the area of transaction costs, which is discussed below.

#### Perfect information

By perfect information, all participants (both buyers and sellers) are supposed to have full knowledge of the price, utility, quality, etc. of the products [7, 8]. It is very difficult to know the total cost of healthcare based on the premium, deductible, and the out-of-pocket limit alone. So despite there being transparent price in terms of the components of a plan, there is no price transparency when it comes to all the factors driving the total cost of the plan. This is like buying a car based on the price of the tires. In order to know the true cost of your health insurance not only do you have to factor in the premium, the deductible, the copay and/or coinsurance, medication, etc., you also need to estimate the quantity and cost of medical services required per annum. For the average individual this exercise by itself is quite challenging. The only people who really have a good sense of the total cost of healthcare are the health insurance companies themselves. This observation alone shows that information is asymmetric in the market since the sellers have a clear advantage of information over the buyers. The unfair playing field in health insurance is no less egregious than insider trading in finance.

#### No externalities

An externality is any cost or benefit unintentionally incurred by a third party based on a given activity [9]. For healthcare this takes the form of the cost of service for medical providers. Depending on whether your doctor is in-network or out-of-network in a given plan affects the price that they will charge you. The same is true if you are uninsured [10]. Hence, for the same service and same doctor, the cost of service can vary dramatically. The fact that these prices are opaque means that it is difficult for the cost of medical services to find equilibrium. With health insurance being derived from the cost of services, how can insurance prices possibly be transparent? This is analogous to buying an option on an equity without knowing the value of the underlying stock (startups, anyone?).

In another sense, health insurance can be seen to rely on a different externality: the composition of participants affects everyone’s rates. This is codified in the desire to get as many young, healthy people on the exchange so they can subsidize the cost of the elderly and the sick [11]. Hence, for the same insurance plan, your cost of insurance could go up (down) if other people became sicker (healthier).

#### Zero transaction costs

What happens when you want to switch plans? Any money spent towards the deductible is lost. Similarly most plans don’t prorate the deductible based on when you sign up. So there is a significant transaction cost to switching, implying that there is a disincentive to switch, which reduces the effects of competition. Compare this to auto insurance or home insurance where it is easy to switch at any time and any premium paid is refunded at a prorated amount.

#### Homogeneous products

When all products are the same, the product itself becomes fungible. It doesn’t matter which specific product you receive since they are identical. While an individual insurance plan is the same (think same plan, different policy number), they are not fungible across plans since plan details are different. This is similar to how cars are sold in broad categories like luxury, sedan, SUV. To know whether or not you’re getting a good deal requires a lot of research and also knowing the total cost of ownership of the car. One aspect of car buying is that people are generally not rational because there is a large emotional component to automobile purchases. This is not necessarily a bad thing and partially justifies a heterogenous market (since people value the emotion differently). In terms of health insurance, it is unlikely that anyone is going to get excited and have an emotional attachment to a platinum plan.

### Conclusion

While it may not be necessary for health exchanges to meet all the conditions of a well-functioning market, it is important to understand the implications of not meeting the conditions. Certain externalities and barriers to entry are probably desirable, but other conditions, such as access to information, need to be improved. Only then can prices begin to reflect the true cost of healthcare and resources allocated efficiently. What is needed is a method to distill the total cost of healthcare down to a single number. This number should represent the best estimate of the cost of healthcare for an individual or family based on each of the plans available. Then it will finally be possible to reliably compare plans.

In part 2, I show how to estimate the annual cost of healthcare based on numerous plans available on the NY Health Exchange. While the examples are specific, the lessons are broadly applicable to anyone looking at health insurance.

### References

[1] Perfect competition. Wikipedia. Visited 14 February, 2014.
[2] Perfect competition. The Economist. Visited 14 February, 2014.
[3] Swiss commission fines airlines for price-fixing. swissinfo.ch. Visited 14 February, 2014.
[4] British Airways fined £58.5m for fuel price-fixing. Visited 14 February, 2014.
[5] Semiconductor Execs Indicted for DRAM Price Fixing. PC World. Visited 14 February, 2014.
[6] Perfume giants fined 40 mn euros for price fixing. Fashion Mag. Visited 14 February, 2014.
[7] Information. Econlib. Visited 14 February, 2014.
[8] Imperfect Information. EconPort. Visited 14 February, 2014.
[9] Externality. Wikipedia. Visited 15 February, 2014.
[10] How to Get Health Care While Uninsured. The Billfold. Visited 14 February, 2014.
[11] Obamacare enrollment push for the young enters 11th hour. Reuters. Visited 15 February, 2014.

# A desert motif in ice

This last shoot in this series is located at 4 Mile Point, part of Scenic Hudson’s conservation project. It’s a modest parcel of land but has nice river access. While taking all these photos of the ice floes, it occurred to me that the barrenness of the landscape is reminiscent of the desert landscape. I thought it would be interesting to explore this idea a bit.

### The desert motif

One aspect of the desert motif is the blinding and unrelenting sun overhead. Coupled with an endless barren landscape, the isolation can be awe-inspiring.

Another element of the desert motif that reinforces the feeling of isolation and solitude is the lone tree. Here’s my take.

Perhaps there was life here once, but now…

### The cargo ship as freight train

Just as the railroads cut through these barren places, the cargo ships along the Hudson can be imagined serving a similar purpose. To the right is the same ship from earlier. Clearly these ships cannot move particularly fast as they cut through the ice.

While standing on the ice, I took a video of the barge and tug breaking up the ice. I love the sound of the ice cracking and breaking. It’s not like a glacier calving, which sounds like a gunshot. This is more of a long, resonant vibration, like a whip cracking in slow motion. As the ship pushed the ice to the side, you could hear the sound of the crack moving through the ice. It was a bit exhilarating, particularly since I was standing on the ice, and the crack was heading towards me!

### Studies of bark, ice, and moss

Wrapping up these pictures, I present a mini study of the trees along the bank. What’s fascinating is that every possible ice formation can be found along the bank, from large sheets, to thin, crystalline patterns, to icicles, to perfectly formed crystal-clear blocks.

I guess as the tide pushes up the ice, some of it gets lodged in strange places, like in exposed tree roots. Here you can also see some dormant moss, waiting for a dash of liquid moisture to rejuvenate.

If I recall, this is a particular species of maple tree that has the multi-colored peeling bark. I love the texture and juxtaposition with the ice.

# Sunrise in Athens overlooking an icy Hudson

Tags

Athens is a quaint village just north of the Rip Van Winkle Bridge and across the river from Hudson, NY. At one time there was a fierce rivalry between the two, which is hard to imagine given that Athens doesn’t seem like much more than a hamlet, whereas Hudson is clearly a city of industry. At any rate what I like about Athens (and the west bank of the Hudson) is direct river access. This means great river views and a good perspective. I managed to get to Athens in time for a leisurely sunrise with ambient temperature being about 10F. Nothing like working with cold gear, but at least the batteries lasted longer than when I took pictures in Fairbanks, AK circa -40F. Nothing like freezing virtually your whole body off and discovering that your fully charged battery has drained in the 10 minutes you were setting up the tripod.

The goal of this shoot was to get the Athens lighthouse in the rays of sunrise. Unfortunately I discovered that its location makes it a poor candidate for morning shots, so I had to scrounge for other subjects. Thankfully the Hudson didn’t disappoint. First up is the sun illuminating a wide band of stratus-looking clouds.

Off in the distance you can see some steam rising off the open parts of the river. The sun was generous enough to illuminate the steam, giving it a nice mystical quality.

With the lighthouse off limits, my other goal was to catch an icebreaker. Thankfully as I set up, I started hearing one approaching. I managed to get a shot as it went through the open water with the steam. Neat!

Closer to shore, you can see some weathered and now frozen pier posts. Way off in the distance is the Athens lighthouse, which is more or less a modified brick Italianate.

The glow of sunrise gave everything a pinkish hue. Here’s a nice Federal style brick home and tree that pick it up rather nicely. In fact I was astonished how the otherwise drab, brown, leafless shrubs lit up in the morning sun.

# Hudson River fire and ice sunset

These pictures are from the Rip Van Winkle Bridge, which connects two of the most prominent artists from the 19th Century Hudson River School. This shot is facing southeast looking at the Catksills. To the east (west of frame) is Olana, the Persian inspired mansion of Frederic Church. His mentor and founder of the Hudson River School is Thomas Cole, whose more modest home, Cedar Grove, is to the right, on the west side of the Hudson. These early American painters considered the beauty of the Hudson “as a special gift from God” and were awed by the “‘divine architecture’ they beheld in the mountains, hollows, and waters of the valley” [1].

While the Catskills are certainly not the most majestic nor awe-inspiring mountains, their grandeur is in the composition and lighting that makes this area truly remarkable. When I took these shots I already had taken numerous photos, but as I looked back, the colors had gotten even more intense, so I decided it was worth freezing fingers for a bit longer to get an even better crop of colors.

These two pictures are of an orchard with the sunset providing a backdrop.

Power lines in the distance. The sunset pretty much covered the whole sky.

Here’s a wider angle shot with the part of the bridge in view. As it got later, the sky looked like a nebula in some distant galaxy.

### References

[1] Howat, John K. The Hudson River and Its Painters. American Legacy Press. 1983.

Tags

The American Dream is a vision of prosperity fueled by opportunity. In America everyone is to have equal opportunity so that the dream is achievable by all. The dream is sweetest when someone is self-made as we love the rags-to-riches story. We look fondly at the self-made billionaires but look with disdain at those that seem to squander their opportunity or require extraordinary assistance. It is as though they were somehow less American because they have special needs. Having worked in startups and finance my whole professional career, I’m here to tell you that the self-made are also given extraordinary assistance. In fact those most fortunate are granted numerous forms of support and assistance far more valuable than the supports given to disadvantaged people. Injustice notwithstanding, I will outline a vision for appropriating this model, thus creating equal access to opportunity for those who need it most.

### Being an entrepreneur in the land of startups

All of these services are considered investments in people that the startup community believes have a high chance of success. These folks become the darlings of the industry and everyone wants to join in to get a piece of the money pie. You see it in the later rounds of financing where massive Series D equity raises blast valuations past a billion dollars in the attempt to reach an IPO. It’s easy to picture a wave of humans (and capital) creating a high tide lifting these folks to startup success. In essence all these hands are there so that founders can focus on execution as efficiently as possible.

### How to start a hedge fund

You can be forgiven for thinking that the world of hedge funds is different from startups and venture capital. They are actually quite similar from the perspective that they are both alternative investments fueled by investors (usually) looking for outsized returns and the founders generally obtain star-like status in a winner-takes-all business model. Getting into the hedge fund business has similar (if not more stringent) hoops that requires a long track record of being at the top such as attending elite schools, holding elite degrees, working elite jobs, having elite friends, etc. (The system is not perfect as there are always outliers ) Once you are in your odds of success increase dramatically as you are surrounded by the crème de la crème. Hence the network effect works in your favor when you are ready to strike out on your own.

### Wraparound services for all

Success is a wily creature and even with all these supports, few startups and hedge funds achieve write-home success. It’s not the end of the world as it’s generally recognized that this experience improves chances next time around. In fact it can often be easier to raise money the next time because of the belief that with failures behind you, there’s a higher chance of success this time (we’ll set aside the validity of such thinking).

The lessons here are many-fold and paves the way for helping disadvantaged communities. I am involved/exposed to both the autistic community as well as the community of youth in foster care. In both of these populations there is an unfortunate dichotomy between perception and reality. Many feel that these communities are somehow comprised of lesser people. In their minds expectations are so low that success seems to be defined merely as subsistence. Some see them as failures that are exempt from the American Dream. Success has been relegated to having a job and an apartment but says nothing about self-determination.

Yet what I’ve found are innumerable passionate and talented people looking for a chance to have their voice heard and given the opportunity to live their life how they see fit. One must ask why those most fortunate are given tremendous support and encouragement, while those most disadvantaged are given few supports and relieved of opportunity? Why shouldn’t these people be given the opportunity to follow their passions and do what they do best? It is hard enough starting a business, but imagine starting a business when you are artistically gifted but social interaction and the rules of negotiation is a dangerous game of treacherous anxiety. Imagine starting a business when you are exceptionally eloquent in writing but cannot speak. Imagine starting a business when you have the passion to change the system but struggle to secure housing.

Now imagine if these communities were given the same opportunities that those in startups and hedge funds are given. Imagine providing wraparound services so that talented autistics or foster youth aging out of care can focus on their passions. Imagine what is possible when the burden of accounting, negotiation, contracts, health insurance, etc are taken away. Self-determination and not subsistence must be the goal. Let’s start giving disadvantaged people an equal footing to make a mark for themselves in this world.

For those interested in this vision, I am collaborating with others in the autistic community to explore the viability of an organization that can provide the necessary wraparound services to help disadvantaged people achieve true independence through self-determination. Please get in touch (twitter: @cartesianfaith) and let me know how you would like to get involved.

# Views of Manhattan from the icy Hudson

Tags

After nearly getting frostbite yesterday in Central Park, I decided that it was so much fun I should find somewhere else to partially freeze my metacarpals. Today it was the George Washington Bridge, which I’ve wanted to walk over for quite a while. Since the cold weather has brought back the lovely ice floes on the Hudson, I couldn’t resist braving the elements for some choice photos.

### Manhattan

First let’s look straight down the Hudson to get some perspective. This is looking south, so Manhattan is on the left, Jersey City is in the upper right corner, and Hoboken is to the right of the frame.

Don’t fret, I took a dedicated picture of Hoboken!

Here’s a nice shot of a big sheet of ice with the skyline behind it. Mind you these guys were moving at a healthy clip, so it was a bit of a challenge getting them in focus with the bridge shaking from the vehicle traffic behind me.

I think this is the Freedom Tower poking up in the background, with a barge in the river.

Here’s the Empire State Building looking stately as usual.

This barge will make another appearance later. I wondered how these ships navigate the ice, but I don’t think it’s thick enough to really be an issue.

### The Last Lighthouse

The Little Red Lighthouse nestled beside the George Washington Bridge has a storied history. Usually the pictures you see are from sea level, so I thought it might be fun to look at it from above when it’s shrouded in ice.

First is a view of the bridge and (gasp) Hoboken to provide some perspective.

Looking down from here you can see the lighthouse along with the chunks of ice flowing by.

It’s easy to appreciate the scale of the ice with the size of the lighthouse used as perspective.

### Ice Floes As Micro Terrain

As a final part of this study, I took a number of close-ups of the ice floes. I have to admit that I love taking pictures of ice. Farther up the Hudson there are places where you can get to the water and just observe the floes. The best part is that the tranquility is broken up by creaks and pops as the ice pushes against each other, moving up and over, or sometimes just smooshing together. It is as though you get to watch plate tectonics move on a human scale. I’ll post these without comment as the textures and geometry speak for themselves.

As promised, here is the barge from earlier, making its way through the ice. I noticed that in general their path was to maneuver around the ice. I suppose that’s the prudent thing to do and must be a bit like a video game.

# Snow day in Central Park (with critters)

Tags

There’s nothing like a fresh blanket of snow to enhance the drabness of New York in winter. With cold temps helping the snow to stay put, I thought today would be a good day to play with my old telephoto that I attached to my new camera. Here are the results.

### Winterscapes

These pictures are around The Lake in Central Park, which is on the west side of the park in the mid 70s. This first photograph is looking west with some high-rise cat-tails swaying in the foreground.

Slightly north of the first shot, here you can see the lake in a partially frozen state. Nobody was skating on thin ice today.

This is looking south, towards the Bethesda Fountain. This rustic bench is reminiscent of the benches that Frederic Church designed, although this one might be nominally more comfortable.

Here’s the bench again with Bow Bridge as the backdrop. The patterns in the shadows are quite something.

This looks down to the lake near the Ramble Stone Arch. I particularly like this picture as the lens flare and diffuse light really captures the blinding glare that actually blurred the view a bit.

Here’s one final shot looking southeast from the Bank Rock Bay.

### Critters

Plenty of birds were enjoying the sunshine, although some proved to be rather elusive. I usually see robins pecking away at the ground hunting worms. In this weather they seemed resigned to nibbling on berries in the trees. I wonder if Robins start craving worms this time of year?

Most people were looking to spot cardinals, which admittedly are always a joy to find. However, the ratio of sparrows to cardinals is easily 15 to 1. It wasn’t until I tracked them for a bit that I found their hideout near the water. I stood still for way too long and was able to capture some nice close-ups.

I like this cardinal’s face, because it looks like he’s Lucha Libre.

It turns out that the squirrels were enjoying the sun just as much as the birds (and the humans). I actually saw three squirrels come out and go back into this knot in the tree.

I imagine that during a snow storm it must be nice and toasty inside the trunk. A fellow photographer informed me that the ones less fortunate have to settle for shantys made of leaves on the branches of the trees. Hopefully they don’t have to go around looking for spare nuts.

The most elusive bird today was the blue jay. The nice thing about jays is that once you hear one, it’s pretty easy to spot it. I guess that’s the silver lining to them being territorial bullies. Oddly enough this fella was awfully quiet and basically sat still, surveying the landscape.

I’ll round out the lot with some more pictures of cardinals. It turns out that they seem to be friends with or at least tolerate sparrows quite a bit.

This last one is of a lady cardinal on the bank of the lake. My guess is that they were looking for fallen berries. Presumably it’s easier to forage on the rock rather than in the snow.

# Generating artificial plants using stochastic Lindenmayer systems with d3.js

In a previous post I wrote about iterative function systems and how to generate fractals. This approach used matrices that represented lines via a set of points. An alternative approach is to use a grammar defined by a set of production rules to iteratively replace a prior string. Systems that use re-write rules of this sort for simulating plant growth are known as Lindenmayer systems (L-systems for short). It turns out that there is a deep connection with grammars defined for human language as well as with RNA processes. With L-systems, lines can be drawn directly as each token in the grammar can represent a drawing command. Here is an archetypical L-system [1].

L-systems are essentially composed of two things: an initial state (the axiom) and a set of production rules (the grammar). With this it is possible to create arbitrarily long sequences of characters with remarkable complexity. The iterative nature of the process means that the productions are self-similar and hence possess a fractal nature. Here is one of the simplest L-systems which models the growth of algae:

$\mbox{axiom}: a$
$\mbox{rules}: a \Rightarrow ab, b \Rightarrow a$

Successive iterations result in this pattern:

$ab$
$aba$
$abaaab$
$abaababa$

There are numerous implementations for L-systems, but as is typically the case they follow an imperative algorithmic style. While not inherently bad, these types of algorithms are unnecessarily complicated. Simulations are usually iterative, so it makes sense to explore an algorithm using a functional programming style.

function dol_step(init, rules) {
var iterate = function(acc, x) {
var p = rules[x]
if (p == undefined) { p = x }
p.split('').map(function(a) { acc.push(a) })
return acc
}
return init.reduce(iterate, [])
}

function lsystem(n, init, rules, step_fn) {
if (typeof step_fn === 'undefined') step_fn = dol_step
return seq(n).reduce(function(acc) { return step_fn(acc, rules) }, init)
}


What’s nice about this algorithm is that there are no array indices to track nor loops to worry about. It’s also easy to understand since it only uses the canonical higher-order functions. This code is executed like so: lsystem(4, ['a'], { a:'ab', b:'a' }).

### Visualization

Productions are nice, but they are difficult to appreciate. Particularly when additional tokens are added to the grammar. Visualizing the L-system requires a function that knows how to translate the production into drawing commands. Drawing commands are interpreted as “Turtle” commands in the sense of the Logo programming language [2]. The turtle can move forward in a straight line and also change direction, or heading. For many simulated plants there is a somewhat standard grammar used, which includes

F: Move forward (and draw a line)
+: Rotate left
-: Rotate right
[: Push current state onto a stack
]: Pop stack and replace current state

The stack is used for essentially picking up the turtle and putting it somewhere else on the board. As an aside, notice that commands are reminiscent of a Turing machine!

By visualizing the structure, it is easier to see how iterative applications of the grammar produce self-similar results. Here are steps 2, 3, and 4 of the system defined by a single production rule

$\mbox{axiom}: F$
$\mbox{rules}: F \Rightarrow FF-[-F+F+F]+[+F-F-F]$

Like the derivation of a system, this process is also iterative since the drawing begins with the left-most character in the sequence and then proceeds over the rest of the sequence. Recognizing this behavior points to a fold/reduce process that takes a sequence and yields a single result. In our case the single result is the accumulated turtle state necessary for drawing. The reason we do this is that the output will be an SVG path that we’ll draw using d3.js. Using SVG is perfectly suited, since the path commands behave just like a turtle.

function plant(length, theta) {
if (typeof theta === 'undefined') theta = -25 * Math.PI / 180
return function(acc, code) {
switch (code) {
case 'X': break
case 'F':
acc.state.x -= length * Math.cos(acc.state.theta)
acc.state.y -= length * Math.sin(acc.state.theta)
acc.svg.push("L" + acc.state.x + "," + acc.state.y)
break

case '+':
acc.state.theta += theta
break

case '-':
acc.state.theta -= theta
break

case '[':
acc.stack.push(\$.extend({}, acc.state))
break

case ']':
acc.state = acc.stack.pop()
acc.svg.push("M" + acc.state.x + "," + acc.state.y)
break
}
return acc
}
}


In this function each token of the grammar is associated with a turtle command. Only some result in actual SVG path instructions. Manipulating the state via a stack enables branching patterns to form. The mechanics of this process is really no different from the moveto command in SVG paths.

There’s another class of examples that use an unmentioned token in the grammar. These are node-replacement models, where nodes are defined by an X character. In the above drawings, each line drawing command is effectively an edge in a graph. So an F represents the edge. The grammar then defines how to replace the edge with a new string. This is known as edge-replacement. With node-replacement, the grammar defines rules for replacing the nodes X. The replacement strings contain instructions for drawing edges (an F), but edges are only replicated to provide additional length (but no structure). In the rendering of the system the nodes are ignored.

For those following along in code, the rendering code is the following. Note that there isn’t much work here. The d3.js part is simply drawing the path we constructed via the handler.

function linit(x,y) {
var state = { x:x, y:y, theta:Math.PI/2 }
var svg = [ "M" + x + "," + y ]
return { state:state, svg:svg, stack:[] }
}

function ldraw(state, target) {
if (typeof target === 'undefined') target = "#svg"
d3.select(target)
.append("path")
.attr("stroke","black")
.attr("stroke-width",3)
.attr("fill","none")
.attr("d", state.svg.join(" "))
}

function lrender(origin, sequence, handler) {
var state = linit(origin.x, origin.y)
state = sequence.reduce(handler, state)
ldraw(state)
return state
}


### Stochastic L-systems

The power of Lindenmayer systems is readily apparent, but in a large group, the deterministic regularity puts these artificial plants squarely in the uncanny valley. One way to address this is by using a stochastic L-system. Here each production rule is replaced with a set of productions with a corresponding probability for each.

In the code below I provide two representations of probabilities. If you want uniform probabilities, then use an array for the production rules. Otherwise, use a hash where the rule is the key and the explicit probability is the value. Hence, the following two grammars are (essentially) equivalent:

{F: ['F[+F]F[-F]F', 'F[+F]F', 'F[-F]F'] } {F: {'F[+F]F[-F]F':.33, 'F[+F]F':.33, 'F[-F]F':.34} }

The implementation for the stochastic L-system is a bit more involved. Only the single step function needs an implementation as the remainder is handled by the existing machinery. Another way of saying this is that with first-class functions it is trivial to swap one step implementation with another, without modifying any of the other code.

function sol_step(init, rules) {
var get_production = function(x) {
var rule = rules[x]
if (rule == undefined) { return x }
if (rule instanceof Array) {
var vs = rule
var ps = cumsum(rep(1/rule.length, rule.length))
} else {
var vs = Object.keys(rule)
var ps = cumsum(vs.map(function(v) { return rule[v] }))
}
return sample(vs, 1, ps)[0]
}
var iterate = function(acc, x) {
var p = get_production(x)
p.split('').map(function(a) { acc.push(a) })
return acc
}
return init.reduce(iterate, [])
}


The main difference is that there is a distinct function for extracting the probabilities. For those familiar with R, I ported some functions to work with vectors and sampling, which provides vectorization semantics to Javascript. These functions are in a separate library called arbitrage.js. A separate post on that is forthcoming.

Stochastic L-systems open the door to a whole other avenue of exploration. The RNA connection I mentioned at the beginning of the article is really the inverse problem. In this formulation you are given the derivation that represents an end state and need to find the axiom that produced it. This problem is characterized by a stochastic context-free grammar, of which there are numerous algorithms that solve this problem. I have some ideas on applying Church numerals to this problem and will write more later.

### References

[1] P. Prusinkiewicz and Aristid Lindenmayer. 1990. The Algorithmic Beauty of Plants. Springer-Verlag New York, Inc., New York, NY, USA.
[2] Wikipedia, Logo Programming Language