2017-02-12

How far away should you rent?

The value of your rent is influenced heavily by location: how easy you can get to where you need to be. For understanding this, we need a model of time valuation.

Time valuation

Let's find a way to value the extra time spent past the 8 hours, for getting to work.

Constraints

  • Suppose you have a monthly salary of 1 unit (which we can later swap for an actual amount).
  • Suppose you work for 8 hours a day (full-time in most countries).
  • Suppose you are not willing to give away 16 hours a day, no matter what your salary would become. 
    • This means your salary would have to reach infinity in order for you to accept it.
We need to construct a function out of this:
  • It must go through (0, 0) - this means for no work, you get no pay. 
  • It must go through (8, 1) - for 8h of work, you get 1 unit.
  • It must have a vertical asymptote going to positive infinity at x=16 - your time becomes infinitely precious when you have no more of it.

Function

A somewhat handy function which goes through (0, 0) and asymptotes up at π/2 is the tangent function. You can use whichever function is most suited for your needs, there is no guarantee that the tangent actually maps to your exact preference - it is only accurate in those three specified points (0, 8 and 16).
Edit: In particular, you can check out the inverse logistic function (logit - which may be a better fit). 

We need to stretch and condition the tangent function as follows:
  • We want the infinity to happen at 16, not at π/2. Therefore, instead of tan(x) we will use tan(x * π/32).
  • We then want the value at 8 to be exactly 1. Therefore, we divide the the function by its value at 8h:
    • tan(x * π/32) / tan(8 *π/32)tan(x * π/32) / tan(π/4)
    • however, tan(π/4) is already 1, so we don't need to divide at all
    • so, the final function is tan(x * π/32)
  • We then avoid looking at the values outside the inverval [0, 16], because:
    • we are not willing to work negative hours (would that mean hiring someone to do your job? heh)
    • we are not willing to work more than 16 hours
    • we have not checked that the function corresponds to our wishes outside of the 3 points we have just defined

Here is what this function looks like:
Note the dramatic increase: if you spent two extra hours commuting each day (8h -> 10h), you might as well ask for a 50% increase in your salary - because that is what this valuation says your added time is worth. This is in contrast to asking proportionally (25% more) if you would be paid the same hourly rate.

This increase is caused by your time availability: the more time you spend working, the more valuable your free time is, because there's less of it!

Of course, your preference might not have the same steepness as this function, which means you should customize this function according to your preference.
  • Perhaps you don't mind spending 10 hours for work, which means you should extend the linear-ish portion further from 8h to 10h. 
  • Note that when you halve your free time (work 12h), the salary you should ask according to this function is about 2.5 times greater (not 2 times, and not 1.5 times as a linear hourly rate would say). This may or may not correspond to your actual preference.
But the general shape should stay the same, since the assumptions we made for the constraints seem fine to me.

More ideas you can try out:
  • Different valuation functions
  • Adjust for weekends - to do this, it's easier to consider the hours spent on a weekly basis, instead of daily as we did.

Rent & commute

Great, now we have a time valuation. Now, how does this fit with the rent to pay?
Suppose you had two options: 
  • an apartment a step away from your office, or telecommute (commute time zero)
  • an apartment 30 minutes away by whichever means of transport you use (daily commute time of 1 hour)
According to the valuation, that extra hour spent commuting costs you tan(9 * π/32) - tan(8 * π/32) worth of free time, which is about 0.2185 of your salary.
This means it should be indifferent to you to do either of the following:
  • pay 21.85% of your salary extra to live at the office
  • or to commute for 1 hour each day
This amount, multiplied by the mean salary in Romania (487.93 euros), yields 106.6 euros.

So, suppose you pay 200 euros for the apartment half an hour away. Then, you might want to pay 306.6 euros for the one right at your office.
Notice that this difference is a hefty amount (more than a fifth of the salary). This is because your time is limited, and due to the way the tangent grows to infinity.

Important caveat in this analysis

This model overlooks something critical: are your new costs letting you save enough money? Suppose right now you spend 80% of your salary. If you were to make the choice of moving to the office (an expensive rent nearby), and pay 21.85% for rent, you would be net negative, which would of course be unacceptable.

So, it seems there is one more valuation to consider: that of money. This raises a question; how great is one's preference of money, compared to time?

I might explore this in a later blog post, but now, I have no more...

...time!

2016-08-20

How to recover data from a non-booting laptop

Recently, my father gave me his very old laptop (bought second-hand in 2007) to try to recover some pictures.

Step 1. Access the hard drive

The laptop was not booting, and nothing indicated that the power supply was working. So I couldn't use the laptop itself, and I had to take its hard drive out.

First, I looked up a video on YouTube to see how to disassemble it enough for this. It was not too hard, just 1 screw for this particular laptop.

You can see at 0:43 in this particular video:


Cool.

Then, I find out that the connector is the old IDE kind, not the SATA ones which can be plugged into modern laptops:


