Matlab learning log (1)



Programming is fun and rewarding. It is similar with writing in that you reach clarity and elegance through constant revision. As a beginner in Matlab, I’m starting a learning log to record my thoughts along the way. This time, my thoughts come from homework problems for my Demand Estimation class and a dynamic programming problem in my RA work.

1. Be clear about the steps you need to take before you write down any code. If you have a model to guide your analysis, make your code as consistent with the model as possible. Sometimes a tree structure or flow chart can help you think more clearly. Once you start writing the code, it is very easy to get lost in the details (e.g. vector dimensions).

2. In a loop, have a clear idea of the relationship between variables and when and where a variable needs to be defined. For example, empty vectors/matrices to store estimates should be defined before the estimates are produced.

3. Use vectors where possible to make calculations more efficient. For someone like me who is spoiled by straight-forward “programming” in Stata, this is something I need to learn.

Learning a new programming language is like getting to know a new friend. Over time you learn about her strengths and weaknesses, and how she can complement you to make your work more productive. Starting next week I will be taking a course on entry games taught by Professor Allan Collard-Wexler. Looking forward to learning more about programming and IO theory in the next seven weeks!

Learning from writing research proposals



Now that I’m done with my PhD micro midterm and two proposals, I finally have some time to write down what I’ve learned in the past few weeks. The learning curve was pretty steep, and there were moments when I felt more torture than excitement. Many thanks to JG for help and support along the way.

I encountered major difficulties when I was writing my proposal for the public finance class. My topic was on the wage gap between rural migrants and urban local workers in China, and I found it difficult to 1) state a clearly framed question and 2) find the right conceptual framework/economic model to address it.

Stating a clearly question is not always easy. It was only by talking with my professor and fellow PhD students that I discovered I didn’t know what exactly my question was. A well framed question might be “How does policy A affect outcome B in region C?”, or “What is the level of substitution between product A and product B in market C?”, or something slightly more general than these. I found that as beginners, it’s very easy to make one of the following two mistakes (or both):

1. Thinking too much in descriptive terms but not being able to write down a clear question. This will become obvious when you are explaining your research to a colleague or even a friend who is not in the economics profession.

2. Getting too ambitious and hoping to address too many (complex) questions in one paper. This might lead to failure in finding a suitable framework/model to address all your questions. I was heading towards this direction until an upper year PhD student kindly pointed it out in our conversation.

Solutions for these problems? Sorry, I don’t really know any since I’m also struggling through this process. But the following two practices should in general be helpful:

1. Explain your research to others. Sometimes we tend to avoid talking about research with others, but then we are less likely to be aware of any lack of clarity in our research questions or any invalid assumptions we are making. It is better to “lose face” in front of a friend than to lose track of where you exactly are with your research.

2. Start simple. Find the central question you are trying to address, and write/use a model for that goal. If the question you are asking is too complex, break it down into pieces or find a simple example to illustrate. When I was writing my model, it felt like banging my head against the wall. In retrospect, however, it was because I was trying to feed too many things into a model and it confused myself.

When we are writing proposals, we should also develop a positive and proactive attitude. It can be frustrating, especially for beginners (like me!), but with challenges comes fast progress and eventually we become better. I think an open mindset and positive attitude are really important for doing a PhD in general.

A story to share at the end of this post: I ran into a third-year PhD student the other day. He asked:”How has your first year been?” I was struggling to come up with a model for my demand estimation class, so I looked at him with weary eyes and said:”Tired, it’s pretty challenging.” He asked further:”Are you bored?” “No! No way!”I shaked my head. “Well, that’s good.” He smiled. I am starting to understand the importance of maintaining the passion for doing research in doing a PhD and becoming a good researcher.

Two things learnt about identifying research topics

I was talking to a professor about my ideas for the research proposal. Last week I was telling him I’d do something related to planned obsolescence but thought it would be really hard to find credible data to evaluate the level of planned obsolescence. Although it is a fascinating and important topic (theoretically and practically), there is almost zero empirical study and therefore no empirical framework for me to directly adopt.

