16 November 2005

Secondary school attendance in Nigeria

Nigeria is the country with the largest population in Africa, estimated at 130 million in 2005. The most recent education data for Nigeria was collected in a Demographic and Health Survey (DHS) in 2003. 60.1% of all children of primary school age were attending primary school at the time of the survey.

Far fewer children continue their education at the secondary level. The official secondary school age in Nigeria is 12 to 17 years and 35.1% of the children in this age group were in secondary school according to the DHS. For boys the secondary school net attendance rate (NAR) was 37.5% and for girls it was 32.6%.

Secondary school net attendance rate, Nigeria 2003
Bar chart with total, male and female secondary school net attendance rate in Nigeria, 2003
Data source: Nigeria 2003 DHS.

The attendance rate is strongly linked to household wealth and area of residence. 63.8% of children from the richest 20% of all households were in secondary school, compared to only 14.6% of children from the poorest 20% of all households. The secondary school NAR in urban areas was 46.3% and in rural areas it was 28.7%.

At the country level, the secondary school NAR of girls was 4.9% below the male NAR. This gender disparity is a result of lower attendance rates among girls in rural areas and in poor households. In urban Nigeria, the difference between male and female attendance rates was 1.9% and the gender parity index (GPI, the ratio of female to male NAR) was close to 1, in rural Nigeria the difference was 5.8% and the GPI was 0.82. In the poorest households the gender gap was 5.5% but in the richest household the gap was reversed: the NAR of girls was 2.3% above the NAR of boys. To reach the Millennium Development Goal of gender parity, education policy has to target poor rural residents.

Secondary school net attendance rate, Nigeria 2003

Total
NAR (%)
Male NAR (%)Female NAR (%)Difference
male- female
GPI
female/ male
Urban46.347.245.31.90.96
Rural28.731.725.95.80.82
Richest 20%63.862.664.9-2.31.04
Poorest 20%14.617.512.05.50.69
Total35.137.532.64.90.87
GPI: gender parity index. - Data source: Nigeria 2003 DHS.

Related articles:
- Primary school attendance in Nigeria
- Age and level of education in Nigeria
- Household wealth and school attendance in Nigeria


Friedrich Huebler, 16 November 2005 (edited 21 January 2006), Creative Commons License

06 November 2005

Guide to creating maps with Stata (archived version)

As of 31 August 2012, this document is no longer maintained and has been replaced by a new guide to creating maps with Stata. The archived version of the guide is only of interest to users of Stata 8, who will find instructions below. All users of Stata 9 or later versions are advised to follow the new guide. Please change your links to the new guide: http://huebler.blogspot.ca/2012/08/stata-maps.html.



The graphs and maps on this site are created with the Stata statistical package. This article describes how to make maps like those showing Millennium Development Goal regions and UNICEF regions in Stata from a shapefile.

Shapefiles store geographic features and related information and were developed by ESRI for its ArcGIS line of software. The shapefile format is used by many other programs and maps in this format can be downloaded from various sites on the Internet. Another common map format is the MapInfo Interchange Format for use with the MapInfo software. Shapefile data is usually stored in a set of three files (.shp, .shx, .dbf), while MapInfo data is stored in two files (.mif, .mid). Some sources for shapefiles and other data are listed on the website of the U.S. Centers for Disease Control and Prevention (CDC) under "Resources for Creating Public Health Maps." The CDC itself provides shapefiles for all countries with administrative boundaries down to the state level. Please note that these shapefiles are not in the public domain and are intended for use with the CDC's Epi Info software only. Other sources of shapefiles can be found with a Google search.

This guide is divided into two parts. Read part 1 if you have Stata 9 or 10 and part 2 if you have Stata 8. The creation of maps is not supported in older versions of Stata.



Part 1: Creating maps with Stata 9 or 10

To create a map with Stata 9 or 10 you need the following software.
  • Stata version 9.2 or newer.
  • spmap: Stata module for drawing thematic maps, by Maurizio Pisati. Install in Stata with the command "ssc install spmap".
  • shp2dta: Stata module for converting shapefiles to Stata format, by Kevin Crow. Install in Stata with the command "ssc install shp2dta".
  • Shapefile: For the example in this guide, download world_adm0.zip (646 KB), a shapefile that contains the boundaries of all countries of the world.
Step 1: Convert shapefile to Stata format
  • Unzip world_adm0.zip to a folder that is visible to Stata. The archive contains three files called world_adm0.dbf, world_adm0.shp, and world_adm0.shx.
  • Start Stata and run this command:
    shp2dta using world_adm0, data(world-d) coor(world-c) genid(id)
    Two new files will be created: world-d.dta (with the country names and other information) and world-c.dta (with the coordinates of the country boundaries). If you plan to superimpose labels on a map, for example country names, you should run the following command instead, which will add centroid coordinates to the file world-d.dta:
    shp2dta using world_adm0, data(world-d) coor(world-c) genid(id) genc(c)
    Please refer to the spmap documentation to learn more about labels because they are not covered in this guide.
  • The DBF, SHP, and SHX files can be deleted.
Some shapefiles are not compatible with the shp2dta command and Stata will abort the conversion with an error message. If this is the case, you can use a combination of two other programs, shp2mif and mif2dta. These programs are explained in the instructions for Stata 8 (see Step 1 and Step 2 in part 2 of this guide).