I need some sort of adapter for it. Searching for adapters on Amazon can get you stuff like this which costs quite a lot (and I already have a SATA to USB adapter, so I didn't want one).
Looked some more and I found this nice box (which would also make the drive portable, so I could simply give it to my father).

I unplugged the laptop connector from the drive (it had some strange removable connector), and then I inserted the drive into the box's socket (carefully so I wouldn't bend the pins, and the missing hole is aligned with the missing pin).

It worked nicely, and I could see the file system on my computer :)

Step 2. Deleted file recovery

I searched for all jpg and jpeg files currently on the drive, and did not find the pictures my father was looking for (he mentioned specific images). So, I had to run some recovery tool on the empty space of the file system inside.


Warning! If you just deleted a picture and want to recover it, DON'T use the drive anymore! This is because your OS can now copy stuff over the deleted picture (which is now marked as empty space). If you copied files to fill your drive afterwards, then the picture will not be recoverable anymore.

Luckily my father didn't fill his hard drive, and the picture was still floating around in the empty space. I found it using the awesome open source program called PhotoRec.

This program can comb through the empty space of your hard disk, and check for signatures of files (it is explained on the website in more detail). Also, it can detect where the file ends, and then it saves a copy of it (on another hard disk, NOT the one you're trying to check the empty space of).

Here is a guide on how to use it.



If you think this software is useful, you should donate, since the author relies on donations for the program's development.

Hope this post was useful for you! Have a nice day.

2016-05-15

Computer prices


I wanted to buy a laptop, and since a laptop is priced relatively high compared to my salary, I have written a scraper for laptops on a Romanian website's seller: http://www.cel.ro/

I got the data for laptops once in February this year: each laptop's CPU model, GPU model, amount of RAM, HDD space, and SSD space.

I then looked up the CPU and GPU models on the wonderful sites, to get their performance scores:
https://www.cpubenchmark.net/cpu_list.php
http://www.videocardbenchmark.net/gpu_list.php

I then manually looked around and saw prices of (cheapest) components per performance. I got the following:
  • CPU: ~0.15 RON / performance unit
  • GPU: ~0.16 RON / performance unit
  • HDD: ~0.18 RON / GB
  • SSD: ~1.4 RON / GB
  • RAM: ~16 RON / GB
Then, I computed the theoretical value of the components of each computer by adding up these estimated costs of each component.

What insights did I get?
  1. People pay up to 44% more, comparing the most expensive with the cheapest brand.
    Manually checking a few, it seems Dell laptops have more warranty: 36 months instead of 24, typical of Asus. This translates to 50% increase in warranty, for just 44% increase in price. But after 3 years, you might consider a laptop quite outdated (see point 4).
    Here are some ratios (higher means more of the price goes to component performance):
    1. Asus: 36.3% (cheapest performance)
    2. Acer: 36.1%
    3. Lenovo: 33%
    4. Toshiba: 31.1%
    5. HP: 27.4%
    6. Dell: 25.2% (most expensive performance)
  2. Still, there's enormous in-brand variation. At time of writing, the cheapest computer (an Asus) has a ratio of 62.4%, and the most expensive computer (a Lenovo) has only 12.3% of its price going to component performance. As you can see, writing a scraper pays off.
  3. High-end laptops are more expensive, about exponentially.
  4. Between Feb 16th and May 15th, the performance per RON increased by 10.26456%, which translates to an annual deflation of 49.33%!
    This means that if you save money for one year, you'll be able to buy 49.33% more computing power.
    It also means that if you buy some computing power now, it will only be worth 67% one year later.
    It also means the difference in value between the 2yr and 3yr warranties is about 14.8% of the original price due to deflation, which is significantly less than what you pay for keeping the laptop alive that year (44% more).
I also scraped the price of desktop computers, but only today, so I don't have inflation data for those. However, I can compare their costs: buying a desktop gives you, on average, 24% benefit, which is slightly less than I expected. Here's the chart:
 

So, there you have it! If you want to use my scraper for buying a laptop yourself, it's available on GitHub. The code is not very pretty, but it contains instructions about running it.

EDIT: I later found out about the Import.IO service, which lets you click your way through creating a scraper! Check it out, I recommend it instead of my scraper (which is now obsolete, since the site changed anyway).

2015-05-16

Worldwide tax rates

I recently stumbled upon a website showing most taxes in various countries:

Worldwide-tax

I immediately decided to rank them by best and worst case taxation. I processed the data in a spreadsheet.
I estimated the taxation of fixed amounts (like DKK 900) as percentage of the Numbeo salary.

You can see the raw data here, and how much you're left with below, in the overall economic process. Of course, there can be errors, but these data are much more realistic than other so-called indicators.
As you can see, hiring more lawyers in certain countries gives you an advantage, as the best case scenario can ensure you keep more than 88% of your money.
There are countries with vast differences between the worst and best cases, like Gibraltar, Morocco, Sweden, and the Netherlands. I think this is wrong, since it encourages greater separation between those who can afford an accountant/tax specialist and those who can't, and are signs of intervening in the economy.
Also, in France, you only get to keep between 19% and 30% of the money you earn.

2014-12-03

Innovation and monopolies

Is there a link between innovation and being a monopoly? Without data this is only going to be hypothesizing, but here goes.

Quite the contrary, I would argue, small firms are more incentivized to innovate to gain reputation, whereas monopolies tend to cash in on it.

Big, long-term plans can certainly be fulfilled by collaboration between many companies and/or agents, because at each step in the way, more value is added.

Take the story of a pencil:
  • Someone mines and sells graphite for profit.
  • Someone cuts timber for a profit.
  • Someone extrudes graphite lead for a profit.
  • Someone shapes pencil wood encasings for a profit.
  • Someone puts the lead in the wood and sells it to you for profit.

No "grand" planning was needed. Perhaps graphite lead is also used directly by artists, or maybe new kinds of mechanical pencils appeared, reducing demand for wood encasings in favor of plastic/metal. Everyone acting at every level has the incentive to innovate, and perhaps are better suited to it, since they can focus on their own job. Monopolies rely on managers instead.

The same can happen for lots of things. Did you make something you don't know what to do with? Sell it to whoever buys it. The coal miner doesn't know or care whether his coal will become a pencil or electricity. He just cares that he's making a profit - aka, his work is deemed useful and encouraged by his clients.
Did you research something that can offer competitive advantage? Become a consultant. Did you notice something other people find hard to do but you can do easily? Start doing it and selling it to them.

A monopoly is often blind to things like these, not noticing that people work on useless things (Google employees manually editing maps, for example (I just invented this, it isn't true)). The market would quickly replace them with people who can do it more cheaply/efficiently (say, freelancers instead of using $150k/year employees). The market is much more modular than a monopoly.

Sure, Google for instance innovates. But does, say, Comcast innovate? Comcast just uses lobbyists to make sure people can't compete with them. The only innovation is in convincing the government to make laws in its favor and in manipulating the masses.

And that's the only advantage of a monopoly - being able to deal with red tape. Because you need large groups of people to become a majority, and lots of money to lobby in favor of your laws - laws against potential threats to your insane profit margins, laws friendly to the "competitors" on whose turf you secretly agree not to step.

Some monopolies tend to have a global reach (like Google or Coca-Cola), which means they do well irrespective of laws - perhaps they're better.
Others (like Comcast or Electrica) do well strictly in their own country, probably because they control a large amount of what is going on in it (like owning the media and manipulating people, or having relations with certain well-placed officials).

This is my brain dump. It is by no means final, just my belief so far. Please attack it! :)

2014-11-18

Country statistics

When doing various analyses over country statistics, I've ran across a few problems:

  • The name of the same country differs across various sources
  • Some countries may be missing
I had to match them manually in my spreadsheet, and it was boring.

Since I plan doing that thing quite often, I created a tool. I ran it several times with data from various sources, and collected several names for some countries, say, Falkland Islands:

  • Falkland Islands
  • Falkland Islands (Malvinas)
  • Islas Malvinas
  • Malvinas
For others, I made compromises, because they're disputed, ambiguous and/or included in one another. For example, I've associated all of the following with the code PS (for Palestine):
  • Palestine
  • Palestinian Territory
  • Gaza
  • West Bank
  • West Bank and Gaza
While this is a pretty simple script, you can save time by using it. And if you wish to contribute (even small additions to country_codes.csv), send me a pull request.

Here's something that resulted from combining 2012 data from the World Bank, current USD prices of a combo meal from Numbeo, and population data from Wikipedia. I just had to arrange the data in CSVs with rows of the form country, value, and the script took care of merging them.

Norway is right next to Venezuela, so I guess this doesn't really say much about countries. Or does it?



I pasted the result into Google Drive, and made this pretty bubble chart. Knock yourselves out!

2014-09-15

Letter to EFF on Net Neutrality

I sent a letter to the Electronic Frontier Foundation, in response to their campaign for net neutrality:


Hi,
As an independent observer, I'm delighted that you do a great job about informing people of what ISPs and big companies come up with in order to get more money. However, I have a few comments about the reasons for which you want to stop this:
  1. If ISP companies wish to grant special privileges to certain players, I think they should have the freedom to do so - because they own their routers and infrastructure, and should be able to do whatever they please with them. Legislating for net neutrality is an attack on their freedom.
  2. Perhaps allowing this type of contracts will make it cheaper for typical consumers to use mass/high-traffic sites (like the ones provided by those who can pay for privileges).
I think you should implement and fight for another kind of solution: developing a crowd-sourced ISP monitoring browser plugin, for example, and aggregating and publishing the extent to which ISPs discriminate their traffic. This way, consumers are aware and able to make a conscious decision, and the market will find a balance which will please the people the most.
However, a fundamentally more important problem in the US (as I see it), is the over-regulation of telecom, leading to few alternatives and only a handful of ISPs holding monopoly (just like the tobacco industry). You should work to reduce regulation, to enable more players to enter the market more easily, instead of increasing it (for example by giving them an extra form to fill - the net neutrality one).