When I expressed my concerns, the professor straightened his face and said seriously: “You can’t have this attitude when you’re looking for research topics. I know it’s hard to find data for this, but that doesn’t mean you CAN’T do it.” Then he went on to suggest a few potential sources (most anecdotal). I think he was right about the attitude. The very essence of research is the discovery of something new. This is where excitement and frustration come from, where years of work are spent. To become a successful researcher, I need to get rid of the fear for the unknown and undefined.

The second thing I learnt is the importance of justifying why your research matters. This is important because a) you can only succeed at something you truly have passion about and interested in finding out the answer, and b) you will need to convince others that your research matters to get a job and (more importantly) to establish your credibility in your field. I’ve seen a couple upper-year students present their research and failing to tell the audience why we should care. The result is a group of semi-asleep audience and little useful feedback.

“How to build an economic model in your spare time?” by Hal Varian


, ,

As I’m trying to build a model for my public economics research proposal, I am struggling to piece together my thoughts and find a suitable framework for my interest. Then I stumbled upon this piece of great advice from Hal Varian. I’m definitely going to put his advice to practice.

If you’re a graduate student in economics or even other disciplines, you might find it useful.

When do we need models and how to write them?

These are important questions I’ve been thinking about recently, and here are some thoughts to share. The answers are open, and I welcome your contribution of thoughts.

When do we need models? In a broad sense, I think every paper needs to have a conceptual framework to guide the analysis and explain the patterns in the data. In the preliminary stage of a piece of research, writing down the exact assumptions and predictions of the model can also help a researcher to organize her thoughts and frame her question better. That said, whether a structural model is needed really depends on the purpose of the paper. If the point of the paper is to propose a new model, then obviously a model is necessary. However, for papers which contribute in estimation methods a review of relevant models is sufficient.

What makes a good model? One of my professors gave this piece of advice: Make the parts of your paper that aren’t the point of the paper as simple as possible, and spend the richness in the part where your innovation is. It is all too easy to come up with complicated assumptions and notations in every dimension of your model, but adding complexity also sacrifices flexibility and robustness. Another piece of advice, given by the same professor, is “don’t let the perfect get in the way of the good”.

A side note: I have found writing skills to be extremely important in economics, or maybe in all research disciplines. One might not need to be an extraordinary writer to succeed in research, but failing to convey one’s ideas smoothly definitely reduces the rate at which they spread and benefit others.

What I’ve learned in my first three weeks as a PhD student



The first three weeks of the fall semester flashed by, and I feel the urge of summarizing a few things I’ve learned so far before I lose track of them. Unlike most first-year PhD students, I only need to take two of the six core courses (micro I and macro II) and am therefore taking two field classes — Demand Estimation with Prof. Jimmy Roberts and Topics in Public Econoimcs with Prof. Juan Carlos Suarez Serrato. I’m also attending lunch groups and seminars to have a better idea of what frontier research is like in different fields.

In Demand Estimation we are studying models of firm behavior such as pricing strategies, collusion vs. perfect competition, introduction of new products, etc. Horizontal and vertical product differentiation are the two conceptual frameworks often used to model the product space. In vertical product differentiation, consumers agree on the desirability of products but have different willingness or ability to pay. With horizontal product differentiation, consumer tastes vary, and product characteristics affect demand. Although I’m not an IO expert yet, I’ve learned that industry knowledge is essential for you to succeed in this field, whether you learn it from experience or from reading. An entrepreneurial spirit is valuable when it comes to finding data.

I’ve also learnt a few things from practice job market talks, seminars, and student presentations.

First, establish your research question before you address it. Clearly framing the question, positioning it in the literature, and describing its contribution are essential before going into the details.

Second, always know what you are explicitly and implicitly assuming in your model. This is especially important for people using the reduced-form approach. Not having a structural model shouldn’t be the excuse for not thinking through the underlying mechanisms.

Third, make sense of your results, in numerical and economic sense. Comparison with existing well-known results can be useful. This is especially true for policy-relevant questions.

Last but not least, interpret, or at least speculate the mechanisms behind your results if they are unexpected.

Now that I’m formally in the PhD process, I’ve come to realize that “work-life balance” is such a vacuous claim. The best time management strategy for me (at least for now) is to have a clear timeline of the things that need to be done (i.e. with a strict deadline) but also bear in mind the long run goals. Don’t work so hard to get burned out early. Instead, organize your life so that you work efficiently and deliver what you need to deliver. As JG has wisely pointed out, no one will get an award for working all day without a rest.

