Saturday, March 10, 2012

Visiting Kenya

26. February 2012, Sunday, Nairobi, Kenya

After a day of travels I am arriving to the Nairobi International Airport for my second visit of Africa, first in Kenya and as I saw on the map, first on the southern hemisphere.  I came for meetings and future-project discussions with people from the International Livestock Research Institute (ILRI). Similarly as in Ethiopia, also here I would like to note down my feelings and experiences. As in case of Ethiopia, take it as a random sample and do not make general conclusions out of it, this is what happened to me described from my viewpoint.
As I said I came for discussions, but the travel is actually bounded with the program of people coming from Swedish Agricultural University (SLU). The have already a project running in Kenya, and their goal is to visit the project sites, among others. They kindly agreed to take me along, which is a great opportunity for me to see the actual countryside of Africa. One of the SLU people is a “giant” of development research, so I hope to listen and learn as much as I can during the trip. My very first stay in Addis was mostly within the ILRI campus, so now I am going to see more diverse environments. Today we take as the arrival day with only some leisure program, the work begins tomorrow.
We arrived for a nice sunny day with daytime temperatures around 30. A pleasant day indeed, although I am quite tired after the long flight. We drive through the city on Narobi when coming to hotel and I must say that I like it more than Addis. It is much greener with more parks and nicer buildings. The signs of the British Empire are clear in the country with the driving on the left, cars with steering on the right. Our way was very fluent the whole time, but according to insiders this was due the Sunday morning drive with almost no cars. Otherwise traffic jams are quite common here as well, or so I heard. We will do quite a bit of car driving during the week, so I can tell more about this at a later stage.
 The hotel we are in is a nice one, on a good spot. Upon arrival everybody got a keycard except me. I got a normal key with an attached plastic holder with the most famous Barrack and a YES WE CAN on it. The receptionist said that it is the “best key”. Not sure what he meant, but it might be a reference to the picture. Other fun fact: When I came to the room and browsed through the tv channels, I found the opening scenes of “Out of Africa” with Meryl Streep and Robert Redford. Old, slow paced, a bit-too-long, but a reasonably good movie with most of the cast done in Kenya.

27. February 2012, Monday

Today was the first working day of the stay, spent mostly at the ILRI campus. Right at the breakfast I was asked if I brought malaria pills along. I guess this was a standard question, but I had to answer with a ‘’no”.  Then I realized that we are going to a region where there is more than a theoretical chance to get infected. It was not an issue in Addis, but in wet lowlands of Kenya it is possible indeed. Naturally I freaked out. Fortunately the Swedish “big boss” got a spare box of pills which he gave to me. As I understood you could get malaria also with the pills, but the outcome should be much less serious. I hope I can skip the experience anyway.
After arrival to ILRI we were discussing the details of the ongoing SLU sheep project already running in the country. I realized (again) that it is a huge undertaking to get information about the animals in a “developing” country. Traits and data which you expect to be there are collected, transferred and translated into digital form with a great effort. Additionally one has to think about keeping the good relationships with the farmers, hire trustworthy enumerators or deal with their eventual imprecisions.  One of the issues was that on a certain remote site the sole computer got a virus and was unusable for some time, stopping the data flow. The other issue was that one of the regions is inhabited by two tribes, and they were not accepting enumerators from the neighboring tribe. And there were lots of other issues that you would not think about in a “European” setting.  After the whole day meeting and the quick tour of the (huge!) BecA lab facilities we returned to the hotel.
Naturally we thought about dinner. The suggestion was to go outside. After a discussion of the dubious security of Nairobi after dark I felt quite uneasy., but finally we settled on a place nearby. After my dinner-burger and fries we went back to the hotel on foot. Almost immediately we got tailed by a woman offering something to sell. She appeared to be harmless except of the constant chatter, but I felt re-assured that walking outside is not the best choice.  Eventually the woman gave up, and we arrived to the hotel avoiding the many small claques on the pavement (btw. another good reason why to avoid unlit areas, especially after rains).

Other fun fact from today: After the malaria discussion at the breakfast I kept thinking about it. During the meeting before noon I was feeling very hot, and assumed to be the first signs of an illness from the mosquito from yesterday. This was until I realized that I am sitting in a light sweater in a room near the equator (about 25-30 C) and I am drinking the second big cup of coffee in 2 hours… Happens… Removing the sweater and stopping with the coffee made the trick, of course.  

