On Voting

Portuguese presidential elections are going to happen soon and this lead me to reflect (again) on the value of voting and of being engaged with national politics.

I have an aversion of having to keep up with what’s new on national news in general and national politics in particular – things move so fast that keeping up with it would be too stressful. But with the presidential elections coming in, I felt motivated to be an exemplar citizen and do a thorough research about all the candidates so that I could make an informed decision on who to vote for. And then publicly share everything in a blog post!

Yeah, that didn’t happen, for a number of reasons. But a lot went through my mind while struggling to do it.

Your vote is useless

First of all, it’s hard to shake the felling that the chance of your vote swinging an election is pretty much 0%. You’re spending all this time and energy doing complicated research, and for what? Even if you end up making the best possible decision on who to vote for, all your work has 0 impact. 

In an 80000 Hours article, Robert Wiblin uses expected value calculations to argue that it’s worth to vote. But since I know that I’m not going to swing an election (like I know that I’m not going to win the lottery) I feel I would be a victim of Pascal’s mugging if I accepted those arguments.1 

Having said this, if you have an audience (i.e. you have a popular blog, podcast, etc), you sharing your research and opinion might influence other people to vote in the same way as you do, making the resources spent on research a little more worth it. But then there’s the fact that your audience probably already has views aligned with yours: that’s why they’re your audience. But I agree that this line of argument has value, and if you’re going to do the research, might as well share it.

Actually, probably most of what you can do related with political activism (volunteer to help candidates, write to your local newspaper, etc) has a lot of more influence than voting.

Decision process can be really complex

I realized that I probably arrived at a point where I am pretty non-tribal regarding politics. I sympathize and understand many political positions, and my views depend on the issue at hand, sometimes leaning right, sometimes left.

They told me this is a good thing.

Well, when you trying to pick one candidate to vote for, it only causes a bunch of decision anxiety! It becomes not obvious on who to vote for.

I see each presidential candidate as a point in a giant multidimensional space of future political decisions that the candidate will have to deal with if they become elected. This, in contrast with the extreme of each candidate being a point in a uni-dimensional line that goes from right-wing to left-wing.

In the latter model, things are easy. If you are moderately right-wing, you just vote on the “most moderate” right-wing candidate.

But the complexity of the former model is huge. I don’t even know my position on issues before I reflect a lot on them. Even if I knew it, I would still have to deal with the extra complexity of having to weight each issue in relation to all others. Basically, how do I compare the points in that multidimensional space?

If you believe some issues are a lot more important than others, you might focus only on the candidate’s views on those issues. This seems to me to make sense. Personally, I think the most important issues are those related with the far future. Unfortunately, candidates don’t tend to talk about those. One exception now is pandemics: candidates will probably have some kind of opinion about issues related to that.2

Voting as signaling (or: Why I still vote)

It’s my impression that voting has a strong signaling value: at least in some groups, voting is a signal that you’re a good citizen, and you gain points in your community of you said you vote.

That’s the reason why I still vote, even if only to cast a blank. It doesn’t cost that much and I really don’t want to go through the hassle of justifying myself to my friends and family why I’m not an horrible person for not voting. I might even talk with them about all I’ve covered in this post; the fact that I voted might probably even make them more receptacle to my arguments.

And since I’m voting, if it’s not too costly for me to get to know the candidates, if there’s some obvious best candidate, I’ll vote for them (even knowing that my vote it’s not going to change anything). If the decision seems hopeless, I’ll cast a blank vote.

I also like to at least know a little bit about national politics so that I can better understand discussions that I happen to listen to/participate in. It can also be fun to discuss politics with light-hearted friends, and that’s pretty valuable. 

Much more than voting. 🙂

1 – I suspect this is pointing at the same issue that Ergodicity Economics does for investing?
2 – I might e-mail all the candidates for the upcoming presidential elections to ask about this. 

PORDATA – Alojamentos e Condições de Vidas

