Fortunately, if a condition of vocabulary balance does exist in a given sample of speech, we shall have little difficulty in detecting it because of the very nature and direction of the two Forces involved. On the one hand, the Force of Unification will act in the direction of decreasing the number of different words to 1, while increasing the frequency of that 1 word to 100%. Conversely, the Force of Diversification will act in the opposite direction of increasing the number of different words, while decreasing their average frequency of occurrence towards 1. Therefore number and frequency will be the parameters of vocabulary balance.
Since the number of different words in a sample of speech together with their respective frequencies of occurrences can be determined empirically, it is clear that our next step is to seek relevant empiric information about the number and frequency of occurrences of words in some actual samples of speech.
(George K. Zipf, Human Behavior and the Principle of Least Effort, 1949)
segunda-feira, 13 de dezembro de 2010
Double superlatives
Yet when we offer a prize to the submarine commander who sinks the greatest number of ships in the shortest possible time, we have a double superlative -- a maximum number and a minimum time -- which renders the problem completely meaningless and indeterminate, as becomes apparent upon reflection. Double superlatives of this sort, which are by no means uncommon in present-day statements, can lead to a mental confusion with disastrous results.
As pointed out years ago, the frequent statement, "in a democracy we believe in the greatest good for the greatest number," contains a double superlative and therefore is meaningless and indeterminate. (In Part Two we shall see that the distribution of goods and services are in fact governed by a single superlative.) Intimately connected with the "singleness of the superlative" is what might be called the singleness of the objective whose implications are often overlooked (i.e., the pursuit of one objective may preclude or frustrate the pursuit of the scoond objective). These two concepts apply to all studies in ecology.
(George K. Zipf, Human Behavior and the Principle of Least Effort, 1949)
As pointed out years ago, the frequent statement, "in a democracy we believe in the greatest good for the greatest number," contains a double superlative and therefore is meaningless and indeterminate. (In Part Two we shall see that the distribution of goods and services are in fact governed by a single superlative.) Intimately connected with the "singleness of the superlative" is what might be called the singleness of the objective whose implications are often overlooked (i.e., the pursuit of one objective may preclude or frustrate the pursuit of the scoond objective). These two concepts apply to all studies in ecology.
(George K. Zipf, Human Behavior and the Principle of Least Effort, 1949)
segunda-feira, 6 de dezembro de 2010
Mandelbrot Set

The Mandelbrot set M is defined by a family of complex quadratic polynomials
$P_c:\mathbb C\to\mathbb C$
given by
$P_c: z\mapsto z^2 + c$, where c is a complex parameter.
If the sequence $(0, P_c(0), P_c(P_c(0)), P_c(P_c(P_c(0))), \ldots)$ (starting with $z=0$) does not escapes to infinity, the complex number c is said to belong to the set.
A simple Octave/Matlab code was created to plot the complex numbers on the Mandelbrot set.
mset=[];
x=[-2:0.001:1];
y=[-1:0.001:1];
k=0;
for k1=1:length(x),
for k2=1:length(y),
c=x(k1)+i*y(k2);
z=0;
for it=1:100,
z = z^2+c;
end;
if(z < Inf), k++; mset(k)=c; end;
end;
end;
figure; plot(mset,'k.');
terça-feira, 30 de novembro de 2010
Simulation on Sand Avalanches
It is common to observe how complex systems in nature present similar patterns, what is due to the self-organized criticality. Critical points work as attractors towards which systems evolve seeking for equilibrium. A common example are the sand piles. It is observed that as more grain of sand are dropped, new avalanches may occur. The avalanches may be of different proportions, local small avalanches or big ones, spreading widely in the pile. The observation of these avalanches shows that they follow a Zipf's law.
Here I present the results of a simulation of sand avalanches. The video shows a set of samples, which with 10 continuous seconds taken every 80 seconds from the simulation. At every second a new sand is randomly dropped on the board. If a certain peak has 4 more grain of sand then any of its neighbours, an avalanche happens towards this neighbour, what might lead to a cascade of avalanches.
The histogram bellow show the frequency of occurrence of avalanches of different sizes, described as: 0 (no avalanche), 1 (avalanche happened just on the level the grain was dropped), 2 (avalanche spreads to the next level), and so forth.