28. February 2012, Tuesday

I just returned from the full day field trip, visiting sites of the sheep project. We started early in order to bypass the traffic jams and be at given times at given places. We went with 2 all-terrain vehicles, which turned to be out the only possible solution. Details later. The first part of the trip were on a newly built very good quality tarmac road. I have to mention that this road led to Mombasa, one of the major cities of Kenya. Despite of its importance there were no signs pointing out directions, at least at its newest parts. The driver knew of course where to go, but if I would be on my own I would have a 50% chance to take a wrong turn on each junktion. Crossing of major roads by pedestrians at any place is quite prevalent in Nairobi as well, similarly to Addis. But is you think the pedestrians are not the only ones causing dangerous situations. During a traffic jam I seen cars, matatus and even buses extending the road and using a proper pedestrian walkway! Just unimaginable back at home.

Also the overtaking on the Mombasa road is quite an experience. Imagine a truck going uphill with 20km/h. A second truck overtaking it, going 30km/h. A third truck overtaking the other two at the same time and just after it our jeep hoping to squeeze in… I can tell you, at some point I was rather not looking what is going on.
Finally, at one point we turned to a dirt side road, and from there on the things were getting bumpy. It rained again during the evening, so the road was full of mud, which would have caused great problems if we had any other type of car. Of course the signs were missing here as well, which is more understandable in the middle of the savannah. Although I would appreciate a “Next settlement 50 km” sign for the unaware travelers. The outcome is that you have to do your homework before trying to go somewhere around here on your own. You have landmark points though. To get to the farm of Moses, where we were heading, one has to turn right on a crossing with 3 trees. Not joking here… Literally there were 3 trees in a crossing. After that you have a bunch of unmarked crossings leading in all directions, where you just have to know where you are going. At some point I was not even sure if we are on road any more, as you could not see the car trails on the rocky ground. As I was told the layout of the roads keep changing all the time from various reasons, they might be completely erased by the combination of sand and wind and on the top of that they are completely unusable during the rainy season. If you are somewhat familiar with development issues you often hear the term “market access”. I can tell you, after today’s ride I realized the meaning and the importance behind the “access” part.

The farm of Moses consisted of a simple house and several fenced off areas where he keeps quite large flocks of sheep, goats and cattle. I knew that he was the bigger farmers, but seeing 100+ animals was interesting. The natural companion of such amounts of livestock are the flies, which were all over the place. First they bothered me quite a lot, especially when I was thinking about all the places they might have visited just minutes ago. But after some time I accepted them as such, occasionally hushing them away. We proceeded with the grading and the interview of the farmer, mainly focusing on questions such: Which are the best, average and worst animals per breed?, Why?, their advantages and disadvantages? Later on the team also proceeded with body measurements. From the works done by other guys at BOKU I was aware about certain difficulties, one might face douring the field work, but this was the first time I took part. Moses appeared to be a knowledgeable person who knew his flock very well. He is a bright example of a farmer keeping records, which is not that usual in many places even in “more developed” countries. Despite of this the answers he gave were like “I liked the dam of this animal.” “This one had two offspring in 2 years, one died.” “This one takes care of the lambs very well.” “This one has problems all the time and it is kept alive only via vaccinations.” Depending on the aim of the study these are valuable information, but it is far away from the databases I used to handle. It is very difficult to put statistics on his answers, but I think the statistics should not be the main driver of the study anyway. Animal breeding in these countries requires a very different mindset, even if the underlying goal of genetic gain is the same as everywhere else. One has to re-phrase the questions and ask what are the farmer’s needs? How can we help them with, given environment and the available resources? Tackling these questions one can give phrases such “poverty alleviation” and “food security” a real meaning.

29. February – 3.March 2012