(Este texto faz parte da minha exploração da PORDATA – uma base de dados relacionados com Portugal)

Não tinha ideia de que a construção de casas diminuiu tanto desde 2002. Nesse ano foram construídas aproximadamente 9 vezes mais casas do que em 2019.


Adoro este gráfico:

A percentagem de agregados com uma arca congeladora subiu ~10% entre 2000 e 2005… e desceu outra vez ~10% até 2010. O que raios aconteceu aqui?


Isto parece indicar que o bem-estar dos portugueses tem melhorado desde 2004:

Mas o valor é relativo a outros países europeus. O índice varia entre 0 e 1:

Quanto mais próximo estiver de 1, mais se aproxima do valor máximo que essa dimensão assume, em todo o período em análise, no conjunto de países de referência. 

Pelo que um valor abaixo de 0.5 não soa assim tão bem.

O melhor indicador para Portugal é o do Ambiente e o pior é o do Bem-estar económico (o índice deste último foi de 0.02 em 2004!)


A “percentagem da população considerada em situação de carência económica ou de bens duradouros” diminuiu desde 2004, sendo 5.6% actualmente.

PORDATA – Receitas e Despesas do Estado

(Este texto faz parte da minha exploração da PORDATA – uma base de dados relacionados com Portugal)

Algumas curiosidades:

O IVA é responsável por uma maior parte da receita do estado do que o IRS, que por sua vez dá mais receita que o IRC. Gráfico aqui:

Os próximos dois gráficos vêm daqui.

Acção e segurança social é a área onde o Estado gasta mais per capita, seguido de Saúde e Educação:

Antes de 2004, o Estado gastava mais, por capita, em Educação, do que em Saúde:

PORDATA – Library users per year

(This is part of my explorations of PORDATA – A Portuguese open data database)

This plot really really surprised me:

It shows the permilage of people in Portugal who are library users. Checkout that 2003’s number. An astonishing 82.6% of the population was going to libraries! This sounds too much to me. I don’t think I know anyone who goes to libraries. But I guess that 2020 is a really different world than 2003.

For sanity check, I’ve tried to find numbers for other countries.

From a survey in the UK:

Users are decreasing, but still pretty high numbers at 2015/2016 – more than one third of the population is a library user.

And here we have data given to us in a press release by the Spanish Statistics Institute.

So, yeah, TIL: more people use libraries than I though.

PORDATA – Hours of Work Per Week

(This is part of my explorations of PORDATA – A Portuguese open data database)

This surprised me:

It shows the average of weekly work hours for people who work for some employer (vs. being self-employed). Since the last methodology change (that’s what those dark symbols represent) in 2011 the average diminished by 0.9 hours. There was a decrease in all jobs categories.

This happens for both genders:

(Dark orange are males, light orange are females)

Also interesting to note that males in average work more time than females.

I only found one group that, since 2011, has been working, on average, more hours: self-employed workers. While in 2011 they worked on average 30.8 hours/week, they now work on average 33.0 hours/week. This is still less than what employed people work, though.

(blue for self-employed, green for people who work for others)

PORDATA – Marriages per year

(This is part of my explorations of PORDATA – A Portuguese open data database)

Here is the plot of total number of marriages per year.

Interesting things:

Here is the plot of number of same-sex marriages per year:

Only starts in 2010 because that’s when same-sex marriage was legalized in Portugal. There seems to be a weird pattern of things starting out slow but then ramping up. Don’t know why this might be, but I’ll ask around.

Scala: Using circe and newtype to decode JSON with a field with variable type

Here’s one way you can quickly decode a JSON using circe:

import io.circe._
import io.circe.generic.semiauto.deriveDecoder
import io.circe.literal._

case class Example(id: String, field1: String)
object Example {
  implicit val circeDecoder: Decoder[Example] = deriveDecoder[Example]
}

val exampleJsonIdAsString: Json =
  json"""{
    "id": "12345",
    "field1": "something"
  }"""

val example = exampleJsonIdAsString.as[Example]