If we present the result above as a log-log plot of the types of avalanches (according to their magnitude) ranked according to their frequency of occurrence, we get to the figure bellows, which clearly is a power law, a Zipf's law. The type of avalanche with rank one is the most frequent, the type ranked two is the second most frequent, and so on. The plot bellow shows the rank vs. frequency of occurrence. The numbers presented near the curve (1 2 3 0 4 5 6 ...) are the type of avalanche: 1 stands for avalanche only in the level where the grain is dropped; 2 when the avalanche spreads to the next level; 3 when it spread two levels bellow; 0 when there is no avalanche; etc.
Here I present the results of a simulation of sand avalanches. The video shows a set of samples, which with 10 continuous seconds taken every 80 seconds from the simulation. At every second a new sand is randomly dropped on the board. If a certain peak has 4 more grain of sand then any of its neighbours, an avalanche happens towards this neighbour, what might lead to a cascade of avalanches.
The histogram bellow show the frequency of occurrence of avalanches of different sizes, described as: 0 (no avalanche), 1 (avalanche happened just on the level the grain was dropped), 2 (avalanche spreads to the next level), and so forth.

If we present the result above as a log-log plot of the types of avalanches (according to their magnitude) ranked according to their frequency of occurrence, we get to the figure bellows, which clearly is a power law, a Zipf's law. The type of avalanche with rank one is the most frequent, the type ranked two is the second most frequent, and so on. The plot bellow shows the rank vs. frequency of occurrence. The numbers presented near the curve (1 2 3 0 4 5 6 ...) are the type of avalanche: 1 stands for avalanche only in the level where the grain is dropped; 2 when the avalanche spreads to the next level; 3 when it spread two levels bellow; 0 when there is no avalanche; etc.
sexta-feira, 26 de novembro de 2010
Zipf's Law
Zipf's statistical law is based on the idea that two "opposing forces" are in constant operation in a system. In the stream of speech, they are: the Force of Unification and the Force of Diversification. Any speech is is a result of the interplay of these forces, that through a self-organizing process reaches a critical point, a point of "balance" between them. This balance is observed on the relation between the frequency of occurrence of words (f) and their rank (k), their product is constant.
$f(k;s,N)=\frac{1/k^s}{\sum_{n=1}^N (1/n^s)}$.
In the formula above, s stands for the exponent that characterizes the distribution; and N stands for the number of elements in the set. The formula states that the frequency of occurrence of a given element is given by the rank of this element within a given, which distribution is characterized by s. The figure bellow presents how the relationship of frequency and rank is when plotted in a log-log scale for different values of s.

Zipf developed the idea using an intrinsic linguistic or psychological reason to explain this phenomena observed in the world of words. He named his theory the "Principle of Least Effort" to explain why frequently encountered words are chosen to be shorter in order to require a little mental and physical effort to recall them and utter/write them. According to Alexander et al. (1998), Zipf’s law seems to hold regardless the language observed. "Investigations with English, Latin, Greek, Dakota, Plains Cree, Nootka (an Eskimo language), speech of children at various ages, and some schizophrenic speech have all been seen to follow this law"(Alexander et al., 1998).
The Zipf’s law is also observed in other phenomena, for example: the magnitude of earthquakes (it is common to have many small earthquakes, but big ones are rare) (Abe and Suzuki, 2005); the population in cities (there are few megalopolis, but thousands of small cities) (Gabaix, 1999); the distribution of total liabilities1 of bankrupted firms in high debt range(Fujiwara, 2004); the number of requests for webpages(Adamic and Huberman, 2002); etc.
The observation of languages also points to a Zipf’s law, what makes one more evidence that languages operate in a rather random way. Performing a statistical analysis of language means to acknowledge its unpredictable nature, without which there would be no communication at all. The analysis of languages as a statistical process has advantages over the qualitative analysis, it "is able to afford to neglect the narrow limits of one language and concentrate on linguistic problems of a general character" (Trnka, 1950). Although this conflict between randomness and rationality might rise suspicious on the character of languages, Miller wisely pointed: "If a statistical test cannot distinguish rational from random behavior, clearly it cannot be used to prove that the behavior is rational. But, conversely, neither can it be used to prove that the behavior is random. The argument marches neither forward nor backward" (Miller, 1965).
References:
Abe, S. and Suzuki, N. (2005). Scale-free statistics of time interval between successive earthquakes. Physica A: Statistical Mechanics and its Applications, 350(2-4):588–596.
Adamic, L. A. and Huberman, B. A. (2002). Zipf’s law and the internet. Glottometrics,
3:143–150.
Alexander, L., Johnson, R., and Weiss, J. (1998). Exploring zipf’s law. Teaching Mathe
matics Applications, 17(4):155–158.
Fujiwara, Y. (2004). Zipf law in firms bankruptcy. Physica A: Statistical and Theoretical Physics, 337(1-2):219–230.
Gabaix, X. (1999). Zipf’s law for cities: An explanation. Quarterly Journal of Economics, 114(3):739–67.
Miller, G. A. and Taylor, W. G. (1948). The perception of repeated bursts of noise. The Journal of the Acoustical Society of America.
Trnka, Bohumil (1950). Review of: G.K.Zipf, The psychobiology of language. Human behavior and the principle of least effort.
$f(k;s,N)=\frac{1/k^s}{\sum_{n=1}^N (1/n^s)}$.
In the formula above, s stands for the exponent that characterizes the distribution; and N stands for the number of elements in the set. The formula states that the frequency of occurrence of a given element is given by the rank of this element within a given, which distribution is characterized by s. The figure bellow presents how the relationship of frequency and rank is when plotted in a log-log scale for different values of s.