The program of the stay continued with discussions of the results/experiences from the previous day and gearing up for the next field visit. This time it should be an area requiring about half a day travel time. I left my laptop and main suitcase in the hotel and started the two day trip with only a backpack, some food and a bottle of water.
The ride to the Amboseli area offered a snapshot of the life in Kenyan small cities and rural areas. At the beginning we took the Mombasa road again, but this time a longer part. At places where it was crossing with other roads it created its own small cities consisting from small shops selling food, car spare parts, mobile phones and all other things that people, in this case mainly truck drivers, might need. Hotels were there as well starting from the ones looking reasonably good (at least from the outside), but there where also some shacks from tin plates, apparently advertising free room capacities.
In the evening we arrived into a small place called Sultan Hamud which was very similar to other Kenyan small cities. Low profile buildings, quite clean but dusty roads. This had a mosque and several houses with satellite dishes on them in addition to the other “regular” ones. Sultan Hamud was the place where I saw the biggest contrast so far. From inside it was a beautiful hotel belonging to an Italian guy, outside the present reality of Kenya. In between a high fence with barbed wire.  It was an odd feeling walking inside the garden, looking at the hotel pool, knowing that just a few meters away there are people living in completely different conditions.
Inside of the hotel facilities...

...and the outside world.

The next day we went to visit another farm with Red Massai sheep. This area was quite different from the previous one, with traditional Massai huts loosely grouped together with a fairly large area holding the livestock in the middle. Most of the animals were sheep and goats with a few heads of cattle and a small donkey herd. I was told that the reason of such low number of cattle around in that most of the cows died during the serious draughts in the previous years. People started to re-stock just recently, which was visible from the apparent low age of cows. The draughts are also the reason why the people started to look at the milk production of sheep. The ILRI people told that the focus on milk in sheep became stronger in the recent years in an increasing absence of cattle. Also there was quite a big number of goats around, I guess also mostly for milk.
The farmer we were visiting was new in the project, so we did not know what to expect. At the end both the questions part and the measurement of the animals went quite smoothly, although it took a little longer than expected. The farmer turned out to be the elder small “village” and he asked if the other surrounding flocks could join the program. This was a very good sign that he is interested in the program. I am not sure if he was aware of the benefits that a recording and selection program could give, but in any case in the mid-long term it would definitely help them to increase production and income from their flock.

Our next destination was the place of a young Massai who understood our intentions very well. Leonard spoke perfect English, working with ILRI for some time in the past, now a leader of a small organization dealing with various issues. They provide work for a number of local people as well as supporting children with scholarships, so they can study.  He is a farmer in the sheep project, but also has a camp for tourists which we visited for lunch and discussions concluding our efforts during the week. There were several interesting moments during this visit. One of the most memorable ones was the picture of the 4 PhDs and two university professors listening to the explanations of the young Massai in the traditional clothing. It is a pity that I did not took a video during the event, so you could hear his words. If I will be around I will definitely do so.

After leaving Leonard’s place we said farewell to half of the team returning to Nairobi. The SLU group and myself went for a short tour of the Amboseli National Park, which was nearby. Well… It supposed to be nearby… Our contacts told us that it is 1 – 1,5 hours drive, which turned out to be more like 3 - 4 hours in the car. We started quite late on the usual dirt road of rural Kenya. In addition there was a light rain just before, so our progress was somewhat hindered. We, or more precisely our Kenyan recording person, had some idea about the directions, but we put him out close to his home place. He left behind some verbal instructions and a hand drawn map which should lead us to Amboseli. It was a long way, I can tell you… We were in middle of Kenya, in the dark, on a dirt road and all we could see was an occasional wildebeest. Fortunately we hit the a more strudy road before it started to rain again. Frankly, I was starting to prepare for a night in the car.
Finally we arrived to some lodges where we could as for directions and after additional 20-30 kilometers we arrived to the gate of Amboseli park. The funny thing was that we were already in the park. We probably entered it when turning to the main road, but there were zero signs denoting the border area. Of course the first question of the guard was about our non existing tickets. She was not in a good mood, and finding out that we crossed the park border illegally did not added to the friendliness either. Quite the opposite. Our driver went out for some negotiations, and returned with a very friendly person dealing with the tickets. We wanted to come to the park anyway, so the 24 hour valid tickets were a good deal for everybody. The next day we returned to see the touristic part of Kenya, the way we see it on National Geographic or other documentary channels. We could see a number of species, only “simba” was elusive on that day. It was really a great experience to see these animals in their natural habitat.

After a few hours in the park we went for a lunch and afterwards back to Nairobi. It was my last day returning to Vienna the next day.

I was leaving Kenya with a bunch of experiences and thoughts which would undoubtedly shape my thinking about “developing country” issues. After the my previous visit in Addis somebody mailed me:  “ I hope you will get to see through what is sometimes presented on the streets of the big cities--and get to see the country side--it is another life--and the heartbeat of the continent.  Come again and hopefully we will take you round further.”