How to display Chinese characters in Stata in Windows 8


Researchers using Chinese data are often disappointed by the inability of Stata to display Chinese characters correctly. The solution from the most reliable source I can find online:

Most modern software (OS and applications) work with Unicode. Stata does not work with Unicode. Unicode encodes characters with 2 or more bytes. In Stata each character must be 1 byte only. You need to make sure the input CSV file is encoded in a codepage proper for your region, presumably 1252.

It’s actually simpler than that. If you’re using Windows 8 like I do, the steps are as follows:

1. Go to Control Panel->Language->Advanced Settings.

2. Click into “Apply language settings to the welcome screen, system accounts, and new user accounts”.

3. In “Administrative” tab, under “language for non-Unicode programs”, change it to Chinese (Simplified). You might need to change system locale if your computer wasn’t initially set to be “located in China”.

Note that you don’t need to change your preferred language or system display language. The above steps should also work for other languages as well. Hopefully my note can benefit other researchers.

P.S. I didn’t want my first post in the semester to be this technical, but this kind of reflects what’s on my mind.

Concluding remarks for my voice class: what I’ve learned about my own singing

I have always had difficulty opening up the space (in my mouth) for singing and projecting my voice actively. I often shy away from high notes simply because I am not confident that I can sing them. In this class I have found it useful to imagine myself as a tree expanding its roots deeply into the ground – this allows me to focus on deep breathing rather than the fear that the note would come out badly.

Another problem I often have is ineffective breathing. Sometimes I don’t open my chest enough and therefore run out of breath easily. Putting my hands on my chest and trying to make the middle fingers apart proves to be a good reminder for me to breathe adequately, although it might look artificial.

I have benefited a lot from the exercises to increase the “flow” of my performance. Singers need to put themselves under a reasonable amount of (mental) pressure to do everything right: deep breathing, utilizing head voice, correct posture, etc. But too much pressure within the body often leads to tension in the throat and unnecessary interference from the muscles, causing the voice to sound squeaky. Notes, as shown in sheet music, are merely dots. Our voice should be the line that connects these dots and brings the flowing melodies to life. It is useful to imagine myself being a willow tree with its branches moving gently in the summer breeze. Another approach which I leaned in this class is to wave your hand a half circle (from one side of your body to the other) for each phrase before taking another breath, and then alternate to the other hand.

For me, singing brings out courage and confidence. As a singer, I have to push myself hard, to observe and critique impartially, to challenge myself and refine myself. The best thing about singing is that you can always improve given the right tools and enough practice. Right!! I was also glad to know that women can open up their hip bones better after having children and can touch upon lower notes as they grow older. Indeed, my 23-year-old voice is much fuller and richer than my 16-year-old voice! It is absolutely fulfilling to see myself expanding the range of quality of my singing. I’m seriously considering taking private voice lessons in the next semester — I can just imagine myself being a lot happier with music in my life.

Concluding remarks for my voice class: general singing techniques



Some of these are mentioned in my previous posts, but I think it’s good to write a comprehensive post for future reference.

Breathing, posture, resonance, and diction are four integrated components of singing. A good singer always has support and breathes deeply. She should not let muscles in the throat or other parts of the body interfere with her voice. Deep breathing is what differentiates singing from everyday talking. As Dr. Linnartz puts it, “Singing can be pitched talking or beautified hollering”. When we holler we breathe deep using our belly, allowing the air to go all the way up into our skull. We therefore produce a much fuller voice than when we simply “attach” pitch to talking in words. Deep breathing is the basis of professional singing and a lifelong practice that every singer needs to maintain.

A correct posture is a necessary condition for good singing. Singers should always keep a “high neck”, with “neck” referring to where the spine joins the skull. Keeping the “neck” high forces us to open our chest and straighten our back, which then allows us to breathe deeper and makes sure air flows freely from our belly all the way to our head. Singers also need to have an athletic stance, with feet apart, one in front of the other as if you are ready to fight. Make sure your front leg carries some weight and you are not too laid back.