Zipf developed the idea using an intrinsic linguistic or psychological reason to explain this phenomena observed in the world of words. He named his theory the "Principle of Least Effort" to explain why frequently encountered words are chosen to be shorter in order to require a little mental and physical effort to recall them and utter/write them. According to Alexander et al. (1998), Zipf’s law seems to hold regardless the language observed. "Investigations with English, Latin, Greek, Dakota, Plains Cree, Nootka (an Eskimo language), speech of children at various ages, and some schizophrenic speech have all been seen to follow this law"(Alexander et al., 1998).
The Zipf’s law is also observed in other phenomena, for example: the magnitude of earthquakes (it is common to have many small earthquakes, but big ones are rare) (Abe and Suzuki, 2005); the population in cities (there are few megalopolis, but thousands of small cities) (Gabaix, 1999); the distribution of total liabilities1 of bankrupted firms in high debt range(Fujiwara, 2004); the number of requests for webpages(Adamic and Huberman, 2002); etc.
The observation of languages also points to a Zipf’s law, what makes one more evidence that languages operate in a rather random way. Performing a statistical analysis of language means to acknowledge its unpredictable nature, without which there would be no communication at all. The analysis of languages as a statistical process has advantages over the qualitative analysis, it "is able to afford to neglect the narrow limits of one language and concentrate on linguistic problems of a general character" (Trnka, 1950). Although this conflict between randomness and rationality might rise suspicious on the character of languages, Miller wisely pointed: "If a statistical test cannot distinguish rational from random behavior, clearly it cannot be used to prove that the behavior is rational. But, conversely, neither can it be used to prove that the behavior is random. The argument marches neither forward nor backward" (Miller, 1965).
References:
Abe, S. and Suzuki, N. (2005). Scale-free statistics of time interval between successive earthquakes. Physica A: Statistical Mechanics and its Applications, 350(2-4):588–596.
Adamic, L. A. and Huberman, B. A. (2002). Zipf’s law and the internet. Glottometrics,
3:143–150.
Alexander, L., Johnson, R., and Weiss, J. (1998). Exploring zipf’s law. Teaching Mathe
matics Applications, 17(4):155–158.
Fujiwara, Y. (2004). Zipf law in firms bankruptcy. Physica A: Statistical and Theoretical Physics, 337(1-2):219–230.
Gabaix, X. (1999). Zipf’s law for cities: An explanation. Quarterly Journal of Economics, 114(3):739–67.
Miller, G. A. and Taylor, W. G. (1948). The perception of repeated bursts of noise. The Journal of the Acoustical Society of America.
Trnka, Bohumil (1950). Review of: G.K.Zipf, The psychobiology of language. Human behavior and the principle of least effort.
sábado, 20 de novembro de 2010
The minimum wage miracle
With the new Constitution of 1988, it was granted to every worker, the right to earn at least an amount called "minimum wage". In the second chapter, sixth article, it defines this minimum wage as the amount capable of attending the basic vital necessities of a worker and his family with home, food, education, health, leisure, clothing, hygiene, transportation and social security. It is also establish, that this minimum wage should undergoes periodic readjustments to overcome inflationary degradation of the worker's purchasing power. Although the Constitution does not specifies how often those readjustments should happen and what amount should be given, we observe in the history of readjustments that there is a regularity. There is almost one readjustment every year and the readjusting factor kept following the rule: CPI (consumer price index, which is used as a measure of inflation) + percent GDP growth. The rule of readjustment followed by the government in the last years to define the readjustment factor is: the CPI of the year that has just passed plus the percent GDP growth experienced in the year before. That means: readjustment_factor[n] = CPI[n-1]*GDP[n-2]. This might be observed in the figure right bellow, where the actual minimum wage value is plotted in blue and the predicted readjustment (using the rule) in red:

It is clear now that the readjustment try to follow this rule.
The interesting point about this readjustment rule is that it promotes the distribution of wealth. As the country keeps growing, the minimum wage also keeps increasing, at a larger step. Not everyone wage keeps increasing at the minimum wage's rate. It might clearly be apprised in the figure bellow. The cyan curve shows the average wage of Brazilians. If it were to be readjusted using the same rule the minimum wage uses, it would gives us the green curve. Looking at the graphic, we see that the average wage is always bellow the green curve, what shows that, on average, the wages don't follow the minimum wage increase.

The consequence of this is better viewed when we normalized all curves by the actual minimum wage value, what is presented in the next figure.