println(example)

This prints Right(Example(12345,something)).

This all works well if the types of the JSON fields are predictable. But what if you’re consuming some API that you don’t control and the same field sometimes comes with different types? For example, an id field coming sometimes as string and other times as number. (I had this happening to me recently)

val exampleJsonIdAsLong: Json =
  json"""{
    "id": 12345,
    "field1": "something"
  }"""

val example = exampleJsonIdAsLong.as[Example]

println(example)

This will fail with Left(DecodingFailure(String, List(DownField(id)))) since is is expecting id to be a string but it is a number

So, our decoder has to know to deal with the id field being string or number. Now an automatic decoder will not do and we’ll have to write a custom one:

object Example {
  implicit val circeDecoder: Decoder[Example] = (c: HCursor) => {
    val idField = "id"
    val idParsed: Result[String] = c.downField(idField).as[String] match {
      case Right(v) => Right(v)
      case Left(_) => c.downField(idField).as[Int] match {
        case Right(v) => Right(v.toString)
        case Left(err) => Left(err)
      }
    }

    idParsed match {
      case Right(v) =>
        val transformedJson = c.withFocus(_.mapObject(_.add(idField, Json.fromString(v)))).success.get
        deriveDecoder[Example].apply(transformedJson)
      case Left(err) => Left(err)
    }
  }
}

This will successfully parse both “types” of JSON. But the decoder is a little cumbersome to read. And I would like to reuse this logic in other decoders. Here’s an alternate approach:

import io.circe._
import io.circe.generic.semiauto.deriveDecoder
import io.circe.literal._
import io.estatico.newtype.macros.newtype

@newtype case class MyId(private val value: String)

object MyId {
  implicit val circeDecoder: Decoder[MyId] = (c: HCursor) => {
    c.value.asString match {
      case Some(v) => Right(MyId(v))
      case None => c.value.asNumber match {
        case Some(v) => Right(MyId(v.toString))
        case None => Left(DecodingFailure(s"Can't decode: ${c.value}", List()))
      }
    }
  }
}

case class Example(id: MyId, field1: String)

object Example {
  implicit val circeDecoder: Decoder[Example] = deriveDecoder[Example]
}

We define a newtype value called MyId, write a custom decoder for it and then go back to using an automatic decoder for Example. The MyId type can then be reused in other case classes.

FAQ – IRS e ETFmatic

Partilha para outros e para eu do futuro de detalhes sobre como inserir, no IRS, dados relacionados com investimentos na plataforma ETFmatic. (Não sou contabilista e existe uma probabilidade não-trivial, de que estou errado em alguns destes pontos. Se detectarem algum error, agradeço que avisem ^.^)

Anexo J – 11 Contas de Depósitos ou de Títulos Abertas em Instituição Financeira não Residente em Território Português (…)

Pelo que percebo, na ETFmatic não te é criada uma conta bancária, pelo que não é preciso preencher esta secção.

Onde e como inserir os dividendos?

Visto que são dividendos recebidos no estrangeiro, deve-se preencher o Anexo J, secção 8.

No início de cada ano a ETFmatic envia aos utilizadores um “ETFMatic Account Statement” que inclui um resumo das transacções relacionadas no ano anterior.

No topo podem encontrar algo como o seguinte:

Screenshot from 2020-04-08 17-59-26

Eu pego neste número e coloco na Anexo J, secção 8-A da seguinte forma:

Screenshot from 2020-04-08 18-02-41.png

Uma questão que tive é se era suposto inserir os dividendos de cada ETF separadamente em cada linha. Neste vídeo, alguém que parece perceber mais disto do que eu diz que é uma linha por país.

Onde e como declarar mais-valias?

Ler este e este artigo.

Automatizei parte do processo. Aqui vão os passos a seguir (sigam ao vosso risco, isto não foi muito testado):

1 – Obter história de transacções no site da ETFMatic 

Em Home, ir para “What’s been happening?”

