Monday, December 29, 2008

Lyx as an equation viewer

Lyx's new "view source" panel makes it an ideal WYSIWYG equation editor for LaTeX, just like MathType.

Saturday, December 27, 2008

Fortran on Linux

Useful web site on this topic:


A reincarnation of the old mixed-effect programs:

Will be interesting to find out more about it, especially what it can do while others (Stata, aML, Mplus, etc.) cannot.

A major advantage of xpdf over acrobat

Using Acrobat pdf reader, I have to close the reader every time I re-compile my LaTeX source, which is tedious. This is not the case of xpdf. Xpdf works the same way as xdvi or yap: it automatically updates the pdf file.

Friday, December 26, 2008

Research in Social Stratification and Mobility

This journal also accept:

Journal of Population Economics

Also allows LaTeX submission:

Scientific Commons

They did a good job tracking my work in progress:

Thursday, December 25, 2008


This R package ( looks interesting. For one thing: it can do Conway's game of life.

Wednesday, December 24, 2008

Getting Stata graphs into LaTeX

Under Linux, the easiest way would be to export Stata graphs to EPS format, then use the command line tool "epstopdf" to get them into PDF.

Interestingly, this procedure does not seem to work under Windows.

Tuesday, December 23, 2008

Another paper

I was informed that my paper "Does famine have a long-term effect on cohort mortality? Evidence from the 1959-1961 Great Leap Forward Famine in China" has been accepted for publication at Journal of Biosocial Science.

The working paper version can be found here:

Monday, December 22, 2008

Writing posters using LaTeX

I have two posters to do for PAA 2009, and just found this article showing how to do posters using LaTeX:

Start Cygwin with rxvt

Sunday, December 21, 2008

Bridging R and Python

Project RPy looks promising:

Saturday, December 20, 2008

LaTeX: turn off section numbering

Put this before the "\begin{document}": \setcounter{secnumdepth}{0} .

Friday, December 19, 2008

How is Microsoft with Vista like the Big Three automakers?

Interesting observation:

More LaTeX resources


Thursday, December 18, 2008


A Chinese web site dedicated to statistical technique:

Wednesday, December 17, 2008


Finally, an open-source cross-platform and easy-to-use mind mapping software:

Quantitative Data Analysis: Doing Social Research to Test Ideas

I am really glad to see Don's new book is out:
It is one of the best textbooks on the market that can help social science students and applied researchers to learn data analysis using Stata.

Ecological Models and Data in R

Good book:

Stata and R graph examples

  • Stata graph gallery:;
  • R graph gallery:

Tuesday, December 16, 2008

Demographic Research

Demographic Research ( is the only population journal that takes LaTeX submission. I hope there will be more adopters soon.

How to write a book using LaTeX, R, and Sweave

Small is beautiful

I agree with the Economist on this:

Monday, December 15, 2008

Text summarizer

This looks interesting:

Saturday, December 13, 2008

MiKTeX for Linux

Will be interesting to check out when it matures a little:

Writing journal article using LaTeX

I have been intimated by the fact that many journals, especially in the filed of social science, accept only Word format submission. Writing in Word has been a terrible experience for me: error-prone, hard to automate, etc. But I have not been brave enough to go out and explore the possibility to mainly work on LaTeX and figure out ways to get the final draft into Word.

After some research, I think now I have all the tools that can handle all the important aspects of this process, and I am going to write my next paper - smoking in China - in LaTeX and see how it eventually turns out.

As a teacher, I will definitely teach students how to combine Linux, Emacs, LaTeX, Stata, estout, R, and sweave to automate the process of data analysis and results reporting. Maybe that will make a difference in the future.

Friday, December 12, 2008

Linux laptop

I especially like the System 76 (for its Ubuntu-specific feature) and Los Alamos (for its Thinkpad hardware, they even offer the new ultraportable X300!), and really wish that they could combine strength.

ESS (Emacs speaks statistics) has a new version out today

Wednesday, December 10, 2008

This is unbelivable

Open source and acedemia

Interesting materials:

Bash vs. Python


Emacs as Python IDE

Tuesday, December 09, 2008

Linux and the Unix philosophy

A very good book. It should be one of the first readings any college student should do, in my opinion.

Here is part of the book made available by Google Books:

OpenOffice 3 on Ubuntu

The broken Ubuntu repository for OO3 has been fixed. Now it is possible to follow the instruction to upgrade from OO 2.4 to OO 3:

Here is an interesting review of different open source office suites:

Sunday, December 07, 2008

Creating R packages

Here are some detailed instructions:

NIH proposal in LaTeX

I never would think NIH proposal can be done in LaTeX:

Another truly amzing LaTeX resource:

How to write a LaTeX package:

Saturday, December 06, 2008

Automatic table making using R

R provides several facilities to automate the table making process. The XTABLE package can produce summary tables and tables for single model results. HMISC and DESIGN have some facilities to get the results into LaTeX (I have not tried them); MEMISC can produce multiple model result table; and this tiny package, APSRTABLE, seems to provide quavalent functionality and more flexible.

Here is another approach and some examples:

Using g++ with numerical recipes

Some instructions:

Here is another interesting post:

Ubuntu vs. OSX

  1. How to install Ubuntu on a Macbook:
  2. Ubuntu vs. OSX:
Now I realize that these two posts were from the same person:

Thursday, December 04, 2008

Two more papers of mine

Netbeans and gfortran

I know that Eclipse has a good FORTRAN ide called Photran. I also know that Sun has a compote FORTRAN development tool chains called Sun Studio. What I did not know is that Netbeans itself is a good IDE for gfortran, the default FORTRAN compiler for most Linux distros today.

Here is a really simple debugging session.

Python 3

Python 3 has been released: It will be interesting how well it is received by the majority of Python programmer.

Wednesday, December 03, 2008

Automatic table making using Stata

Definitive guidelines:

Monday, December 01, 2008

LaTeX to other format

Here is a solution:

Here is another one:

And this one:

A summary:

For equations:

Sunday, November 30, 2008

Tuesday, November 25, 2008

AD Model Builder

The ADMB team seems to be open-sourcing their nonlinear statistical library, AD Model Builder. I took a quick look at the document and have mixed feeling. On the one hand, the software is strong in modeling capability; on the other hand, it works at very low level and use C++ as the modeling language. Unless it can solve important problems that other packages such as Stata, R, aML can not, I don't see a C++ based modeling environment gains popularity among social sciencites any time soon.

Anyway, it is another fun toy to play with.

Sunday, November 23, 2008

Buffer tab in Emacs

I follow instructions in this post ( to get a nice-looking and functional buffer tab in Emacs. Looks good:

Saturday, November 22, 2008

There is still no cure model facitility in R

I remember a while ago I posted a message to R mailing list asking about the cure model (long-term survivor model) using R, somebody pointed me to:

But the author does not provide source code and there is no Linux binary. These are the same options when I was in graduate school in the early 2000s. By contrast, now Stata has "strsmix" and "strsnmix" to do both mixture version and non mixture version of the cure model, both are very well documented.

SciViews-K does not work with the new KomodoEdit

I just updated my installation of KomodoEdit from 4 to 5, and SciViews-K stopped working. This is a bit frustration, but I have not been using it much anyway. It would be nice if the author can fix the problem soon.

Friday, November 21, 2008

Stata equavalence to Zelig

The R package Zelig can generate meaningful results such as predicted value, expected value, first difference, etc. from a wide variety of statistical procedures via simulation or bootstrapping. The Stata module "prvalue" and "prgen" seem to do at least a subset of what Zelig can do. Interestingly, the authors did not mention Gary King's work on Zelig and "Clarify".

However, it does not seem to work with mixed effect models.

The art of Unix programming

Yesterday I checked out a book named "the art of Unix programming" by Eric Raymond. Wow, this is a truly great book. Now I know that it is not a coincidence that I enjoy R, Emacs, and Linux: they are all part of a grand tradition that has nurtured many brilliant scholars and hackers.

Very good book indeed.

Tuesday, November 11, 2008

My paper

Here is the url of my paper:

Sunday, November 09, 2008

Ubuntu 8.10 DVD

This link:

Saturday, November 01, 2008

A list of books to checkout on Monday

  1. Economic interdependence and international conflict : new perspectives on an enduring debate / edited by Edward D. Mansfield and Brian M. Pollins. [HF1418.5 .E274 2003]
  2. Handbook of data analysis / [edited by] Melissa Hardy and Alan Bryman. [H62 .H224 2004]
  3. Loglinear models with latent variables / Jacques A. Hagenaars. [QA278 .H333 1993]
  4. Introducing network analysis in social work / Philip Seed. [HV11 .S44 1990]

Sunday, October 26, 2008

Fresh install vs. upgrade

As the Ubuntu release dates approaching, the debate of whether a fresh install or an upgrade is the preferred way to get an update-to-date system is re-emerging.

To me, an upgrade is always preferred, simply because it took quite some time to tailor a new system, installing all the required packages, solving dependency issues. It is just too much to do that every once or even twice in a year.

Since I am really busy right now, I may well skip this release and wait for the next one (April 2009).

Sunday, October 19, 2008

Copy and paste in Cygwin

Copy/paste from Cygwin: highlight the text will also put the text in the clipboard;
Copy/paste into Cygwin: shift + mouse click will put the text in the clipboard into the insertion point.

Compile aML under Cygwin using g77

I finally got the time to setup a cygwin environment on my computer and tried to compile aML. After several trial and error, I got it successfully built and tested. The procedure is pretty straightforward, with only one thing to keep in mind: choose g77 3.3 instead of 3.4 otherwise the generated binary will issue an error message "core dump" (and this is probably why aML cannot be directly built on Ubuntu 8.04). I only tested on my 32-bit machine and will try it on my 64-bit Vista office machine on Monday.

This is exciting!

Tuesday, October 07, 2008

Emacs with true type font support under Ubuntu

Following the instructions here (, I finally get a usable Emacs with true type font support (I use Liberation Mono) installed on my Ubuntu notebook. I have to say, this makes a huge difference and makes it much easier for my eyes. I am going to use Emacs more.

Saturday, September 06, 2008

Good article on matching methods

Very good article indeed. The authors have made quite a few number of excellent points.

Friday, September 05, 2008

SciViews key binding

  • Shift-F1 for contextual help on the word under the cursor in the editor
  • Alt-Shift-F1 for help search selected word (make sure to look at the Web menu too)
  • Ctrl-T to expand abbreviation (try typing func, then hit Ctrl-T in a file previously saved with a .R extension; a tooltip also appears when the sequence you type corresponds to a recognize abbreviation... and there are dozens of them already defined!)
  • Ctrl-Return is the same as Return but also run the line of code in R
  • Ctrl-Shift-R to run selection and/or code line by line
  • Ctrl-Shift-A to run all code in the current document in R
  • Ctrl-Shift-H to run a paragraph (consecutive lines of R code)
  • Ctrl-Shift-M to run code between two bookmarks (define bookmarks first!)
  • Ctrl-Shift-S to summarize the object whose name is under the cursor
  • Ctrl-Shift-L to plot the object whose name is under the cursor
  • F3 to search next occurence of the word under the cursor
  • F4 to list R objects in memory (in .GlobalEnv)
  • F7 to set the R working directory to the dir of the current edited file in Komodo

Saturday, August 30, 2008



Wednesday, July 30, 2008

My home page

Here is my new home page, hosted at CCPR:

Semi-automatic table making

Both Stata and R have nice table making facilities, but aML is still lacking this. Here is how I convert aML outputs into Word tables.
  1. Estimate aML models;
  2. Use "maktab" facilities to put different models into one output;
  3. Copy and paste the results into a text file;
  4. Use Excel to read in the file;
  5. Copy and paste the Excel worksheet into Word;
  6. Edit the Word manually from there.
When I have time, I may write a python script to automate this process; but for now, this seems to work reasonably well.

Saturday, July 19, 2008

Another fun article about Linux virus

Friday, July 18, 2008


Firefox is my browser of choice, and camifox is my favorite firefox theme:

Saturday, July 12, 2008

Idiot-proof vs. idiot

I like this sentence: "Programming today is a race between software engineers striving to build bigger and better idiot- proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."


Thursday, July 10, 2008

Komodo Edit is a real deal

Komodo Edit is a free open-source and cross-platform editor geared toward programmers. So far, it is the closest thing to the Windows-only UltraEdit or Vedit in the free Linux world. It is very configurable, and unlike Emacs, it does not require one to know Lisp.

I have been using it for several days, and just found myself doing all my texting editing, R, Stata, aML, Python, in it. Wow...

Wednesday, July 02, 2008

SciViews-K so far so good

SciViews-K integrates Komodo Edit, R, and SciViews to create a comfortable work environment for R users. I tested it in both Windows and Linux and it works well so far. Also, it works with JGR. The powerful editing capability of Komodo Edit and nice object brower of JGR should make a good combination.

Tuesday, June 24, 2008

Interesting problem of JGR

JGR works well with Linux except for one thing: it seems to use lots of CPU time (See the first figure above).

The way to solve this problem is surprisingly simple: simply click the "About" box once, and the problem is solved (See the second figure above).

I do hope the author can fix this bug in their next release though.

Sunday, June 22, 2008


The Cebu Longitudinal Health and Nutrition Survey released two new waves of data: 2002 and 2005. This data looks very interesting. Maybe I should come back to my sequential mixture model paper and give it another serious try.

Saturday, June 21, 2008

Auto-mounting external hard drive

My Ubuntu has been working well auto-mounting my external hard drives until yesterday. I suddenly got "you do not have the privilege to mount this drive". What I did was to issue this command:

gksudo gedit /etc/fstab

and get rid of the last line regarding the external drive, which was left there probably by accident. Now the system works perfectly again.

Friday, June 20, 2008

A list of important reference on son preference

Ben-Porath, Y., and F. Welch. 1976. “Do Sex Preferences Really Matter?.” Quarterly Journal of Economics 90:285-307.


My paper with Sarah "Does Son Preference Influence Children's Growth in Height? A Comparative Study of Chinese and Filipino Children" has been accepted for publication by Population Studies. It is a very good journal, very helpful reviewers, and I am very pleased. Here is the working paper version (will be updated soon):

Desktop broken

Damn my desktop was broken today. It's about three and half years old and running both Windows and Ubuntu. Now neither system works anymore. Looks like hardware failure, most likely to be hard drive problem. I need to get a cheap replacement real soon.

Thursday, June 19, 2008


JGR has become a real competitor as a R GUI front. The Linux version works better than the Windows versions: runs faster, and looks prettier (with native look and feel of GTK). And its object browser is a very helpful tool that is not available in other GUI fronts.

Monday, June 09, 2008

Predict, simulate, and graph aML results

The multilevel and multiprocess software aML is quite amazing. It handles a much greater number of models than most other packages, and it is fast to reach convergence given suitable starting values. However, it does not have lots of facilities for results presentation.

I have used this software for several of my own research. I think it will be highly desirable to streamline the communication between aML and Stata or R. I can think of the following steps:
  1. Estimate a mode in aML;
  2. Extract point estimates and variance/covariance from the output file using Python;
  3. Transfer the extracted results to R;
  4. Predict, simulate, and graph the results with Zelig or other facilities built into R.

Saturday, May 03, 2008

Geany on windows

Finally, the new version of Geany (.14) can compile and run on windows. It provides a nice cross-platform development environment for C, FreeBasic, and Python (the stuff I use).

Friday, May 02, 2008

Just-In-Time compiler

The idea of jit compiler is cool and become very popular because Java's successful implementation. Here is a list of jit compiler for other languages that are particularly interesting to me:
  1. JIT for R:
  2. JIT for python:

Sunday, April 27, 2008

Reduce power consumption under Ubuntu

Friday, April 25, 2008

Multilevel and Longitudinal Modeling Using Stata, 2nd Edition

I got my copy of the new book. A quick glance shows a lot of update from the previous version and many newly added materials. To my surprise, there is still nothing on multi-process model (A.K.A. mixed response model), which GLLAMM can handle.

Tuesday, April 22, 2008

Some more on Ubuntu 8.04

I had bad experiences upgrading from earlier versions using SuSE before (several years ago), so I stopped using online upgrade (not update!), just backup all my stuff and do a clean install each time there is a new version. Upgrading from Ubuntu 7.10 to 8.04 completely changes my option about the most sensible way to upgrade a Linux installation. In both occasions (one on an 4-year old HP desktop, and one on one-year old Sony laptop), the process went really smoothly and yields very stable systems. Congratulations the Ubuntu team, and keep up the good work.

Saturday, April 19, 2008

Upgrade to Ubuntu 8.04

I just upgraded my Ubuntu from 7.10 to 8.04 via online upgrade method. It is still a release candidate but is stable enough. In fact, this is the perfect time to upgrade because all the servers are going to be jammed after the "final" version is released; and, there will be only minor updates between the RC version and the final version in April 24.

The whole process took less than 2 hours, and it is just amazing how smooth it went.

Update: I also upgraded my Sony laptop, which took a bit longer (6 hours or so). The results are very good. The new version seems to be more laptop-friendly, probably due to the new kernel.

Monday, April 07, 2008

A free implementation of the resampling stats language

written in Java. Very cool:

The author claims that he never took statistics course :)

Sunday, March 23, 2008

Finding truth

For people who do not have invested interest in politics or audience rating, finding truth is often the ultimate goal. This blog is very interesting (

Friday, March 21, 2008

Fetal origins

Here are some references:

  1. Hayward, M. D., and B. K. Gorman. 2004. "The Long Arm of Childhood." Demography 41:87-107.

Monday, February 18, 2008

Cure models are tricky

I am trying to estimate cure model (long-term survivor model) using "strsmix" and "strsnmix" in Stata. It took me quite a while to realize that good starting values are crucial for quick convergence, something I only thought of when estimating aML or Mplus models.

Sunday, February 17, 2008

Lots of research resources

This place has lots of research resources:

Saturday, February 16, 2008

Is spring here?

For the firs time in months I opened my windows today. It is warm outside. Maybe the harsh BJ winter has gone and the spring is here.

Monday, January 28, 2008

Friday, January 25, 2008

Making footnote double-spaced, in LaTeX

Here is a solution: \footnote{\renewcommand{\baselinestretch}{2}\selectfont blablabla}.

Friday, January 18, 2008

Causual inference et al.

Here is a list of interesting resources:
  5. ...

KDE 4 is counterintuitive

I installed the KDE 4 components on my Ubuntu box and took a good look at it. I was disappointed because, compared to KDE 3, the new version makes some routine operations more difficult. I have to uninstall it after one day and got back to the old Gnome interface. I don't think I will try it any time soon, unless there are some significant changes.

Some references on gender preference and gender selection

  3. ...

Thursday, January 17, 2008

Linux notebook again

OK, looks like Lenovo is working toward this direction (, even though SuSE is not my favorite distro, and T is not as cool as X, but it is a significant step forward.

Wednesday, January 16, 2008

Will there ever be high-end Linux laptops?

As a happy Linux user, I am glad to see a sudden increase in the number of computers on the market with Linux pre-installed. However, most of these machines are low-cost and low-power ones, while the high-end machines are still dominated by XP or Vista, usually loaded with tons of trial wares. Will there ever be a good computer like Sony SZ, Thinkpad T or X, or Fujitsu Lifebook Q, with Ubuntu pre-installed on the market? Am I the only person who is interested in seeing such a machine?

Saturday, January 12, 2008

Some reference on Sweave, R, and literate programming

  4. To be continued...

Tuesday, January 08, 2008

Zotero 1.02

Zotero 1.02 is out. It fixes some bugs and adds more styles. Very cool.

Saturday, January 05, 2008

Journal of statistical software

Journal of statistical software to R is very much like Stata journal to Stata, and it is free:

Friday, January 04, 2008

Handling large data set using R

It seems to be a problem with R to handle really large data set. Here is an interesting discussion:

And two packages: "ff" and "filehash". Need to check them out.

Tuesday, January 01, 2008

PMG: poor man's GUI

PMG seems to play nicely with ESS. That way, I can rely on Emacs+ESS for program editing and executing, while use PMG to look at the data structure. Seems to be a productive combination.

Rcmdr, another nice GUI for R, can do the same thing.

I just discovered that PMG is not very stable and tends to crash if large data is loaded. Rcmdr seems to be more stable. Unfortunately, JGR does not seem to play with ESS nicely.

Using R for my next project

I decide to use R for my next research project. I have been learning and playing with R for a long time, but when dealing with "mission critical" situation, I always came back to Stata.

As the R platform has become more mature, especially with the addition of some nice packages, I think the time to switch has come.