In 1995, the average Brazilian wage was around 8 times greater than the minimum wage. In the last year, in 2009, it reached a ratio 3:1. This means distribution of wealth. Observing the curve, it seems like the curve is going to saturate at a ratio between 3:1 and 2:1, what would leave Brazil in a similar position to developed countries. Here is some ratios of average wage to minimum wage in some countries: USA 3.28:1, Spain 2.55:1, Netherlands 2.22:1, Portugal 2.02:1, France 2.00:1, UK 1.88:1 (data from: source 1 and source 2).

It is clear now that the readjustment try to follow this rule.
The interesting point about this readjustment rule is that it promotes the distribution of wealth. As the country keeps growing, the minimum wage also keeps increasing, at a larger step. Not everyone wage keeps increasing at the minimum wage's rate. It might clearly be apprised in the figure bellow. The cyan curve shows the average wage of Brazilians. If it were to be readjusted using the same rule the minimum wage uses, it would gives us the green curve. Looking at the graphic, we see that the average wage is always bellow the green curve, what shows that, on average, the wages don't follow the minimum wage increase.

The consequence of this is better viewed when we normalized all curves by the actual minimum wage value, what is presented in the next figure.

In 1995, the average Brazilian wage was around 8 times greater than the minimum wage. In the last year, in 2009, it reached a ratio 3:1. This means distribution of wealth. Observing the curve, it seems like the curve is going to saturate at a ratio between 3:1 and 2:1, what would leave Brazil in a similar position to developed countries. Here is some ratios of average wage to minimum wage in some countries: USA 3.28:1, Spain 2.55:1, Netherlands 2.22:1, Portugal 2.02:1, France 2.00:1, UK 1.88:1 (data from: source 1 and source 2).
sexta-feira, 19 de novembro de 2010
How to deceive dumb people with exponential growth
It is pretty easy to deceive an outsider that the last few years have made a tremendous better profit in comparison to the previous ones.
When we experience a exponential growth we get surprised to see how the growth was tremendous in the last few samples. In fact, on average, the percent growth is the same, but what is important (mainly in political matters) is to convince another that we are experiencing glorious times.
A simple analysis of various examples show us percent growing rates almost constant. That is natural. Observe the GDP growth of a developing country, or the growth on the exportation, or the growth of a large company. Usually you will find a percent growing rate that is almost constant.
If we consider than a growing rate to be a random variable with a certain mean and variance, we might sketch the growing curve. Bellow I present some simulations where the percent growing rate was modeled as a normally distributed random variable with mean 4 and some distinct variances: 4, 6, 8, and 10. The growing curves are presented bellow:

And here another sketch, where the graphics are separated according to their variances.

Lets take one graphic as an example. It is plotted with its percent growth shown bellow, along with a moving average of the percent growth.

If you juts look at the first plot, you would conclude that after time 60 and/or 80 we got a bigger improvement. But you may look things in a different way. If you look at the second subplot, you may observe the percent growth through time. Now it is easy to see that it is almost the same through time, and the first picture is clearly deceiving.
Another way to see how deceiving our first graphic was is to plot the data in a logarithm scale, as shown right bellow:

Don't believe straight away on your eyes, or you might get deceived. Don't believe on exploding graphics jumping out of the paper, they are made to deceive you. Don't believe on millions and billions on a moth of a politician. To see the truth, you have to get your hands dirty.
When we experience a exponential growth we get surprised to see how the growth was tremendous in the last few samples. In fact, on average, the percent growth is the same, but what is important (mainly in political matters) is to convince another that we are experiencing glorious times.
A simple analysis of various examples show us percent growing rates almost constant. That is natural. Observe the GDP growth of a developing country, or the growth on the exportation, or the growth of a large company. Usually you will find a percent growing rate that is almost constant.
If we consider than a growing rate to be a random variable with a certain mean and variance, we might sketch the growing curve. Bellow I present some simulations where the percent growing rate was modeled as a normally distributed random variable with mean 4 and some distinct variances: 4, 6, 8, and 10. The growing curves are presented bellow:

And here another sketch, where the graphics are separated according to their variances.

Lets take one graphic as an example. It is plotted with its percent growth shown bellow, along with a moving average of the percent growth.

If you juts look at the first plot, you would conclude that after time 60 and/or 80 we got a bigger improvement. But you may look things in a different way. If you look at the second subplot, you may observe the percent growth through time. Now it is easy to see that it is almost the same through time, and the first picture is clearly deceiving.
Another way to see how deceiving our first graphic was is to plot the data in a logarithm scale, as shown right bellow:

Don't believe straight away on your eyes, or you might get deceived. Don't believe on exploding graphics jumping out of the paper, they are made to deceive you. Don't believe on millions and billions on a moth of a politician. To see the truth, you have to get your hands dirty.
Assinar:
Postagens (Atom)