Screenshot from 2020-04-11 18-04-43.png

Ai, procurar por “Download trades” e fazer download de todas as transacções.

2 – Converter .csv da ETFMatic num formato de input para o script TaoFinance: AnexoG

Através deste programa de Python. Exemplo de utilização:

 ./convert_etfmatic_transactions_to_taofinance_format.py ~/Desktop/trade_history_EUR_GAJJH2.csv ~/Desktop/trade_history_etfmatic_tao_format.csv 2019

O ano deverá ser o ano para qual estás a preencher o IRS.

3 – Converter o ficheiro de transacções no formato aceite pelo formulário do IRS

Ler e seguir os passos da secção Como usar o modelo TaoFinance: AnexoG v. 0.1 deste artigo. Se por alguma razão o site não tiver disponível, aceder a este link.

Copiar para o colocar no Google Sheets o conteúdo do ficheiro obtido no passo 2 e correr o script.

Screenshot from 2020-04-11 18-22-05.png

Vai ser criada uma nova aba onde vão estar as linhas a ser colocadas no formulário do IRS. Se quiseres podes ignorar os próximos passos e colocar manualmente as linhas na secção 9.2 A do Anexo J.

Senão, exportar a aba gerada para um ficheiro .csv.

4 – Automaticamente adicionar as transacções ao XML do IRS

Preencher normalmente o IRS com excepção das mais-valias. Fazer download do XML correspondente a este preenchimento.

 

Screenshot from 2020-04-11 18-29-34.png

Correr este script de Python para adicionar as transacções obtidas no passo 3 no XML obtido neste passo. Exemplo de utilização:

./add_foreign_gains_to_irs.py ~/Dropbox/decl-m3-irs-2019-260431311.xml ~/Desktop/tao_finance_anexo_g_script_result.csv ~/Desktop/irs_final.xml 826

826 é o Código de país da Inglaterra, onde a ETFMatic  está sediada.

5 – Confirmar que formulário foi preenchido correctamente

Fazer upload do ficheiro obtido no passo 4 no site das finanças e confirmar que está tudo correcto.

 

Nootropics

In August 2018 I started to experiment with nootropics. This page will record some of the results. I will not describe the nootropics in question since that information can be found in many places online.

Caffeine + L-theanine

I was excited about this one. I was never a coffee drinker, so never been high on caffeine. To my disappointment, I think caffeine doesn’t have an effect on me and I’m not the only one. I experimented with 100 mg Caffeine + 200 mg L-theanine twice, and, other time, since this was having no effect, I doubled the dose, but to no avail.

Melatonine

I have good sleeping patterns and only rarely I have trouble falling asleep. But since melatonine is pretty cheap and without big side effects I decided to give it a go.

I tried to take 1 mg of it (which might be 3x more than needed or not) one night, one hour before the time I was planning to go to bed. I haven’t noticed much difference compared with other nights, either on sleepiness (I usually already feel sleepy when I “should” feel sleepy) or on the time necessary to fall asleep (I think it took even more than average). I also haven’t had any strange dreams or woke up earlier than usual.

Modafinil 

I strive to have good sleep hygiene, but sometimes circumstances of life lead me to nights without much sleep. After research, modafinil sounded to me like a drug which would help go through the day productively, with a great side-effects profile.

1st experience
So, after one 5h30 hour sleep (with interruptions), something that would make any sleepologist cringe, I decided to take a shot at it. A couple of hours after waking up, I took 200 mg of Modalert. And well, it delivers what it promises! It did not feel like magic and I didn’t feel super awake (I still slept two naps during the day) nor extra-super-focused. It just fell I had my usual good night of sleep. No side effects. Definitely going to try again.

2nd experience
As in the 1st experience, 5 hours of sleep. But this time, waking up later than usual and having an unusual day (going to beach learning to surf, dinning out, swing dancing until late…). I didn’t feel Modafinil having any effect this time. I spent the whole day really tired (although also in a good mood).