Step 2: Draw map in Stata
  • Open world-d.dta in Stata.
  • The file contains no country-specific data that could be used for this example so we will create a variable with the length of each country's name. The Stata command for this is:
    generate length = length(NAME)
  • Draw a map that indicates the length of all country names with this command:
    spmap length using "world-c.dta", id(id)
    Be patient because spmap is slow if a map contains many features.
  • The default map is monochrome, it shows Antarctica, the legend is too small and the legend values are arranged from high to low. We can draw a second map without Antarctica, with a blue palette, and with a bigger legend with values arranged from low to high:
    spmap length using "world-c.dta" if NAME!="Antarctica", id(id) fcolor(Blues) legend(symy(*2) symx(*2) size(*2)) legorder(lohi)
You now have the map below. Darker colors indicate longer names, ranging from 4 letters (for example Cuba and Iraq) to 33 letters (Falkland Islands (Islas Malvinas)). To customize the map further, please read the Stata help file for spmap.

Map created with spmap in Stata: length of country names
Example map created with spmap in Stata

The instructions above can be used to convert any shapefile to Stata format. If you have maps in MapInfo format you have to use another program called mif2dta that is described in part 2 of this guide.



Part 2: Creating maps with Stata 8

To create a map with Stata 8 you need the following software.
  • Stata version 8.2.
  • tmap: Stata module for thematic mapping by Maurizio Pisati. Install in Stata with the command "ssc install tmap".
  • mif2dta: Stata module for converting files from MapInfo to Stata format, also by Maurizio Pisati. Install in Stata with the command "ssc install mif2dta".
  • SHP2MIF: DOS program for converting shapefiles to MapInfo format. Go to the the website of RouteWare and click on "SHP2MIF (135 Kb)" under the heading "Converters" to get ishp2mif.zip.
  • Shapefile: For the example in this guide, download world_adm0.zip (646 KB), a shapefile that contains the boundaries of all countries of the world.
Step 1: Convert shapefile to MapInfo format
  • Unzip ishp2mif.zip. The archive contains three files, among them SHP2MIF.EXE.
  • Unzip world_adm0.zip to the same folder as SHP2MIF.EXE. The archive contains three files called world_adm0.dbf, world_adm0.shp, and world_adm0.shx.
  • Open a DOS command window: Windows Start menu - Run - "command" - OK.
  • Change the path in the command window to the folder that contains SHP2MIF.EXE and the three map files. Use the DOS command "cd" to change the path.
  • SHP2MIF works best with short file names in the 8.3 format (name up to 8 characters, extension up to 3 characters). Rename the map files with this DOS command:
    rename world_adm0.* world.*
    The map files are now called world.dbf, world.shp, and world.shx.
  • Convert the maps to MapInfo format by typing "shp2mif world" in the DOS command window. This produces two new files: WORLD.MID and WORLD.MIF.
  • Close the DOS command window.
  • The DBF, SHP and SHX files can be deleted.
Step 2: Convert MapInfo files to Stata format
  • Move the MIF and MID files to a folder that is visible to Stata.
  • Start Stata and run this command:
    mif2dta world, genid(id)
    Two new files will be created: world-Coordinates.dta (with the country boundaries) and world-Database.dta (with the country names and other information). If you plan to superimpose labels on a map, for example country names, you should run the following command instead, which will add centroid coordinates to the file world-Database.dta:
    mif2dta world, genid(id) genc(c)
    Please refer to the tmap documentation to learn more about labels because they are not covered in this guide.
  • The MIF and MID files can be deleted.
Step 3: Draw map in Stata
  • Open world-Database.dta in Stata.
  • The file contains no country-specific data that could be used for this example so we will create a variable with the length of each country's name. The Stata command for this is:
    generate length = length(name)
  • Draw a map that indicates the length of all country names with this command:
    tmap choropleth length, map(world-Coordinates.dta) id(id)
    Be patient because tmap is slow if a map contains many features.
  • The default map is monochrome, it shows Antarctica and the legend is too small. We can draw a second map without Antarctica, with a blue palette, and with a bigger legend:
    tmap choropleth length if name!="Antarctica", map(world-Coordinates.dta) id(id) palette(Blues) legsize(2)
  • To reduce the margins, display the graph again and set the margins to zero:
    graph display, margins(zero)
You now have the map below. Darker colors indicate longer names, ranging from 4 letters (for example Cuba and Iraq) to 33 letters (Falkland Islands (Islas Malvinas)). To customize the map further, please read the Stata help file for tmap and the tmap user's guide by Maurizio Pisati. The user's guide and additional tmap files can be downloaded in Stata with the commands "ssc describe tmap" and "net get tmap".

Map created with tmap in Stata: length of country names
Example map created with tmap in Stata

The instructions above can be used to convert any shapefile to Stata format. If you have maps in MapInfo format you can skip step 1 of the instructions and start with step 2.



Related articles
External linksFriedrich Huebler, 6 November 2005 (edited 31 August 2012), Creative Commons License
Permanent URL: http://huebler.blogspot.com/2005/11/creating-maps-with-stata.html