# Beliefs and JavaScript types

In JavaScript there are[^6n1ppt4m8ot] five primitive types: null, undefined, number, string, and boolean. I think it'd be fun to go through each of them and ask what it'd look like for a belief to have the associated type.

Boolean
=======

In casual conversation, people often talk about beliefs as if they have a type of boolean.

For example, Alice may say, "Carol, you're gonna like this new pizza place." But Bob might counter with "I disagree. I don't think Carol will like the new pizza place." In this example, Alice is basically assigning a value of `true` to the belief whereas Bob is assigning a value of `false`.

Beliefs that are typed as booleans often lead to unproductive debates. Continuing with the pizza example, Alice and Bob might have an exchange where Alice tries to convince Bob that he should assign a value of `true` to the belief whereas Bob might try to convince Alice that she should assign a value of `false`.

Number
======

When beliefs are typed as numbers, this debate is often more productive. Imagine that, instead of assigning a value of `true` to the belief, Alice assigns a value of `80`. As in "I think there's an 80% chance that Carol likes the new pizza place."[^ttdh02pt21] Similarly, imagine that for Bob, instead of assigning a value of `false`, he assigns a value of `35`.

Lots of wonderful things happen when you do this. Going through all of them would be beyond the scope of this post (and beyond the scope of my knowledge), but one of the wonderful things that happens is that it becomes clear how strong the disagreement actually is. When we were stuck on `true` and `false` it might seem like Alice and Bob are pretty far from agreeing with one another, but at `80` and `35`, I dunno, it doesn't feel like there's such a huge gap. Bob in particular is only 15 percentage points away from "flipping".

