Saturday, November 19, 2011

How to add a custom category to the side bar on your blogspot blog, and populate it with links to selected posts

In my side bar on this blog, I have a category called STATA, below which are links to all my posts that are about STATA tips (right now, I have only one such post). Here is a link to the page that gave me instructions on how to do this:

http://www.bloggersentral.com/2010/04/list-recent-posts-by-label.html

Basically, here's what you need to do:

1. Pick a name for the category; this will be the same as the name of the label that you will apply to all posts that you want to include in the category. So your category could be something like (without the quotes): "STATA tips" (under this would be links to your posts related to tips on doing things in STATA) or "Books I am reading" (under this would links to your posts that discuss the books you have been reading)

2. In Blogger.com, click "Dashboard" and click posts to list all the posts for your the blog. Create the label that you chose in step one and apply it to all the posts that you want to appear in under this category.

3. Click "Layout" in the left sidebar and select "Add Gadget." In some templates for blogger, you might have to click "Design." When you click "Add Gadget" a pop-up window will appear.

4. In the left sidebar in this window, click the first tab, "Basics." Then scroll down and look for the Gadget "HTML/Javascript."

From here you can follow the instructions available at the link above. The only think I would do differently from the instructions at the link is that I would make the changes (e.g replace  YOUR_BLOG_URL, etc.) BEFORE saving, NOT after.

Good luck!

Friday, November 11, 2011

How to embed a spreadsheet into a blog

A friend of mine is a translator (English, Russian, Tajik), and she keeps in a spreadsheet a record of some of the phrases and words she translates. I suggested that she make this available on line for other translators to refer to. We had no idea how to do this, so I looked up how to embed a spreadsheet into a blog (she has a blog). I found the following resource:

http://www.geekestateblog.com/how-to-create-embeddable-spreadsheets-for-your-blog/

Which it tested. It works - see the embedded test spreadsheet below:



If you want to change the content of the spreadsheet, you can log into your editgrid.com account (free, see the link above) and make the change in your original spreadsheet. When you refresh the blogpost page, it updates the spreadsheet with the change.

The only think I have found, so far, that one needs to be mindful of is that if your text is longer than then size of the cell that you put it in, then you need to adjust the with of the column in your editgrid.com account accordingly, in order to show the entire content of the cell.

UPDATE: Suppose you want to use google docs instead of editgrid.com. It is possible - check this out:



This actually looks MUCH better. The instructions that gave me a rough idea of how to do this are here:

http://www.blogdoctor.me/2006/12/google-docs-spreadsheets-in-your-blog.html

But actually the directions don't match the menu options available in google docs - it must be outdated, I guess. For example, this link says to "click on Publish in the upper right corner to open the Publish sidebar on the right side..." etc.  Here are some updated instructions (as of 18 Nov 2011):


