Friday, 25 August 2017

A meaningful kindergarten opening ceremony

I attended the opening ceremony of my daughter’s kindergarten today. It was a simple ceremony, lasting about an hour. Nevertheless, the activities for the ceremony were impressive. I found they are very meaningful. They had been definitely carefully designed.

The first procedure was the new students entered the site. The older student raised sunflowers to make an arch path to welcome the new students. The new students happily passed through the beautiful path and then sat on the benches in front of the stage. The older students pave the road for the younger students. What a good meaning!

After a short welcome speech by the headmaster, the chorus began. Three songs were sung: “I like the flowers” (in English), “Mir sind e Schuel” (in Swiss German) and “S gaat besser mitenand” (in Swiss German). The first song is for expressing the children’s love to nature. The title of the second song means “I am a student”. Singing this song, the new students declared they became a student from the day. The last song was sung only by the older students. Its main message of the song is that we all belong to each other and we will care for each other. All the three songs deliver meaningful and kind messages.

At the end, all student went to the playground and released balloons into the sky. This was the climax of the ceremony. The balloon represents hope and dream. All the students release their dreams together, and since then they will realise their dreams bit by bit together. This activity marked a successful ending for the ceremony.

The students participating the event may not fully understand all these meanings, but the experience will enter their memories and they will receive all the good messages eventually.

Saturday, 24 June 2017

The linear programming problem of life

I watched the movie “Mao's Last Dancer” tonight. It reminds me that I still cannot change many things in my lift the meaningful way they should be because I am not doing well enough. In the linear programming problem of life, the way for you to guarantee the solution to reach your expectation is to relax the constraints in your control. It often means increasing your production. 

Sunday, 2 April 2017

Young people’s attitude towards having children

Young people have an undermining attitude towards having children. On one hand, they place a greater emphasis than their parents' generation on personal freedom, rational choice, and hedonistic values. On the other hand, the costs, financial and opportunity cost, of raising a child increase in many societies.

Asking people at their 20s or 30s whether they want to have children, they often give answers based on whether they like children, with a differentiation between liking playing with others’ children and taking care of their own children. The value of children to their life and happiness is barely taken into their consideration, not to mention motivations such as the responsibility of continuing their bloodline for the family or contributing to sustaining the development of the society. The decision of having children is more of a thing about personal feeling of dealing with children. 