Another great thing about typing our beliefs as numbers is that it opens the door to [updating them incrementally](https://www.lesswrong.com/posts/627DZcvme7nLDrbZu/update-yourself-incrementally).[^ea2ch9olhvg] Maybe Bob makes a good argument, pointing out that Carol tends to prefer strong and complex flavors in her food. And maybe this argument decrements Alice's value of `80` down to `70`. With a boolean type, Bob's argument wouldn't have been enough to "flip" Alice from `true` to `false` and we wouldn't really notice a change. On the other hand, with a numeric type, Alice was able to update.[^zocz3rbs8gg]

I'm tempted to ramble more about the benefits of typing beliefs as numbers. Another benefit that I'm especially fond of is that numeric beliefs allow you [calibrate your confidence](https://www.lesswrong.com/w/calibration). Like, if you notice yourself only being correct 75% of the time when you say you're 95% confident, you know you need to adjust. But I don't want this post to focus too much on numeric beliefs, so let's move on.

String
======

(To the non-programmers out there, "string" basically means "text", or "a string of characters".)

It's funny, I am as big a proponent of numeric beliefs as anyone, but sometimes I struggle to come up with a numeric value. Actually, no. Not "sometimes". *Often times*.

This bothers me. It probably shouldn't, but it does.

Here's an example. A few months ago a friend texted me the following picture and said it was Jack Black.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/e87884ba3ff2b1ff3fa9bdfd76a87a5372fb603989f37836.png)

I called bull shit! How did my friend know that it was Jack Black? Isn't the prior probability really low? How can you be so confident in your ability to recognize Jack Black? Don't celebrities want to avoid being seen in public? Why would Jack Black be walking around in a run-of-the-mill suburban neighborhood?

Then my friend asked me if I wanted to bet.

Dammit. I know I'm supposed to want to bet, and that I should be able to [putanumonit](https://putanumonit.com/). But it's hard. I couldn't figure out a number. I felt good about it being less than 50% and more than 1 in 100,000, but 1 in 10,000 didn't feel crazy, and neither did 20%.

Really, I wanted my belief to be more qualitative. Something like, "I think it's pretty unlikely but not crazy unlikely".

Anyway, he proposed I give him 2-to-1 odds, I took the bet, and I [lost](https://www.dailymail.co.uk/tvshowbiz/article-13728763/Jack-Black-Tenacious-D-Kyle-Gass-Trump-shooting.html).

I'm not sure what to think about typing your beliefs as strings. Describing your confidence qualitatively rather than quantitatively feels to me like it is often pragmatic and that it gives you basically the same benefits that you get with numeric beliefs. And maybe things beyond a qualitative description of confidence would make sense. I haven't thought about typing your beliefs as strings very deeply and would love to hear what others think.

Null
====

In programming, `null` basically means "empty".

Imagine I was building [Prediction Book](https://predictionbook.com) or something and had an input field where users can enter their confidence in some prediction (as a numeric value from 0 to 100). Before they type something into the input field I might do something like `let confidence = null;`. I'm saying that `confidence` is a variable but that it is currently empty. It doesn't have a value right now.

Does this make sense to do in real life? If my friend asked me how likely I think it is that the person he saw is Jack Black, would it be at all valid for me to say "I just don't know"? Not even "Here's my low confidence best numerical guess" or "Here's a qualitative description of how confident I feel" or even "If I had to say true or false, I'd say false". Would it be valid for me to me to tell my friend that the state of my belief is `null`?

I guess we'd have to dig more deeply into what "valid" means and what, specifically, it is that I'm asking. Let me take a stab at that.

To start, I'd conceptualize "belief" as [anticipated experiences](https://www.lesswrong.com/posts/a7n8GdKiAZRX86T5A/making-beliefs-pay-rent-in-anticipated-experiences). In this example, hypothetically, if my friend walked up to the guy, asked him for his wallet, and looked at the name on the driver's license, what would I expect to see? How strong of an expectation does my brain have that it would say "Jack Black"?

I guess this kinda becomes a question of cognitive psychology. My model is that your brain will always have some sort of probabilistic expectation in these sorts of situations. This expectation might be hard to put your finger on and describe, but I think it's always *there.*[^x9iwjm7u06]

Then again, maybe I'm wrong. I'm thinking back to the [discussion](https://www.lesswrong.com/posts/FuzskJKAMHaJhmq4F/do-you-have-an-internal-monologue) about how not everyone has an internal monologue.

*I* always have an internal monologue, and the idea that some people just don't have a voice in their head for periods of time is really weird to me. Before the discussion I would have been pretty confident that (basically) everyone always has an internal monologue. But since then I've learned that individual differences are larger than I intuitively expect, so I am not too confident that everyone really does always have some sort of experience that they probabilistically anticipate. Maybe some people kinda draw a blank and really do just have null beliefs.

Ok, now let me approach this question of whether it's valid to have null beliefs from a different angle. I'm thinking about [Keep Your Identity Small](https://www.paulgraham.com/identity.html) and [Hold Off On Proposing Solutions](https://www.lesswrong.com/posts/uHYYA32CKgKT3FagE/hold-off-on-proposing-solutions).

If we were perfect Bayesians, assigning a value to our belief wouldn't have any downsides. That belief would be our prior and when we encounter new data we'd just effortlessly update according to Bayes Rule and arrive at our posterior.

In reality we're not perfect Bayesians. We're [boundedly rational](https://www.lesswrong.com/w/bounded-rationality) and need to deal with the constraints that our monkey brains impose on us. The two blog posts mentioned above[^ugw1t02vj7b] discuss it in more detail, but basically, when we assign a value to a belief, we tend to be a little stuck and anchored to that value. So for epistemic reasons[^f4w1nkbuwzs], at least for our stated belief, maybe we shouldn't shy away from utilizing `null`.

Undefined
=========

The difference between `null` and `undefined` is a little subtle and probably not very important. In my experience it's usually relegated to coding bootcamp lectures and phone screens performed by recruiters looking for 20 years of AngularJS experience. On the other hand, maybe it is important.

Both `null` and `undefined` are a type of empty value. But, conceptually, with `null` you're intentionally declaring something as empty whereas with `undefined` it's moreso that you never really thought about it before, and so by default we decide it's empty.

Consider those gross "would you rather" questions that people would ask as a kid. Would you rather do Incredibly Gross Thing A or Horrifically Disgusting Thing B? I think I'm usually worse off for even having had this question posed to me, so I'd rather my belief be `undefined` than `null` here.

Thinking about the space of all possible questions, it's a very large space, so I guess you can say that a very, very high percentage of our beliefs are `undefined`.

Postscript: beyond primitive values
===================================

One time a different friend asked me what percentage of time I think, in the NFL, a play ends with some player celebrating.

I wasn't sure what to say. I watch a fair amount of football, but I still felt like I just had no clue. Is it 80%? 15%? 5%? I wasn't really sure and it didn't really feel right to name a number.[^b1j9332wedq]

Why didn't it feel right to name a number? I think it's because that number doesn't tell enough of the story. Namely, it doesn't capture the fact that I have a very wide confidence interval.

I'd have felt more comfortable drawing a graph. A graph showing that I'm A% sure it's between 0% and 10%, B% sure it's between 10% and 20%, C% sure it's between 20% and 30%, so on and so forth. In JavaScript that might look something like this:

    let probabilityOfCelebration = {
      zeroToTenPercent: 5,
      tenToTwentyPercent: 20,
      ...
    };

The value here is something called an object and an object is basically a collection of other named values (for our purposes anyway). When typing your beliefs, sometimes primitive values don't cut it and you need the sort of nuance that an object provides.

[^6n1ppt4m8ot]: Dammit, it looks like there are actually seven now. When I learned about primitive types there were only five. Let's pretend that there are only five; bigint and symbol don't really fit well into this post. All models are wrong, some are useful. 

[^ttdh02pt21]: Well, if you're cool this number is supposed to range from 0 to 1. Exclusive, of course. 

[^ea2ch9olhvg]: In Superforecasting they found this sort of thing to be very important. 

[^zocz3rbs8gg]: There is some nuance to this. I think that even when people type their beliefs as a boolean, updating still happens. I guess you can say that there is metadata associated with the boolean, and this metadata is typed as a number and is where the updating happens. But I think that making the metadata the actual data is helpful. 

[^x9iwjm7u06]: Note that "your brain's" expectation can be different from "your expectation". I'm thinking about the idea of Belief in Belief. If you say you believe in Bigfoot but you don't actually anticipate having any experiences that one would associate with Bigfoot existing, maybe you just believe you believe in Bigfoot. Along these lines, I definitely think one can believe that their belief is null. 

[^ugw1t02vj7b]: Along with many other blog posts and books and stuff. 

[^f4w1nkbuwzs]: We could also explore other considerations. For example, beyond epistemic reasons, there are also social things to consider. Assigning a value to a belief too early on in a conversation is off-putting to some people for reasons that I'm too autistic to easily describe. Can someone else elaborate on this? 

[^b1j9332wedq]: I did anyway. My guess was 15%.