That happened indeed. I went one step further with a hope that I can continue my journey.

Monday, January 23, 2012

Bland - Altman plot in R

Not so long time ago I did a comparison study of two software packages, more precisely their ability to estimate random effects. The plain approach was to do correlations among the outcomes, and if they were high I assumed that both programs are OK. I presented this to my more experienced colleagues who suggested to use Bland-Altman plots to confirm the results. This is a reasonably simple technique to measure the agreement of the two outcomes. As they say in their paper Statistical methods for assessing agreement between two methods of clinical measurement (pdf linked, worthwile to read):

In clinical measurement comparison of a new measurement technique with an established one is often needed to see whether they agree sufficiently for the new to replace the old. Such investigations are often analysed inappropriately, notably by using correlation coefficients.The use of correlation is misleading. An alternative approach, based on graphical techniques and simple calculations, is described, together with the relation between this analysis and the assessment of repeatability.

 Simple, yet beautifull technique.

Naturally I was searching for implementartion in R. I quickly found and installed a package called ResearchMethods, but personally I thought it has very few soft tuning possibilities (e.g. scaling or color change). I went deeper and found a quite well documented page with a custom/modified R function. 

I used this one, as I could scale the y axis, so the final plot was nicer. On the other hand I also found that this particular function was written for demonstration purposes, but it had difficulties to run on other data.

For example the limits of the y axis were hard coded to -60, 60, which is quite problematic if you are interested in much higher or smaller differences (In my case on the 0.01 level...). Also the data set names were hard coded into the funtion.

So I modified the code to a more generic function like this:

BAplot <- function(x,y,yAxisLim=c(-1,1),xlab="Average", ylab="Difference") {
   d <- ((x + y)/2)
   diff <- x - y        
   plot(diff ~ d,pch=16,ylim=yAxisLim,xlab=xlab,ylab=ylab)
 You call it as:

The "testSet"s are the datasets to compare, the yAxisLim modifies the scaling of the axis according to your needs. You might modify the labels of x and y axis if you wish with xlab and ylab.

Monday, November 28, 2011

R crash course

This is a follow up post for my R course held in Addis Ababa last week. You can find the description of the stay in the Inside Ethiopia (part 1) and Inside Ethiopia (part 2) blogposts, if interested. 

This post is a shorter and more practical one. I promised to multiple people to put the presentations online, so I thought I will make them available through my blog in combination with my Dropbox account. Here they are:

  1. Introduction to R
  2. Basic commands of R
  3. Statistics and programming in R

The other links I am referring to in the presentations are An Introduction to R, the R reference card and the other variations of cheat sheets.

You are free to re use and replicate the presenations, provided that the initial work is acknowledged.

Have fun with R! :)

Friday, November 25, 2011

Inside Ethiopia (part 2)

 This is a continuation of a previous story describing my experiences in Addis Ababa, Ethiopia.

Day2 (21.11.2011): Setting the scene

I just returned from the workshop, which was going on for the whole day. As I found out this workshop is sort of a feedback to the previous activities done by people from SLU and ILRI. The participants are from all around Africa, sharing their experiences, challenges they face as well as proposals for improvement for the current situation. Most of the day was taken by these presentations from representatives of 15+ countries, some additional ones from the FAO representative and ILRI people.

Two main take home messages, at least for me, was the need for improved collaboration between countries and the need of implementation of national recording schemes, or even better: the combination of these two. I will explain more in the next few lines.

One of the major challenges that every country mentioned was the lack of funding. This is an unhappy situation that it might well appear in other parts of the World as well. In addition there is the lack of trained personal and facilities for research (e.g. molecular labs).  To come out of this the need of intensified cross country collaboration was suggested, as the countries have often common issues to deal with. The lack of finances also forces the people to select priorities they should work on. 

One of the burning issues raised by multiple countries as both challenges and suggestions for improvements was the implementation of national performance and pedigree recording schemes. A short simplified description for those who don’t know: Performance recording is to measure the production of each individual animal (e.g. kg of milk), so when the farmers could select those with high production and eventually get better animals. The performance recording is the backbone of animal breeding virtually non-existent in most of the countries presenting today. The establishment of such a recording scheme is a huge task, so this is where the across country collaboration comes in. Additionally the same breed is often present in multiple countries eventually exchanging breeding stock, so there is a huge benefit of a compatible recording system for a certain breed or species at multiple places. The other key issue is that the recording is done on the farm level, so one has to convince the farmers to participate.  So the purpose of the recording is not only to have a nice database which is eventually used for selection, but also the farmers need to have benefit from their participation in the recording, which can be either getting information on the performance level of their animals so they can compare themselves to others or a proof of a high performance which increases the market value of their animals.

