Rmagic, A Handy Interface Bridging Python and R

Originally posted on Yet Another Blog in Statistical Computing:

Rmagic (http://ipython.org/ipython-doc/dev/config/extensions/rmagic.html) is the ipython extension that utilizes rpy2 in the back-end and provides a convenient interface accessing R from ipython. Compared with the generic use of rpy2, the rmagic extension allows users to exchange objects between ipython and R in a more flexible way and to run a single R function or a block of R code conveniently.

Below is an example demonstrating a simple use case how to push a pandas DataFrame object into R, convert it to a R data.frame, and then transfer back to a new pandas DataFrame object again.
1
In [1]: import pandas as pd

In [2]: # READ DATA INTO PANDAS DATAFRAME

In [3]: pydf1 = pd.read_table(‘../data/csdata.txt’, header = 0)

In [4]: print pydf1.describe()
LEV_LT3 TAX_NDEB COLLAT1 SIZE1 PROF2 \
count 4421.000000 4421.000000 4421.000000 4421.000000 4421.000000
mean 0.090832 0.824537 0.317354 13.510870 0.144593
std 0.193872 2.884129 0.227150 1.692520 0.110908
min 0.000000 0.000000 0.000000 7.738052 0.000016

View original 476 more words

Posted in Uncategorized | 3 Comments

Outside The Matrix: Paul Litvak

Originally posted on :InDecision::

LitvakPaul Litvak is currently a Quantitative Researcher working on the Google+Platform team to improve people’s social experiences online. Prior to that he was a Data Analyst at Facebook working on fighting fraud, tracking the flow of money and improving customer service. He also has a PhD in Behavioral Decision Research from Carnegie Mellon and his dissertation was on the impact of money on thought and behavior. During graduate school he co-founded a boutique data science consulting firm, the Farsite Group, which is consulting for some of the largest retailers and private equity firms to improve their data-informed decision-making processes. Through these various activities he’s managed to keep a foot in both the academic decision science and business data science worlds for the last 6 years. 

Tell us about your work: how does decision making psychology fit in it? I work at Google as a quantitative user experience researcher–I use quantitative…

View original 1,435 more words

Posted in Data Analysis, programming languages | Tagged , , | Leave a comment

Mining data from a search engine

Is the government doing its homework?

Australia is a big country (spatially). But most of it is made of desert, and the bulk of the population lives in coastal areas in the East and South. So the Australian Bureau of Statistics (ABS) created a remoteness definition that classifies locations as anything from a Major City to a Very Remote place. Moreover, they even made it easy for us to use it by making correspondence tables between postcode and the Remoteness Area classification freely available online, here.

ABS also claims that all government bodies use the same classification, including the Department of Health and Ageing (DoHA). While DoHA would have used a different number coding (1-5 for DoHA versus 0-4 for ABS), the remoteness area classification (RA) to which these numbers refer should remain the same. But does it? Our job is to check this assumption.

Strategy

DoHA makes their RA data available too  — well, sorta  — in the DoctorConnect website. This site lets anyone enter ONE postcode, and then returns its corresponding RA. Well, according to the ABS correspondence file Australia has 2,507 postcodes. I’m not entering all these postcodes by hand, one by one, to find out if DoHA’s and ABS’s RAs are the same! But I can let Python do that for me…

Prepare data for search

So the first task is to find a list of Australian postcodes and feed it to the DoHA’s web search engine. ABS made that step easy for us. We just need to download the ABS file and use it. As is often the case, though, it has duplicates (postcodes might be split between two RAs) and the RA code is concatenated with a state numeric code. So the first step of our code, as is de rigueur, is devoted to clean up the data:


from pandas import DataFrame, Series
import pandas as pd

state = {'1':'NSW', '2':'VIC', '3':'QLD', '4':'SA', '5':'WA', '6':'TAS',
         '7':'NT', '8':'ACT', '9':'OT'}

df = pd.read_csv('CP2006RA_2006POA.txt', lineterminator='\n')
df.columns = pd.read_csv('CP2006RA_2006POA.txt').columns

df['RA_2006_STR'] = [str(a)[1] for a in df['RA_2006_CODE']]
df['RA_2006_STATE'] = [str(a)[0] for a in df['RA_2006_CODE']]
df['POA'] = [str(a) for a in df['POA_2006.1']]
df['STATE'] = [state[a] for a in df['RA_2006_STATE']]
df['STRING'] = df['STATE'] + ' ' + df['POA'] + ' Australia'
df.sort(['PERCENT'], ascending = False, inplace = True)
df = df.drop_duplicates(['POA_2006.1'])
df.sort(['RA_2006_STATE'], ascending = True, inplace = True)
df.index = range(len(df.index))

Now we have a tidy pandas DataFrame:

DataFrame after munging

The search

And we are ready to start feeding DoctorConnect with postcodes (as in the ‘STRING’ column) and collecting the RAs. Notice that, as DoctorConnect relies on Google to make its address search, it could search anywhere in the world. Hence, I am preventing any confusion by giving it not only the postcodes, but also the state and the country. Likewise, I will be saving the address it gives me back with the RAs. I am choosing to match the address it returns to me, rather the address I gave to it, as the source of the postcodes I’ll use later to join my dataframes.

We will use the superb selenium engine to send our Python incantations to a running Firefox instance:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

browser = webdriver.Firefox() # Get local session of firefox
browser.set_page_load_timeout(30)
browser.get("http://www.doctorconnect.gov.au/internet/otd/Publishing.nsf/Content/locator") # Load page
assert "Locator" in browser.title
search = browser.find_element_by_name("Search") # Find the query box
ret = browser.find_element_by_id("searchButton")

doha_ra = {}

for i in df['STRING']:
    switch = True
    while switch == True:
        search.send_keys(i)
        ret.send_keys(Keys.RETURN)
        try:
            addr = browser.find_element_by_xpath("//table/tbody/tr[2]/td[2]")
            ra = browser.find_element_by_xpath("//table/tbody/tr[4]/td[2]")
            doha_ra[addr.text] = ra.text
            switch = False
        except:
            pass
        search.clear()
browser.close()

doha_ra = Series(doha_ra)
doha_ra.to_csv('doha_ra.csv')
df.to_csv('abs_data.csv')

And a couple of hours later (give or take), we have the complete DoHA postcode/RA correspondence file!

DoHA postcode / RA correspondence file

Wrapping up

The rest of the work resembles most of the beginning of the script, in inverse order:

  1. We extract the postcode from the address string (with the handy help of a regular expression);
  2. We merge the ABS and DoHA postcode / RA tables.
import re

doha_ra = pd.read_csv('doha_ra.csv', header=None)
doha_ra.columns = ['str','ra']
poa = re.compile('\d{3,4}(?=, Australia)')

def reg_ex(x, regex=poa):
    try:
        return re.search(regex,x).group()
    except:
        return np.nan

doha_ra['POA'] = [reg_ex(i) for i in doha_ra['str']]
doha_ra['POA'] = doha_ra['POA'].astype(np.float)
doha_ra = doha_ra.drop_duplicates(['POA'])
abs_ra = df[['POA','RA_2006_STR']]
abs_ra['POA'] =  abs_ra['POA'].astype(np.float)
abs_ra = abs_ra.drop_duplicates(['POA'])
res = pd.merge(abs_ra, doha_ra, on='POA')
Final dataframe with Australian postcodes and corresponding ABS and DoHA RAs

Final dataframe with Australian postcodes and corresponding ABS and DoHA RAs

And finally we create a table with the crosstabulation postcode counts of ABS RAs and DoHA RAs:

def summary_table(df, columns, value, func='count'):
    df_grouped = df.groupby(columns)
    return df_grouped[value].agg(func).unstack([columns[-1]]).fillna(0)

table = summary_table(res, ['RA_2006_STR', 'ra'], value='POA')

au = re.compile('(?<=\d{4}, )\w{9}')
doha_ra['chk'] = [reg_ex(i, regex=au) for i in doha_ra['str']]
res.columns = ['postcode','ABS RA', 'str', 'DoHA RA', 'chk']
res = res.drop('str', axis=1)
res = res.drop('chk', axis=1)
table.to_csv('result.csv')
res.to_csv('POA_DoHA_RA_201301.csv')

And the verdict is (28 January 2013)…

Final dataframe with ABS and DoHA codes corresponding to each Australian postcode

Posted in ABS data, Australia, Data Analysis, Python | Tagged , , , , , , , , , , , | Leave a comment

pandas to excel (with xlwt styles!)

Why use Python, pandas, xlwt?

While using R is mandatory when doing just about anything statistical, Python code is usually faster, more readable and is not limited to the analysis stage. R is a statistical language, and Python is a complete programming language. The Python pandas library provides very much the same functionality found in R data.frames, which means one could do their data wrangling in Python for a fraction of the time spent in R, and with better code.

Python also offers the xlwt library, which enables one to write just about anything to XLS files, including setting borders, colors, number format and functions. Taken together, having pandas and xlwt would mean one could automate complex reporting through Python scripting, right?

Missing functionality: Excel cell styles

If you’re a heavy pandas user and have to provide reports in Excel format, you would know that pandas’ DataFrame.to_excel method lacks support for xlwt styles. This is a major limitation. But is also easily solved. Whereas I would gladly contribute to pandas if I could reach github from work, the second best solution, and much more time efficient, is to simply subclass DataFrame and Series to include that support.

How can that be so simple? Well, pandas does support xlwt styles. It is there in the code, but hardcoded to one standard style. Pandas uses xlwt to write to XLS files, and xlwt requires a style argument. So the trick is just to create a xlwt.Style object and pass it as an extra argument to the subclassed pandas object.

Missing functionality: Column MultiIndex in to_excel

It is a matter of taste that I would like my column MultiIndexes to work as expected (one row per level) and not as the standard implementation (appended strings).

Hidden functionality: xlwt style string as dict

I didn’t see it described anywhere in the pandas documentation, but its source has a very neat parser to create xlwt styles from dicts. It doesn’t include number formats, but most everything else can be stored this way. It goes without saying that it makes code much more readable. The code below


conv = pd.io.parsers.CellStyleConverter()
hstyle_dict = {"font": {"bold": True},
               "border": {"top": "thin",
                          "right": "thin",
                          "bottom": "thin",
                          "left": "thin"},
                "pattern": {"pattern": "solid",
                            "fore_colour": 26},
                "align": {"horiz": "center"}}
hstyle = conv.to_xls(hstyle_dict)
dstyle_dict = {"border":{"top": "hair",
                        "right": "hair",
                        "bottom": "hair",
                        "left": "hair"}}
dstyle = conv.to_xls(dstyle_dict)
dstyle.num_format_str = '$#,##0.00'

And an object from the new XLtable class


t = XLtable(your_pandas_DataFrame_object)
t.place_table(ws=ws_1, row=5, col=5, dstyle=dstyle, rstyle=hstyle, cstyle=hstyle)

Would give you

result in Excel

result in Excel

Methods for Series and placing data, column and row indexes separately are also available. What are you waiting? Grab the code at my Gist repository!

Posted in Data Analysis, Python | Tagged , , , , , , , , , | 6 Comments

Speed up your map plotting in R

I have been forever annoyed at how long it takes to plot data on a large shapefile. And this is a domain where doesn’t matter if you’re working with MapInfo or R. Just zooming the figure takes ages. But a couple of days ago I bumped into an excellent blogpost by John Myles White that solved the problem in the most Daoistic way, reminiscent of Steve Jobs: Do away with the shapefile!

To have a quick overview of one’s data, there is no need for a shapefile. Just plot latitude and longitude directly into a scattergraph.

That’s it.

Here’s how it is done. For our example, let’s plot a map showing the ratio of Foreign-born vs. Australian residents, by postcode, in all of Australia. As a first step, I made a search and found a ready-to-use file with all Australian postcodes and their geographical coordinates. Next, I got some Census data from the Australian Bureau of Statistics, specifically counts of Australian-born and foreign-born residents sorted by postcode. Quick munge and plot (code below), and voilà!

scatter Admittedly this is a quick fix: One has to guess the shape of Australia and the location of its major cities from their relative place on the map. Even with this limitation, though, I find this solution really appealing. Instead of waiting for many minutes each time I redraw or resize a graph, I can get a complete overview of my dataset instantaneously(!).

require(ggplot2)

setwd('/Users/myuser/R/map')
poa <- read.csv('data/2011_BCP_ALL_for_AUST_short-header/2011 Census BCP All Geographies for AUST/POA/AUST/2011Census_B01_AUST_POA_short.csv', as.is=TRUE)
poa$poa <- as.integer(sub('[a-zA-Z]{3}','', x=poa$region_id))

# Ratio Aus born vs elsewhere born
ratio <- data.frame('poa'=poa$poa,'Freq'=poa$Birthplace_Australia_P/poa$Birthplace_Elsewhere_P)

zipcodes <- read.csv('data/pc_full_lat_long.csv')
zipcodes <- zipcodes[!duplicated(zipcodes$Pcode),]
zipcodes <- zipcodes[!zipcodes$Lat == 0,]
zipcodes <- zipcodes[!zipcodes$Long == 0,]
poacoord <- data.frame('poa'=zipcodes$Pcode, 'lat'=zipcodes$Lat, 'long'=zipcodes$Long)

popcount <- na.omit(merge(ratio, poacoord, all=FALSE))
popcount <- popcount[rev(order(popcount$Freq)),] # Place the small bubbles on top
popcount$cat <- sapply(popcount$Freq, function(x) if (x < 6) {'> 1:6'} else {'< 1:6'})

ggplot(popcount, aes(x=long, y=lat, colour=cat)) +
scale_size(range = c(1,20), name = 'Population') +
geom_point() +
coord_equal()

And once we get the data presentation right, we can add the shapefile and go get some tea.

# must have gpclib installed
require("rgdal") # requires sp, will use proj.4 if installed
require("maptools")
require("ggplot2")
require("plyr")
gpclibPermit() # required for fortify method
setwd('/Users/myuser/R/map/data/shp')
amap <- readOGR(dsn=".", layer="aust_cd66states")
amap@data$id = rownames(amap@data)
amap.points = fortify(amap, region='id')
amap.df = join(amap.points, amap@data, by='id')

ggplot() +
geom_polygon(data=amap.df, aes(long,lat,group=group)) +
geom_path(data=amap.df, aes(long,lat,group=group), color="grey") +
geom_point(data=popcount, aes(x=long, y=lat, colour=cat)) +
scale_size(range = c(1,20), name = "Population") +
scale_colour_discrete(name="ratio of Foreign vs\nAustralian-born") +
coord_equal()

shp

Posted in ABS data, Australia, Data Analysis, ggplot2, Mapping, R | Tagged , , , , , | Leave a comment

Measuring care in health

The Australian health care system is one of the best in the world. It provides free or heavily subsidised health care for all citizens, and rebates for prescription medicine, at a relatively low cost to the public. However, if you ask the citizens if they are happy, they will complain. Doctors and nurses might be even more vocal in their dissatisfaction. Both these groups notice that the system is not coping with the present demand for service. As a result, the Labor government has proposed a health reform in early 2009. Much political talk happened between then and now. The scoreboard so far is printed in the 2011-2012 federal budget. It commits more funding for mental health and hospitals, and it also creates the National Health Performance Authority, which will be an advisory body reporting to the minister for health and ageing. While more money and more thinking are good steps, no one will claim that these are fundamental changes. Increasing spending does not automatically lead to better spending. In the following lines, I intend to compare how the Australian government evaluates outcomes in the areas of health care and scientific research. This should show that measures of cost efficiency are not enough to meet public expectations about the health system. The assumption I make is that the government is making huge investments in improvements in health care that are not a priority in the eyes of their constituency, and hence their health policy should be changed.

Costs and benefits

Most scientific research in Australia is funded by the government. To cover research costs, and often their own salaries, scientists have to apply for research grants. Explaining how the research is technically sound is not enough to secure funding. To be successful, the proposal needs to clearly state how the knowledge gained from the research will ultimately benefit the Australian public. Although rich, Australia has finite resources. The public is mindful of how their money is spent, so the tax money could be used in their best interest, and not squandered.

Health spending is also strictly controlled through tight management. A huge load of bureaucracy follows everything that is done in a hospital. Yet none of these account for patient satisfaction. Really. The Australian Hospital Statistics 2009-2010 report, published by the Australian Institute of Health and Welfare, comes very close to a “patient satisfaction” concept when it defines “responsiveness”. A hospital is responsive when “service is client orientated; clients are treated with dignity, confidentiality, and encouraged to participate in choices related to health care”. But in the very next line, the same document states that “there are no indicators of responsiveness available for hospitals”.

Management in a hospital ensures good value for money in the sense of maximising volume. The more patients one doctor sees in a day, the better. The more surgeries performed in a room, the happier the government is. But surprisingly, the system is also managed without regard to cost/benefit. Quite simply, there is not enough money to give the best treatment to everybody. To offer cutting edge medicine, hospitals save by restricting access. So instead of giving a second rate hip replacement to all Australians, it gives the latest hip to some and sends the rest to the queue to wait for their turn.

This is only true of hospitals, though. The PBS scheme, which offers rebates over some prescription drugs, selects which ones to fund by using cost/benefit criteria. It will not fund the latest drug if a cheaper one achieves similar outcomes, albeit with more side effects. This ensures everyone can be covered by this scheme. Why not use the same principle for decisions involving hospital procedures?

Similarly, it would make sense to balance hospital treatment costs to the areas where patients feel most need. Clinical practice will offer many examples where very expensive treatments are poured on patients who are terminally ill. Offering every resource available to help the sick is a cultural imperative. It is also a cultural lie. Patients who receive intensive care are often unhappy with it. This extreme level of financial and technical commitment to maintain them alive is seldom paired with an increased concern to their emotional needs. They know they will not recover. In this situation, human kindness would have a far greater impact on their wellbeing than expensive drugs or treatments. Moreover, to offer this level of expenditure to some, we let others die in the queue. Not much can be done to fix the Australian health system without taking these needs into account. But if we face this dilemma in the eye, we would achieve much more than a health reform. We would make Australian medicine more humane.

Volume versus quality

As mentioned earlier, hospitals record everything that is done there. Most of it is transformed into statistics. In the event of a malpractice claim, the records can be used as evidence.  But apart from this extreme, a doctor does not have his clinical records reviewed or evaluated. Perhaps it would be expensive and counterproductive to do so. This kind of control over individual doctor outcomes would create more bureaucracy, more stress, and could not possibly improve their efficiency.

The universities train medical students to become doctors. Just like the health system, they are managed to maximise each dollar invested in education. That means that medical schools, like hospitals, are geared towards volume. The more students they train each year, under a given budget, the better. Of course, there are also exams to ensure that students possess the knowledge they need in order to become competent doctors. Exams, though, have a deficiency. They reward cost/benefit too. A student that gears their study towards passing the exam, rather than treating patients competently, will be more successful. Students who pass exams will not necessarily become good doctors. Likewise, universities that are geared towards preparing students to succeed in exams, rather than curing patients, also maximise their financial investment. The only loser in this scheme, of course, is the patient.

In science there is no such shortcut. Researchers are evaluated by their track record, which is public. Every time they apply for funding, both the quality and volume of their output is judged by their peers. In science, this fair process is also the source of much unwanted paperwork, both for the applicant and their peers. In health the paperwork is already there, in the form of medical records. But instead of using them to judge individual doctors, this wealth of information could be used to evaluate medical courses. By judging the outcomes of doctors, anonymously, while tracking their alma mater, the school where they earned their medical degree, the health system would ensure universities trained doctors for patients, not university exams.

Vision

It is true that the Australian health system invests heavily on new treatments that saves lives. It is also true that the public is not satisfied with the treatment they receive. How can that be? Perhaps better treatments and improved technical expertise is not how the public expects our health system to improve. A 2010 review by Gordon and colleagues showed that the main concern of patients in emergency departments is not the shortage of technical resources, but the lack of care for their emotional needs. This might be a general condition in the Australian health system. Unfortunately, as mentioned before, the system does not monitor patient satisfaction, so we do not know for sure how widespread or deep this problem is.

To start tracking client satisfaction, hospitals would need to create specific measures for it. In the scientific world, indexes such as how many times a researcher is cited by peers is the gold standard. In health, number of hospital discharges and similar measures are used to track efficiency. This carries the assumption that all a patient could possibly seek in a hospital is a chance to leave. Perhaps asking about satisfaction at discharge could give this assumption a validity test? The system we have offers cutting edge medicine, but at a price our society cannot pay without rationing. The consequence is that patients feel they are not being given as much as they need, and the government treats them as a cost, a drain in the budget. It would make more political sense to invest money on the services the patients demand, and to as many as possible. After all, patients should not be regarded as a liability. Their wellbeing should be the very reason the health system should exist.

Posted in Australian health system, Health care reform, patient satisfaction | Tagged , , , , | Leave a comment

Why Copts matter

Introduction

A westerner watching the news in the week following the New Year’s Eve of 2010/2011 might have been surprised with what was happening in Egypt. A bomb exploded outside a Coptic church in Alexandria, killing 21 and leaving 97 injured. Wait, go back. What are Copts? Isn’t Egypt a muslim country, how come there are churches in Egypt? Aren’t suicide bombers supposed to only target Israeli civilians and American troops? And then, less than a month later, a wave of massive protests rocked Egypt and toppled the government. Again the newsreader would be taken by surprise. But this time, the events would command much more interest. Will this democratic movement spread to other arab-speaking countries? Will democracy ease or intensify the tensions between these countries and Israel? And of course, will democracy lead to a secular or Islamic fundamentalist rule? Due to the far-reaching consequences of the 25 of January revolution, it would be understandable if our newsreader lost their original interest about the Copts as if they were yesterday’s news. On the contrary, I intend to show here that the Copts hold the key to the success or failure of the Egyptian revolution.

Why are there Copts in Egypt?

In many African countries, Christianity was introduced by European missionaries that came at the time of the European colonisation. This is not what happened in Egypt. There are Christians in Egypt since 42 AD, when St Mark moved to Alexandria. By the way, we owe 1/4 of the New Testament to him. Egypt was one of the most important centres of early Christianity. Monasticism was arguably an Egyptian invention. The most consequential heresy of the early Christianity, Arianism, was created by an Egyptian (Arius), and was also fought against by an Egyptian (Athanasius). In part due to the theological debate that ensued, both Copts, Greeks and Catholics recite the same formula, the Nicene Creed, during every Sunday mass.

Coptic icon representing Saint Antony the Great

Coptic icon of Saint Antony

The adoption of Christianity by the Roman Empire in 380 AD did not ease matters for the Egyptians, though. In 451 AD, the majority of Egyptians refused to accept the doctrine that Jesus has two separate natures, one divine and one human. Due to that, they were the target of harsh religious persecution by the Roman state, and broke away from the main branch of the Christian Church. By that time, the centre of Roman political and economical activity had shifted from Italy to Greece. Italy was ravaged by invading Barbarian tribes, who incidentally were also Christian, but followed the Arian heresy. Already at odds with the Greeks, the Italian church would soon also break away and become what we know as Catholic Church.

The Egyptians continued to be oppressed by those who sided with the Roman Emperor until Arab Islamic armies invaded the country in 641 AD. By one of those twists of fate, after decades of civil strife, the Roman army decided to leave the rebelling country to the Arab invaders without much resistance. Still, many government officials chose to stay, continuing their business as before, as the Arabs did not have interest or skills in administration. Under Arab rule, enforced by a chiefly Roman administration, the Christians continued to be treated as fair game. This of course led to a slow but progressive conversion to Islam. Nevertheless, many chose to maintain their religion. At the time of the Arab invasion, all Egyptians were Christian. “Copt”, now a term used in reference to the Egyptian Christians, is a derivative of the Arab word for “Egyptian”.  They are now 10 to 15% of the population, which is the same percentage of African-Americans living in the USA.

What role do the Copts play in Egypt?

According to the Constitution of 1971, now suspended by the military, Egypt is an “Arab Republic”, Islam is the Religion of the State, and Islamic Law is a principal source of legislation. The religion of each citizen is displayed on their personal documents. Copts are allowed to become Muslim, but conversion from Islam to Christianity is illegal, and an informal, state-tolerated death sentence ensues. Building of new churches or refurbishment of old ones requires a special license signed by the President. No special license is required for mosques.

Cave cathedral of Simon the tanner, garbage city, Cairo

Despite this level of control, Copts are not actively persecuted by the government. Rather, historically there was an effort to create a “separate but equal” society. Copts and Muslims joined forces in the 1919 Revolution, and the nationalist movement always appealed to all Egyptians regardless of religion. Most barriers preventing Copts to compete in fair grounds with Muslims today come from their being an unprotected minority, in a country where corruption runs free. This is evident in that the proportion of Copts occupying managerial offices within government and industry is much smaller than their share of the population. The rise of Islamic extremism in the 1970s worsened this situation, as the government became more vocal in its support of Islam. The net result of this shift was that this already biased society became even more myopic towards attacks against Copts.

What interest would Copts have on the outcome of the Revolution?

Regardless of what some Islamic extremists claim, it would be impossible for Copts to transform Egypt into a Christian country. This is as fanciful as Charles Manson’s Helter Skelter profecy, in which he thought all white Americans would be killed by blacks. Copts can only hope that Egypt becomes a secular society. As long as Egypt enforces Islamic superiority through government, Copts will have some sort of disadvantage. Even if the majority of Muslims are tolerant towards Copts, political leaders who appeal to Muslim sentiments would be able draw from a larger demographic. This is true except in the case of a common enemy, such as a foreign invader or an internal dictator. In such circumstances where all help is needed, even the Copts are welcome friends.

There has been much talk about whether Egypt will emerge as an Islamic fundamentalist regime as was the case of Iran. Clearly, from the point of view of a political leader, the adoption of a Muslim line will bear both nationalist and religious appeal. If the elections are to be held shortly, one cannot count victory on the most ponderous party. The emerging victor will be the candidate which could attract a majority vote. A successful party line will be one that appeals to Egyptians on terms they understand today, not in a distant future after they had educated themselves on economy and politics.

Copts are the only fraction of the population that, regardless of circumstances, will oppose political Islam. They are the only Egyptians who feel that the past regime was already an Islamic rule. The Muslim majority regards Mubarak’s regime as either secular or moderate. In this, they agree with the Americans, Europeans, and Israelis. Copts in the other hand cannot be made to believe that Muslim charity would improve the lives of the poor. Their poor were always, and will continue to be, outside of the scope of such policy.

How could the Copts contribute to the outcome?

A Coptic party could not aspire to rule the country. Copts could only further their goal of electing a government devoid of religious partisanship by lending their support to secularism. To assert their difference will only engage the interest of radical Islamists. If they want secularism, they will need to subscribe to a non-religions, or even anti-religious, line. The educated class in Egypt, which would support such line, is not numerous either. Copts could not afford to estrange them by conflicting with their disinterest in religious matters.

Revolution can be good for business

Copts will be hard-pressed by populist demands too. Of course everybody wants to help the poor. Unfortunately, the only people who pay taxes to support social schemes are the middle class. The poor cannot afford it; the rich can dodge it. Taxation of business can slow the economy or even break it. Businesses will find political allies who could protect their interests. Excessive taxation would weaken the alliance between the Copts and the middle class, who are exactly the ones who would be interested in a secular rule. A strong economy, on the other hand, could only help the middle class to grow. These constraints will direct the Copts to support reforms that increase opportunity based on merit, and oppose direct aid to the poor.

Now, how would the Copts derive support from business? The only Copt who made it big was Naguib Sawiris, the mobile telephony tycoon. But even he would not support a policy that went against his business. Here, Copts will have to ally with business interests that are at odds with fundamentalism. The tourism industry is one, the press and Internet are other examples. It is important to realise, though, that most businesses, these included, could still survive under Islamic rule. Business cares about business, and concessions will have to be made.

Who are the enemies of the Copts?

Targeting the Copts becomes handy every time there is a need to distract Egyptians from the government. Too busy discussing religious unrest, people forget to mention corruption, unemployment and police brutality. A document that emerged after the Revolution links the New Year’s Eve Coptic church bombing not to Islamic extremists, but to the State Security Intelligence, Mubarak’s secret police. Recent attacks on Coptic monasteries could be interpreted in the same light. Although some claim that the old regime protected Copts from the rise of Islamic fundamentalism, it is also fair to say that it used fundamentalism to secure Coptic support to the government. This is dangerous. If Copts are seen to support the old regime, this would polarise the anti-Mubarak movement towards the opposite side of the religious spectrum, that is, towards Islamic fundamentalism.

Muslim and Christian in Tahrir square

Copts have nothing to gain with opposing Islamic radicals on religious grounds. This could only serve to push moderate Muslims away. It is clear that Islamic autocracies such as Saudi Arabia will have a vested interest in supporting the latter. Even more, they can easily draw support from the population by equating Copts with both present Western (Christian) Imperialism and with historical Crusader armies, even though Copts played no part in either. Hence, these potential adversaries should not be engaged with. Fighting would only give them an opportunity to extend even more their influence over Egyptian politics.

Why should you care?

We live in a globalised, interdependent world. This creates tensions between neighbouring families, for example, when one has to stand foreign music being played out loud across the wall. In contrast, it eases tensions between countries, as these end up with a similar mix of multiple cultural backgrounds. Moreover, economic interdependence means countries cannot hope to start conflict abroad without having to face impossible economic setbacks. To cater for diverse tastes both internally and externally, nations are pushed towards greater tolerance for difference and secularism. This is not uniformly good. Greater tolerance for differing views also means greater difficulty in seeing and preventing evil. To illustrate this, we can refer to the Internet. One can have access to free political debate there, but the free mix will include political extremism and pornography.

Islamic fundamentalism goes in the opposite direction. It appeals to supremacy of one belief over others. It aims to tackle the burden of a globalised world by imposing a clear set of values. At the same time it leaves less space for individual freedom, it creates an uniform rule where right and wrong is clear. This has advantages. One has just to remember the fate of drug dealers in some Islamic countries to understand that point.

There is a danger, though, in uniformity. We have all lived through the years of clear distinction between Capitalist and Communist countries, and know what it feels like. This danger is abundantly obvious in the Middle East. There we have an uniformly Jewish state surrounded by uniformly Arab-speaking countries. Globalisation, secularism and trade would certainly not harm the relations between these countries. Supremacy of one over another certainly would.

1919 revolution flag. This symbol surfaces every time Muslims and Copts unite for a common cause. Maybe it is about time they forget who is Muslim and who is Coptic, so that calls for unity could finally become superfluous.

Posted in Christian, Coptic, Egypt, History, Islamic fundamentalism, Politics, Revolution | Tagged , , , , , , | 3 Comments