Young people who decide to have children attach more importance to the quality than their parents’ generation. They thus spend more money and time on their children’s daily lives, education, interests, etc. As such spendings are a long term “investment” that the outcomes are not seen immediately, parents often decide what and how much to invest by comparing with others, which is likely to lead all parents to spend more. This is for sure the case in societies like China, and probably also in more developed societies. Many developed countries heavily subsidise childcare. This could reduce the financial costs of having and raising children. A study shows finances is still the main reason for not having children in the USA (see In these countries, however, the opportunity cost for young people to have children is also high, because they have better opportunities to live a happy life without having a child.

Saturday, 12 March 2016

Land Transfer in Rural China

Two forms of land transfer

As farmers in rural China immigrate to cities, their farm land, which is only allowed to be used for farming, in villages needs to be transferred to others. In most cases, one's land is transferred to his family members in his village. The closer family members have higher priority to receive the land. This is the norm that all farmers follow. The farmers still have the sense that land belongs to their family. So when an family member does not use the land he is distributed, it should naturally be transferred to other family members. Only when no member in this family can receive the land, it can go to someone outside the family. The next adequate receiver is usually the neighbours, who are just less intimate than family members. The land is seldom transferred to someone outside the village (natural village, or group under administrative village) as all the land is owned by the collective that is made up of all members in the village. 

The above describes the spontaneous transfer among farmers in the same village or occasionally involving farmers in nearby villages. The amount of land involved in a single transfer is generally very small, but most of the transfers in rural China are conducted in this way. These transfers are unorganised and informal. Contracts are not used in these transfers. They often bring about disputes and conflicts. The government wants to reduce this form of transfer and encourage the transfer in a more standard way that use contracts. Nowadays, more and more transfers use contracts. The form of transfer usually involves a large amount of land and many households. The transferee are usually legal entities such as agricultural companies, farmers' cooperative and family farm. Compared with farmers' spontaneous transfer, the rents paid to the transferrers are higher.

Therefore, two forms of land transfer take place in rural China, the farmers' spontaneous transfer and the organised transfer. Still, the former is the majority in rural China.

Three types of land rights

In rural China, the farm land in a village is own by the collective that is made up of all famers in the village. This is, the collective has the ownership of the land. The collective contracts out the land to each household. The most recent contracts between farmers and the collective are signed around 1998 and the tenancy is 30 years. Farmers have the right to possess, use, profit from and transfer the land out during the tenancy. These rights together are termed as farmers' contractual right. When a farmer transfer his land to another farmers, the transferee will obtain the right to operate the land.

Ownership, contractual right and right to operate are the types of property rights that matter for the farm land in rural China. The contracting between the collective and farmers separates the ownership and contractual right, and the land transfer separates the contractual right and right to operate.

Tuesday, 4 August 2015

Writing PhD Thesis Conclusion

Writing a conclusion is an important part of thesis dissertation writing. Ideally, a good conclusion should be able to provide a good picture of what the thesis is about. The conclusion should also give a clear impression that the purpose of the thesis has been achieved. The conclusion of a research reaffirms the thesis statement, discusses the issues, and reaches a final judgment. However, the conclusion is not just a summary – it is statement based on your reasoning on the evidence you have accumulated. This is where you share with readers the conclusions you have reached from your research.Writing PhD ConclusionIn a nutshell, the conclusion should stress the importance of the thesis statement, give the thesis a sense of completeness, and leave a final impression on the reader. The conclusion is generally the place to explore the implications of your topic or argument. The conclusion chapter seeks to:

  • Tie together, integrate, and synthesize the various issues raised in the discussion sections, while reflecting the introductory thesis statement(s) or objectives
  • Provide answers to the thesis research question(s)
  • Identify the theoretical and policy implications of the study with respect to the overall study area
  • Attempts to carry the examiner or reader to a new level of perception about the thesis
  • Highlight the study limitations
  • Recommend direction and areas for future research

There are many variations and styles on how to write a thesis conclusion. However, there are some common elements of a conclusion:

  • A summary of the main text or main points of the study
  • A deduction made on the basis of the main body (i.e. Concluding statements)
  • The writer’s personal opinion on what has been discussed
  • A statement about the limitations of the work
  • The implication of the work for future research (i.e. Recommendations)
  • Other important facts and figures not mentioned in the main body

Below are some tips that will help in writing a PhD thesis conclusion:

  • In your conclusion, you must extract the key aspects of relevant literature and explain how these are justified or contradicted your research.
  • When discussing the limitations of your research, do not be too negative or over-modest about your achievements. What is most important is to emphasise the contribution that your research project will make.
  • The conclusion should synthesise what has been previously discussed. It must pull together all of the parts of your argument and refer the reader back to the focus that you have outlined in your introduction and to the central topic.
  • Be very systematic, brief, and don’t introduce any new information. The conclusion should add to the overall quality and impact of the research. It should be able to stand on its own and provide a justification and defence of the thesis.


Friday, 15 May 2015

Optimization in R

Many statistical techniques involve optimization. The path from a set of data to a statistical estimate often lies through a patch of code whose purpose is to find the minimum (or maximum) of a function. Likelihood-based methods (such as structural equation modeling, or logistic regression) and least squares estimates all depend on optimizers for their estimates and for certain goodness-of-fit tests. Base-R offers the optim function for general-purpose optimization. Through a conversation with John Nash, author and maintainer of optim and the newer optimx, learn about the pitfalls of optimization and some of the tools that R offers.

Statistics is nothing if not an exercise in optimization, beginning with the sample average and moving on from there. The average of a group of numbers minimizes the sum of squared deviations. In other words, the average minimizes the sum of terms like (x_i-avg)^2. The median minimizes the sum of absolute deviations—terms like |x_i-med|.

The underlying strategy for most statistical reasoning is:

1. Write down a probability model that should account for the data.
2. This model will contain some unknown constants, or parameters.
3. Collect the data.
4. Find values of the parameters that best account for the data.

That last point contains the optimization. Maximum likelihood is an optimization procedure that selects the most plausible parameter values for the data you got. Parameters can be estimated in a number of ways, but all of them involve an optimization.

Interestingly, you can optimize most of the models taught in a beginning statistics course with a closed-form expression. Mathematically, finding the mean and variance of normal data, estimating a proportion, fitting a regression line, and modeling treatment and block effects in experimental design are all optimization problems. Their solutions emerge as the solution of a system of linear equations. The statistician hands over the problem to a software package, trusting that the linear algebra algorithm will produce stable estimates of the parameters.

For just about any model outside of the linear models I mentioned, closed-form solutions do not exist. You need not go far to find practical examples. Consider a bank that wants to predict whether prospective customers will default on their mortgages. The bank's historical data show the default status (a binary outcome coded Yes-No) of numerous customers, together with personal and financial information, such as employment status, years with current employer, salary, marital status. Estimating the contributions of each of these pieces of information boils down to estimating the parameters of a logistic equation. No closed-form expression exists for the best parameters of this model, so a numerical procedure is required to estimate the parameters and optimize the likelihood.

The same is true of other generalized linear models, structural equation models, and many other models that are used in modern statistics. Most of the heavy lifting in these problems, and the software that delivers the results, relies on a numerical optimization algorithm.

The usual graduate program in statistics, even at a good school, teaches you a lot about the theoretical properties of these estimates. And the theory, to be sure, paints an optimistic picture. Theory shows that under certain conditions, most people forget with time, and given a large enough sample size, the solution to the optimization problem (the maximum likelihood estimate) is the solution to the estimation problem. Solving the maximum likelihood problem gives you the estimates necessary to complete specification of the model. Even better, the estimates behave nicely (are normally distributed). You can even estimate how accurate they are from the curvature of the maximum likelihood function near its optimum value. At least, if the sample size is large enough, these nice properties will hold.

You then hand the problem over to an optimization algorithm, confident that your work is done. But is that confidence well placed?

Thursday, 9 April 2015

Institutions, Procedures, Norms

One of the noteworthy aspects of the framing offered by Victor Nee and Mary Brinton of the assumptions of the new institutionalism is the very close connection they postulate between institutions and norms. (See the prior posting on this subject). So what is the connection between institutions and norms?

The idea that an institution is nothing more than a collections of norms, formal and informal, seems incomplete on its face. Institutions also depend on rules, procedures, protocols, sanctions, and habits and practices. These other social behavioral factors perhaps intersect in various ways with the workings of social norms, but they are not reducible to a set of norms. And this is to say that institutions are not reducible to a collection of norms.

Consider for example the institutions that embody the patient safety regime in a hospital. What are the constituents of the institutions through which hospitals provide for patient safety? Certainly there are norms, both formal and informal, that are deliberately inculcated and reinforced and that influence the behavior of nurses, pharmacists, technicians, and doctors. But there are also procedures -- checklists in operating rooms; training programs -- rehearsals of complex crisis activities; routinized behaviors -- "always confirm the patient's birthday before initiating a procedure"; and rules -- "physicians must disclose financial relationships with suppliers". So the institutions defining the management of patient safety are a heterogeneous mix of social factors and processes. 

A key feature of an institution, then, is the set of procedures and protocols that it embodies. In fact, we might consider a short-hand way of specifying an institution in terms of the set of procedures it specifies for behavior in stereotyped circumstances of crisis, conflict, cooperation, and mundane interactions with stakeholders. Organizations have usually created specific ways of handling typical situations: handling an intoxicated customer in a restaurant, making sure that no "wrong site" surgeries occur in an operating room, handling the flow of emergency supplies into a region when a large disaster occurs. The idea here is that the performance of the organization, and the individuals within it, will be more effective at achieving the desired goals of the organization if plans and procedures have been developed to coordinate actions in the most effective way possible. This is the purpose of an airline pilot's checklist before takeoff; it forces the pilot to go through a complete procedure that has been developed for the purpose of avoiding mistakes. Spontaneous, improvised action is sometimes unavoidable; but organizations have learned that they are more effective when they thoughtfully develop procedures for handling their high-risk activities.

This is the point at which the categories of management oversight and staff training come into play. It is one thing to have designed an effective set of procedures for handling a given complex task; but this achievement is only genuinely effective if agents within the organization in fact follow the procedures and protocols. Training is the umbrella activity that describes the processes through which the organization attempts to achieve a high level of shared knowledge about the organization's procedures. And management oversight is the umbrella activity that describes the processes of supervision and motivation through which the organization attempts to ensure that its agents follow the procedures and protocols.

In fact, one of the central findings in the area of safety research is that the specific content of the procedures of an organization that engages in high-risk activities is crucially important to the overall safety performance of the organization. Apparently small differences in procedure can have an important effect on safety. To take a fairly trivial example, the construction of a stylized vocabulary and syntax for air traffic controllers and pilots increases safety by reducing the possibility of ambiguous communications; so two air traffic systems that were identical except with respect to the issue of standardized communications protocols will be expected to have different safety records. Another key finding falls more on the "norms and culture" side of the equation; it is frequently observed that high-risk organizations need to embody a culture of safety that permeates the whole organization.

We might postulate that norms come into the story when we get to the point of asking what motivates a person to conform to the prescribed procedure or rule -- though there are several other social-behavioral mechanisms that work at this level as well (trained habits, well enforced sanctions, for example). But more fundamentally, the explanatory value of the micro-institutional analysis may come in at the level of the details of the procedures and rules in contrast to other possible embodiments -- rather than at the level of the question, what makes these procedures effective in most participants' conduct?

We might say, then, that an institution can be fully specified when we provide information about:
  • the procedures, policies, and protocols it imposes on its participants
  • the training and educational processes the institution relies on for instilling appropriate knowledge about its procedures and rules in its participants
  • the management, supervision, enforcement, and incentive mechanisms it embodies to assure a sufficient level of compliance among its participants
  • the norms of behavior that typical participants have internalized with respect to action within the institution
And the distinctive performance characteristics of the institution may derive from the specific nature of the arrangements that are described at each of these levels.

System safety is a good example to consider from the point of view of the new institutionalism. Two airlines may have significantly different safety records. And the explanation may be at any of these levels: they may have differences in formalized procedures, they may have differences in training regimes, they may have differences in management oversight effectiveness, or they may have different normative cultures at the rank-and-file level. It is a central insight of the new institutionalism that the first level may be the most important for explaining the overall safety records of the two companies, even though mechanisms may fail at any of the other levels as well. Procedural differences generally lead to significant and measurable differences in the quality of organizational results.


Wednesday, 25 February 2015

Count Occurrences of Factor in R

events <- data.frame(type = factor(c('A', 'A', 'B'), c('A','B','C')), quantity = c(1, 2, 1))

# Method 1

# Method 2
xtabs(quantity~type, events)

# Method 3
aggregate(quantity~type, events, FUN=sum)

# Method 4
ddply(events, .(type), summarise, quantity = sum(quantity), .drop=FALSE)

Thursday, 19 February 2015

Adjacency Matrix is an amazing Tool for Analysing Networks

I work a lot with adjacency matrix, a way of representing a relationship network. Adjacency matrix transfers a network graph into a well developed mathematical form. This opens the door to analysing networks using rigorous mathematical tools. The more I use it, the more useful I find this invention is.

1. In addition to indicating which nodes link to which nodes, with or without direction -- the most fundamental function, the matrix can conveniently reflect how important the links are (adding weight values to the corresponding elements).

2. Doing various elementary transformations of the adjacency matrix can achieve a variety of changes of the network, such as changing the order of the nodes, merging the relationships of two nodes.

3. One can assign attributes to nodes by multiplying the matrix (by row or column) with a vector storing the attributes.

Tuesday, 3 February 2015

Dropping Factor Levels in R

  • drop.levels {gdata} # Drop unused factor levels
  • droplevels {base} # The function droplevels is used to drop unused levels from a factor or, more commonly, from factors in a data frame.
  • When creating data frame or importing data into data frame (loading data with read.table, read.csv or the like), character vectors are converted to factors by default. To avoid this, set option (stringsAsFactors = FALSE)