1. In google docs, open the spreadsheet that you want to embed in your blog.
2. Click "File" then select "Publish to the Web" to open the publishing menu.
3. Under the second heading, the one that says "Get a link to the published data," click on the box immediately below it (which by default is "Web Page"), and select "HTML to embed in a page."
4. There is a textbox at the bottom - in that text box is HTML code. Copy and paste this code into your blog (make sure you've set your blogger editor to "HTML" and NOT "Compose"). 


Anyone have any ideas on how to get the "Sheet 1" out of the spreadsheet name above? Or how to reduce the size of the box when there are lots of empty cells?





Tuesday, August 23, 2011

How to select a digital camera

This is not comprehensive. I simply thought I would relate my experience in selecting a digital camera, so that others might benefit. Basically it is an email exchange, in which I asked a friend, who is knowledgable about photography, for advice on selecting a digital camera. I ended up buying the Olympus XZ-1 (see my review on Amazon; a link to the product is below). I have pasted below the e-mail exchange:

My email to him:

Hey Alex, I just met up with [NAME] for lunch, which reminded me to
solicit your opinion on digital cameras. This one looks good (see
below). But my only worry is that I might be locked in to using Sony's
proprietary memory sticks. What do you think of this camera?

Sony Cyber-shot DSC-HX9V 16.2 MP Exmor R CMOS Digital Still Camera
with 16x Optical Zoom G Lens, 3D Sweep Panorama and Full HD 1080/60p
Video

http://www.amazon.com/gp/product/B004HYFX0C/ref=as_li_ss_tl?ie=UTF8&tag=ohmission-20&linkCode=as2&camp=217145&creative=399373&creativeASIN=B004HYFX0C

http://reviews.cnet.com/digital-cameras/sony-cyber-shot-dsc/4505-6501_7-34547260.html?tag=contentMain;contentBody;1r#reviewPage1

His response:

Lucky you -- DPReview just published a comparative test featuring this Sony:
http://www.dpreview.com/reviews/q311travelzoomgrouptest/

You'll see that Canon and Nikon win, and Sony follows close behind. However, I see very little reason to buy ANY of these cameras. I simply see ZERO use for the superzooms of such cameras. I also don't understand why in the world you would need 16MP, or anything above 10MP.

In my opinion, the absolutely BEST compact camera on the market is Olympus XZ-1. Primarily because of it's excellent lens, which allows to take quality pictures in relatively poorly illuminated conditions without the need to bump ISO (which ALWAYS results in noisy pictures).

http://www.amazon.com/gp/product/B004HO59LK/ref=as_li_ss_tl?ie=UTF8&tag=ohmission-20&linkCode=as2&camp=217145&creative=399373&creativeASIN=B004HO59LK

BTW, CNet is a terrible place to read camera reviews. You don't want reviews from gadget people, you want reviews from photographers. Here are photographer reviews of XZ-1:

http://www.luminous-landscape.com/reviews/olympus_xz_1_review.shtml
http://www.outbackphoto.com/CONTENT_2007_01/section_gear_cameras_2011/20110618_Olympus_XZ1/index.html

And here is DPReview take (DPReview is the oldest and probably most reputable photo equipment review site):
http://www.dpreview.com/reviews/OlympusXZ1/

Saturday, August 20, 2011

A review of the materials I've used for learning the Russian language

I've been trying to learn the Russian language for more than a year now. It has been tough. The Russian language coordinator at my work recently assessed my spoken Russian as "Intermediate - Low." I think she may have been overly generous. Also, it is possible that I was able to give the impression that my skills are more advance than they really are simply because I memorized some phrases that I need to use often.

The Russian language coordinator asked me to give my opinion on the various materials I've used in my efforts to learn Russian. I am pasting below the e-mail I wrote to her.

Here is my evaluation of the learning materials I have used:

1. Pimsleur Russian, 90 lesson set. I recommend this as a starting point, the first material that one should use for learning Russian. One can use the audio lessons while driving, on the treadmill, etc. The reading lesson might be good for learning the alphabet (I'm not sure because I did only the audio only lessons). The pace is right, and if it is too fast, one can repeat lessons. It is great for learning pronunciation. And it explains why certain words change depending on use (without mentioning cases or the names of cases.)

2. Colloquial Russian: The Complete Course For Beginners (Colloquial Series). I'm on Chapter 7 right now. This book is good. The pace is right also. Rather than giving you the rules all at once, it introduces them gradually, to allow you to absorb them. It gives a few verbs and their conjugations in each or almost each chapter. Don't try to memorize these. Just keep progressing through the book, doing all the exercises. It is best to start the Pimsleur set before starting this book. I don't have the audio, just the book, so sometimes I have trouble pronouncing the words. It would help to either know the alphabet before starting, or get the audio files for the book. I'm told that there are mistakes in the book, so look out for these. I don't know yet if there is an errata web page.

3. Rosetta Stone. This is good for increasing vocabulary, and learning how words, phrases and sentences should sound. It works by word-picture and phrase-picture association. It is a series of short lessons, mostly 5, 10 or 15 minutes long (intro's to the lessons are 30 min long). These are estimates - the time it takes depends on how fast the user responds (this is a computer program that you install and use on your computer). One downside is that it doesn't tell you why endings change the way they do, it doesn't mention cases or declensions. So if you use this I suggest combining it with the colloquial Russian book. Another downside is that it doesn't break up long words and phrases when teaching you how to say them, which makes learning how to say them that much more difficult. Also, all 3 levels are expensive, and have enough exercises to last probably 100 hours. I'm not sure whether the time it takes is worth what you get out of it. But if you do use Rosetta Stone, make the maximum effort with it. Pronounce the words even when you don't have to (e.g. when you're only required to click on the right picture or phrase).

4. Schaum's Outline of Russian Grammar, Second Edition (Schaum's Outline Series). This is definitely NOT for beginners. This book throws a whole bunch of rules at the reader, then presents many exercises. Do NOT start with this. The proper step for this book, if any at all, is after you have reached the intermediate-high level. This book is supremely boring, and requires motivation for completion. Also there is at least one English grammatical mistake in the book, which makes me wonder about the Russian.

I think that they best way to use the above resources is to use them in the order presented above.

5. Random Russian Teacher. It is difficult to teach a language, and some people who speak both English and Russian very well think that they can teach Russian to English speakers effectively, simply because they have a good command of both languages. I disagree. It take more than this to be able to teach a language- it takes an understanding of how people learn languages in general and what works best for specific individuals. A good teacher will ask you why you want to learn the language, what you want to learn, and will tailor the lessons to meet your goals. My teacher in Tajikistan has an exercise book from which she photocopies lessons, and she has me work through them. It is too much, too fast, and we don't do any review of previous lessons, so not much of it sticks. Also, a lot of what we learn is irrelevant to me. I have absolutely no intention of touring Moscow, and if I end up touring Moscow, I would do it only once or twice. But I very often do need to be able to speak about the technical parts of my project in Russian, and understand when people are speaking about the same to me in Russian. I also would like to be able to use the imperative tense often- For example, I need to tell taxis to go here, there, turn left, right, go back, drop this person off, pick me up right away, and then go bring another person here by X o'clock, etc. A good language teacher will find out that you want to and need to learn these kinds of things. Few people actually know how to teach a language. When you find a "Russian teacher" (usually this is just someone who calls him- or herself a Russian teacher), you will have to teach that person how to teach. It would be great if someone could develop an instruction manual that would teach teachers how to teach Russian. To be able to quickly get by in Russian, it would help to write down the phrases that you think you will use most often, and memorize the Russian translations of these. You could make flash cards of these or find a smartphone flashcard application. Periodically add to this list and memorize more translations (e.g. you might add new phrases that you think you will need, or new responses you have encountered to the phrases you've used). This will help you develop an ear for Russian; i.e. knowing what sounds right. I'm not sure how useful watching Russian movies is, with or without the English subtitles; I have yet to try this.

Saturday, May 7, 2011

STATA tip: restore/preserve value labels after using the collapse command (and a link to doing so for the reshape command)

UPDATE 28 November 2012: Forget this post. I wrote a program to do this, which you can find here.

UPDATE 03 July 2012: I updated the code so that it works (there were some typos before)

Using the collapse command in STATA tends to remove value labels and variable labels. Below I have included code to save and restore the value labels (assuming you keep all the variables except the 'over' variable that you specify in the collapse command).

This is simple and has probably been posted elsewhere (and there is probably an easier, more elegant solution). The collapse command really should include an option for this.

If you want to learn how to restore value labels after using the reshape command, see this link:
http://www.stata.com/support/faqs/data/labels_reshape.html

For preserving value labels:

// Save and restore value labels
// Shafique Jamal, shafique.jamal@gmail.com
// Saturday 7 May 2011

// define the path for saving temporary files
global path_for_tempfiles "/Users/shafique/allfiles/ECA_projects/TJ_social_assistance/data_qnr/raw/zerkola2012pilot"

// This is the list of variables for which we want to save the value labels.
label dir
local list_of_valuelables = r(names)

// save the label values
label save using $path_for_tempfiles/label_values.do, replace
// note the names of the label values for each variable that has a label value attached to it: need the variable name - value label correspodence
   local list_of_vars_w_valuelables
   foreach var of varlist * {
   local templocal : value label `var'
   if ("`templocal'" != "") {
      local varlabel_`var' : value label `var'
      di "`var': `varlabel_`var''"
      local list_of_vars_w_valuelables "`list_of_vars_w_valuelables' `var'"
   }
}
di "`list_of_vars_w_valuelables'"

// do the collapse here

// redefine the label values
do $path_for_tempfiles/label_values.do
// reattach the label values
foreach var of local list_of_vars_w_valuelables {
   cap label values `var' `varlabel_`var''
}

Tuesday, November 23, 2010

Which is the better measure of welfare - per capita consumption, or adult equivalent?

The following example illustrates the motivation for the question. Suppose you have two households, A and C. Household A comprises four adults, and household C comprises two adults and two small children. Suppose each household consumes $100 of food in one month, total. On a per-capita basis, this is $25 per capita in consumption for each member of both households. However, for household C, this measure of welfare actually underestimates the true welfare of the household. The reason is that the children do not need to consume as much as adults, so that a child that consumes $25 of food is much better of than an adult that consumes $25 worth of food. So even though the per-capita consumption of each household is the same, household C is actually better off – the per-capita consumption measure of welfare has underestimated the welfare of household C.

Consider another example. Lets look at small family S, which comprises 1 adult. He buys firewood to heat his home, which contains only himself, for $10. Family A also buys $10 worth of firewood to heat their home. The per-capita consumption of firewood is $10 for household S and $2.5 for household A. However, each member of each household enjoys the same amount of heat – there are economies of scale in heating the room (assume a one room house, since we are talking about poor households here. Maybe the larger household requires more firewood, but certainly not four times as much, if you believe that there are economies of scale here). In this case, the per-capita measure again underestimates the welfare of the larger household.

One option for adjusting for economies of scale and differing needs of household members is to use the adult equivalent scale, which assigns weights to household members to make the adjustment. More information on the adult equivalent scale can be found here: http://www.oecd.org/LongAbstract/0,3425,en_2649_33933_35411112_1_1_1_1,00.html and here: http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBsQFjAA&url=http%3A%2F%2Fwww7.nationalacademies.org%2Fcnstat%2FPoverty_Equivalence_Scales_Betson_Paper_PDF.pdf&rct=j&q=adult%20equivalent%20scale&ei=uZvrTNCNHYWclgforpm0AQ&usg=AFQjCNHXrcw16y_WDjZIZQbzg0hhJx71qA&sig2=b4PKoKi--xVUvmepS7ICnA&cad=rja

I asked some colleagues about this, and I’ve summarized the discussion below.

The adult-equivalent approach makes sense. It seems that theoretically, adult equivalent consumption should always be used because it is a better estimate of individual welfare, assuming one knows the weights. It adjusts for economies of scale in consumption, as well as the fact that children need to consume less than adults. So adult equivalent does not underestimate welfare as much as per capita equivalent does. However, it has significant disadvantages:

1) There is no universally agreed upon standard or empirical way for how to assign weights to the household members. Many just use a best guess.
2) Using it would result in inconsistency with other measures of poverty, such as the poverty line, cutoff, etc. We should be consistent with how we have been measuring poverty.
3) It is more complex; it is harder to explain and administer

The per-capita method is simpler and more transparent, even though it may underestimate consumption of larger households. As a general rule, it is best to go with the equivalence scale that is currently in use.

Another criticism of using adult equivalent consumption as the dependent variable in PMT regressions is that the variables used to calculate adult equivalent from per-capita consumption are variables that appear on the right hand side of the regression. For example, household size and number of children may appear on the RHS, and these are used to adjust per-capita consumption to form adult equivalent consumption, which would go on the LHS. However, controlling for these variables in the regression does not fix the problem of per-capita consumption underestimating welfare (any thoughts on this, anyone?).

One colleague says that there is no right or wrong answer here, but suggests to use whichever equivalence scale (adult equiv or per-capita) that is currently in use in the context of interest.

One observation that I would like to contribute is that I have found that, at least in my experience, using per-capita rather than adult equivalent consumption has yielded regression estimates with greater explanatory power. This is important if you are trying to predict consumption for PMT.

Tuesday, August 24, 2010

How can I get traffic to this blog?

What I am going to try is using key words from the most controversial topic of my generation: the Israel-Palestinian issue. However, there is a risk: what I’ve noticed is that anyone who stakes out a position, no matter which side such position favours (if any), will be the subject of vicious attacks. This issue is quite unique in that regard; it seems to annihilate any trace of sanity in some people.

I am going to try to be the first person to speak about this issue in a way that keeps me impervious to attacks. Here I go!

1. Israel is often miss-pronounced “is-real” (It should be pronounced “isss-ra’el”). This doesn’t mean, however, that it isn’t real. People have noticed it.

2. “Palestine” could have been a term used to refer to friends of Albert Einstein.

That’s 2 keywords down, and I’m still untouchable. How many more can I get away with? Lets see:

3. Zionism is what is practiced by someone who likes to keep his eye on something (get it? “he has hiS EYE ON it”). Please get your laughter under control before proceeding.

4. PLO… now this is a true story. In grade school, teachers would write “PLO” on the chalkboard when they didn’t want the contents to be wiped off. PLO in this case stood for “Please leave on.” Either that or there was widespread support for the Palestine Liberation Organization among the schoolteachers in my very hick hometown.

5. Hamas sounds like it could be made up of two words that would be offensive to Muslims (and Jews and vegetarians too)

I’m on a roll! Just a one more now:

6. Benjamin Netanyahu – did his family found an internet search engine? Or maybe his last name is Hebrew for “Nathan – celebrate!” (netan – yahu!)

Ok, I think I’ve exhausted your attention span. I still think I’m safe from vitriol (especially since almost no one reads this blog). But lets see what comes up in the comments.