From the description above I left out many details, but I hope you got a feeling about the complexity of the issues. Frankly, this is one of the most challenging goal I can imagine. 

Day 3-4 (22.-23.11.2011): Two days later

I am coming back to write this report after two days of workshop. The participants were discussing various around conservation strategies of animal genetic resources and the needs of their respective countries. The open aim of this workshop is that the participants take over the initiative and move the things forward in the region. In order to achieve this goal they were divided to small groups of 4-5 people from 2-3 countries, so they can discuss future collaborations. Although one can not guarantee that they will eventually work together, the selection of the groups and their common sub-regional interests are good reason for optimism regarding their joint work.

I have to mention that yesterday I put forward some of my thoughts on data recording, basically proposing that one should try it with a single huge push. Right after during the coffee break I was confronted by a much wiser person than myself, telling me that the procedure as I outlined would lead to failure in African context. He was even pointing out a similar case from the past. I have to admit that it was not one of my brightest moments… But at least I learnt something new.

Half of today’s discussions were devoted to computer based applications such as the Animal genetics training resource and the Mistro database. It was a pleasant surprise that our ABG Hub (my blogpost) is linked from the main page of the Animal genetics training resource.

Tomorrow is THE day for me, where I will present the R to the workshop participants. Quite a few people were already asking questions or said that they are looking forward to my part of the workshop. The presentations are prepared, so let’s see what happens…

Day 5 (24. 11. 2011): The course and beyond

Today I held my course, teaching about 20 people about the basics of R. (attach photo of the room, upload presentations in a separate blogpost). It went reasonably well with lots of questions from the “students”. Clearly they were very interested in the program as it gives a zero cost alternative to SAS. I started on with the installation and the very basic features slowly going towards statistics and data visualization. I constructed the presentations in a way that I could drop the programming part if necessary. And was necessary indeed, as I run out of time in the mid of the “statistics and visualization” part. But I have to say that we explored some of the features of R in more detail. The people were particularly interested in data loading from text files and Excel which were not covered very deeply in the initial plan. Also they asked various questions about genetic analysis, with focus on animal breeding data. I answered what I could or pointed out resources where they could find more. I guess it would make sense to make a course in R with a special focus on animal breeding and genetic analysis related issues, it was clear for me that there would be a clear interest for something like that.

Just after the lunch we hoped on a bus and went out to the town to do some shopping. Frankly, it was one of the most devastating experiences I ever had. (ref to a blog post, or some pictures to the end of this post). We visited two places in Addis. One of them was near the main post office with a bunch of small shops selling traditional clothing, small statues and such things, but clearly oriented on tourists. The other place (as far as I could guess) was a more central one with huge concentrations of jewelry shops, mostly gold and silver.  I saw a similar environment as few days ago, so I knew what to expect. There were people trying to sell various stuff which I kind of expected, but there were also small children all around, asking people for money. One can find this in any major city in any country, but the sheer numbers were shocking for me. I saw children even younger than my son alone on the streets, mothers with children on their backs, people sleeping on the streets. Just a shocking experience. I am not sure if I want to go back there again. 

What I also know is that my denial does not change anything. Why is that some people bath in money, others don’t have anything? 

Day 6 (25.11.2011): Homecoming

Yesterday ended with an unexpected twist and I saw yet another side of Ethiopia. All workshop participants were invited to a restaurant with traditional music and dances. As I steped through the door I found myself in a huge hall with low tables and plenty of people inside. Majority of them were tourists I guess. Of course there were two guards and a security check at the entrance. After the previous experiences in town I was not in a high mood to go for such a place, but since this was the last evening of the workshop I went on. At some point I was pulled up to the stage and served as an entertainment show for the rest of the guests. Apparently they liked it, as I received many congratulations from friends and strangers alike.

 Today is the packing and leaving day. Already packed most of the things, but I will fly only during the night. I will go around the campus once more and then close the chapter of my first ever visit of Ethiopia. Most likely the work will go on, as many of the course participants will re-connect via email, but for now I am happy to go home.