With correct posture and breathing, resonance gives our voice richness and a fine texture. It is important to find the “buzz” position in our head and project our voice into the resonator. Singing “in a high position” entails buzzing the space above your nose and projecting your voice in your head. Try “Mmmm….”, first without pitch and then with pitch. Feel the vibration above your nose, and that is what we call a “buzz”. As singers, we need to maintain that buzz no matter what consonants or vowels we are singing. More “buzzing” also enhances your presence in the room.

Diction is an important yet often ignored part for singing. Good breathing, posture and resonance might ensure a singer to always be on the pitch, but they do not guarantee the singer can perform a song at its entirety. Every syllable in the lyrics matters, because any inadvertent mistake or imprecise pronunciation gets amplified in singing. For example, I tend to swallow the “n” and “d” sounds when I sing, and that gives the audience a sense of “unfinishedness”. These end-of-word consonants need to be clearly pronounced without falling off the pitch.

Here are a few more specific rules in diction:

1. Never say “r” before a consonant or at the end of a word, unless the next word in the sentence begins with a vowel sound. Such cases are plenty in Over the Rainbow.

2. Words ending with “n” and “d” should not be silenced. This is often overlooked, and I remember my choir conductor reminding us all the time.

3. Delay the second part of a diphthong to the very end of a sentence. A good example is “Oh hush little baby, don’t you CRY” (from Summertime) where the “i” sound should be placed at the very end.

4. Vowel modification is necessary in high pitch. For example, it is useful to sing “r-ah” for “rain” in “just a step beyond the rain” (from Over the Rainbow).

Good singers turn on their full energy when they are performing. When we talk with others, we can get by vague pronunciation and low sounds by just guessing. Unfortunately, inadequate energy will make a singing performance a nightmare for the audience. The prevalence of microphones and amplifiers makes it unnecessary for singers to produce a loud volume, but this shouldn’t be a reason to compromise their sound quality. It is useful to imagine yourself in a big theater without any voice-amplifying device and try to make yourself heard. Enunciation is needed to make the words clearer and the performance fuller.

It is also important to put your song in a particular context which you can relate to. Attaching meaning to a song makes memorizing the lyrics much easier, and it allows the singer to incorporate her emotions naturally into the song. Singing a song over and over again doesn’t necessarily improve one’s familiarity with the lyrics, not to mention a fuller understanding of what the song is about. Singing sometimes can mute the emotions within words by adding flowing melodies to them. Speaking them out allows us to savor the feelings conveyed by the lyrics and become more aware of what the author wants to achieve through the song. We should always make sure we understand every word in the lyrics, not only its dictionary definition but also its context and implications. For example, in the song Danny Boy, the pipes are calling as a sign of war, and son is leaving home to the army and he has an unpredictable future ahead of him. This explains why the father is worried (“If I am dead, as dead I well may be”).


Attending Duke Economics for my PhD


The long and stressful PhD application process has finally come to an end. I have got a few offers and waitlists, and after careful considerations I have decided to stay at Duke and pursue a PhD in economics. While this path is guaranteed to be challenging, I cannot wait to explore the interesting questions in various fields of economics. I am confident that I will do well in this profession.

I feel lucky to have attended Duke’s economics masters program, where I met so many caring mentors and excellent peers. The masters program also makes my transition into the PhD program smoother. Since I will be exempted from four out of six PhD core courses, I can start working on researcher earlier! But I’m definitely going to take this summer off, because as one professor of mine puts it:”if all goes well for you, it’ll be the last long period of leisure you’ll have until retirement”.

Two years after graduation, I find my education at The University of Hong Kong extremely helpful for my long-term personal growth. Although a significant portion of my life there was spent worrying about not overcoming challenges and being disappointed by explicit and implicit discrimination, I have become much more resilient to pressure, more confident, and more caring to others. My experience as the vice chairperson of Union Choir has taught me a lot about working with people from different backgrounds, which I believe will be beneficial no matter what career I choose. It also made me a better singer, without doubt.

Coincidentally, this is the 300th post of my blog. I will continue writing, hopefully with more insight as my research opens up new windows of opportunities for me.


Get every new post delivered to your Inbox.

Join 92 other followers