Updated map in R maps package

The maps package in R plots very nice maps at global to regional scales. The problem with maps was that it used a 1990 map of national borders: slightly awkward when plotting maps covering countries that were once part of, for example, the Soviet Union and are proud of their independence.

I used to circumvent this problem by plotting the country borders the same colour as their fill with

map(col = "grey80", border = "grey80", fill = TRUE)
map(col = "grey80", border = "grey80", fill = TRUE,
xlim = c(10, 30), ylim = c(46,53)) #FAIL

This works at the global scale, but fails miserably if you want to plot a swathe of Eastern Europe.

Today, I am in Estonia giving a tutorial on R to some palaeolimnologists, and was rather embarrassed to have to explain that their country didn’t exist according to R’s easy to use mapping package. I told them that it was possible to use shapefiles as an alternative, but that is somewhat more involved.

Wondering if there was an alternative way to plot Estonia and other recently independent countries (or how much work it would be to update the map), I was delighted when I downloaded the maps package from CRAN and got the message

# ATTENTION: maps v3.0 has an updated ‘world’ map. #
# Many country borders and names have changed since 1990. #
# Type ‘?world’ or ‘news(package=”maps”)’. See README_v3. #

when I loaded the package.

The maps package now uses CIA’s current political borders database (Crimea is Ukrainian). Many thanks to whoever updated the package.

map(col = "grey80", border = "grey40", fill = TRUE,
  xlim = c(10, 36), ylim = c(36, 62), mar = rep(0.1, 4))

Eastern Europe with political borders

Posted in R, Uncategorized | Tagged

How foreign is the past?

The past is a foreign country: they do things differently there.
L. P. Hartley

Wooly mammoths. Saber-toothed cats. Giant sloths. You don’t need to think very long before some differences between modern ecology and the ecology of the past become apparent. Altered nutrient cycles. Introduced species. Altered soundscapes.

One of the important rationales for studying palaeoecology is that knowledge of past ecosystems can help understand modern ecosystems and make predictions about future ecosystems on our warming planet. This skill might be limited if, as Lyons et al suggested in Nature last week, the rules that govern how plant and animal communities are structured have been altered by the pervasive influence of humans on Earth’s ecosystems.

Lyons et al compile many datasets of species presence and absence for modern and fossil data over the last 300 million years and test whether pairs of species tend to aggregate together, segregate or co-occur at random.

In the modern datasets, most species pairs randomly co-occur. Species with non-random patterns tend to segregate. Lyons et al find the converse pattern in fossil data: pairs of species tend to aggregate. The switch from aggregation to segregation occurred about 6000 years ago, coincident with the expansion of agriculture.

It would be interesting to consider how the relatively limited impact of mid-Holocene agriculture could have such profound consequences. Could the processes, for example habitation fragmentation, suggested by Lyons et al change the rules of species assembly.

We could test the results of Lyons et al with alternative data, for example the European pollen database which is analogous to the North American pollen database used by Lyons et al.

But first we need, as Lyons et al do, to consider the possibility that the results are an artefact of some property of the data. Lyons et al first show that the result is not dependent on the modern data: a decline in aggregated species pairs is seen even if only the fossil data are analysed.

Loess curve weighted by number of sites with shaded 95% confidence intervals illustrates the reduction in the proportion of aggregated species pairs towards the present. Data are analysed with (black line and shading) and without (red line and shading) the modern data. Colours indicate continent: North America (green), Eurasia (purple), Australia (dark grey), South America (dark blue), Africa (orange). Point shapes indicate type of data: pollen (square), mammals (triangle), macroplants (circle). Data on terrestrial communities from ref. 2 are diamonds. Only mainland assemblages were included in the calculation for the weighted Loess curve and the density plots here and in Fig. 1.

Loess curve weighted by number of sites with shaded 95% confidence intervals illustrates the reduction in the proportion of aggregated species pairs towards the present. Data are analysed with (black line and shading) and without (red line and shading) the modern data. Colours indicate continent: North America (green), Eurasia (purple), Australia (dark grey), South America (dark blue), Africa (orange). Point shapes indicate type of data: pollen (square), mammals (triangle), macroplants (circle). Data on terrestrial communities from ref. 2 are diamonds. Only mainland assemblages were included in the calculation for the weighted Loess curve and the density plots here and in Fig. 1.

The Holocene decline in the proportion of aggregated species pairs is driven by a small number of 20th century “fossil” data sets. Quote marks on “fossil” as delving into the extensive supplementary material shows that only one of the 2oth century data sets actually comprises fossils. Regardless, I’m not convinced this decline is particularly robust.

Lyons et al test whether there is a relationship between the proportion of aggregated pairs and the spatial or temporal grain and extent of the datasets. They find no significant patterns, but the relationship with spatial extent is suggestive (p = 0.066). Lyons et al only test for these patterns in the fossil data sets, so the modern-fossil contrast is missing. The obvious thing to do is to add the modern data to this analysis, but that would take a lot of digging.

Lyons et al is interesting and provocative, but I am inclined to think that the result is probably an artefact. This paper will be the subject of our next palaeoecology journal club meeting; I’ll update this post afterwards.

Posted in Peer reviewed literature | Tagged | 4 Comments

A Plagiarism Adventure

It is always worth reminding students that google-copy-paste is not a valid method of writing essays. This video, made by the University of Bergen a few years ago is an excellent reminder. Watch it (subtitled) if you haven’t seen it before; show it to your students.

Posted in Uncategorized | 1 Comment

2015: The year in reviews

Reviewing is part of an academic’s workload, part of our service to the community. I think it tends to make papers better, even if only by finding out which aspects of a manuscript might confuse someone who is reading too last and thinking too little.

I am not the best reviewer: I am often late, occasionally woefully so; I hate reviewing manuscripts for a second (third, fourth, …) time, and I tend to focus on the methods and results. But I do the job. I nearly always accept invitations to review unless the manuscript is outside my area of competence (for example, I twice declined to review a manuscript on heart attack risks in sub-Saharan women – perhaps another Richard Telford was the intended reviewer), there are serious conflicts of interest (I was once asked to review a manuscript where my name had accidentally been omitted from the author list), or I know I have no time to do it within the set deadline. I hear rumours of scientists who somehow never have time to review. They are freeloaders (unless they do other service). I am sure they would rapidly complain if their manuscripts were not reviewed by others (this is not a practical suggestion – innocent parties like PhD students would be harmed).

Last year was a fairly busy year for reviews:

• Atmospheric Terrestrial and Solar Physics (1)
• Boreas (1)
• Climate of the Past (3)
• Environmental Science and Pollution Research (1)
• Frontiers in Ecology and Evolution (1 seven times)
• Global Ecology and Biogeography (1)
• Journal of Biogeography (1)
• Journal of Paleolimnology (2; got a certificate as a “top 25” reviewer)
• Journal of Quaternary Science (1 twice)
• Quaternary Science Reviews (3)
• Scientific data (1)

Yes, I know that some people review (or at least asked to review) more manuscripts in a month than I do in a year. I don’t know how they do it. I’m doing well if I can write a review in half a day. It often takes longer if I need to check some literature or think about the implications of a strange method or unexpected result.

I appreciate it when the editor informs me of their decisions about a manuscript (not that I always agree). Seeing the other reviewers’ reviews is also useful and can be reassuring that I am not being too harsh or missing major problems. One manuscript I reviewed recently had four reviewers, we concurred on every substantive point.

I appreciate it less when I spend time pointing out problems in a manuscript and suggesting how it can be improved, only to see the original version published in another journal. Certain scientists seem to this repeatedly.

Once, I was angrily accosted at a conference and accused of writing a harsh review of someone’s manuscript. In this particular case, the accusation was unfounded, but my reviews are often critical. I try to be constructive, even for those manuscripts that are so misconceived that nothing can save them. My reviews don’t read like a typical blog post here (but some reviews for Climate of the Past were based on material posted here first).

I find the way manuscripts are laid out for review can be irksome. I understand why printers wanted figure captions separate from the figures when manuscripts were submitted on paper. Now this just serves to make the reviewer’s job more difficult, having to scroll back and forth to read the caption of a complex, multi-part figure – in the last manuscript I reviewed, the figure caption for the last figure was 15 pages away from the figure. Ideally the figure would be near the text that refers to it. Some journals manage at least to get the figure and caption on the same, or adjacent, page. Please can the rest make it their New Year’s resolution to fix this? And while they are at it, please make the line numbers tally with the lines of text.

Posted in Uncategorized | Tagged | 3 Comments

LIDAR data and flooding

I’ve been visiting my family in northern England over Christmas. We had a lot of rain. Fortunately, no houses in my village flooded, but others in the region were devastated and further extreme weather is forecast for the next few days.

Information on the risk of flooding at a property is required before action to defend against floods or to minimise the harm that floods cause, can be undertaken.

The UK Environment Agency produces flood risk maps. These are very useful, but if you want to know more details – how high is your property above the river, do you live in a floodable depression – you need to get your hands on a digital terrain (or elevation) model.

LIDAR (similar to RADAR, but with light rather than radiowaves) can be used to generate very high resolution digital terrain models. The Environment Agency has done this for most of England and Wales. The data can be downloaded free of charge under the Open Government Licence. You want the digital terrain model rather than the digital surface model (which shows the height of roofs rather than the ground).

The data are easy to process in R to make maps using the raster package after they have been unzipped (yes, you can do this with R with unzip() if you really want to).

This code imports the data from four tiles, merges and plots them.


f1<-merge(ny5816, ny5716, ny5817, ny5717)
points(358330, 516976, pch = 16, col = 2)
#numbers are grid reference from http://gridreferencefinder.com/

A legend, scale bar, etc could be added. The question here is whether Winter Tarn Farm (at the red triangle) is at risk of flooding by the epynonymous tarn. Winter Tarn, as its name suggests, is a transient water body that occurs after wet weather, usually in winter.

I’m going to use filledContour() to make a map that is easier to interpret. Rather than using the default contour levels, I’m going to focus in on the elevation range of most interest, from the bottom of the depression upto the farm. For orientation, I’m going to add some road and streams using shapefiles downloaded from the Ordnance Survey.

filledContour() is a wrapper for filled.contour() and shares its somewhat unusual syntax. The output is actually a combination the filled contour plot and a legend. The coordinate system for these plots is only used internally: you cannot annotate the contour plot (easily) after it is produced. Any annotation needs to be specified in the plot.axes argument.

surfacewater <- readOGR("d:/temp/opmplc_essh_ny/OSOpenMapLocal (ESRI Shape File) NY/data", "NY_SurfaceWater_Line")
road <- readOGR("d:/temp/opmplc_essh_ny/OSOpenMapLocal (ESRI Shape File) NY/data", "NY_Road")

f2<-crop(f1, extent(c(357223,358993,516008,517764)))#restrict to area of interest

x11(7.9, 7)
par(mar=c(3, 3, 3, 3))
              plot.axes = { 
                points(357947, 517092, pch = 17, col = 2)
                arrows(x0 = 358100, x1 = 358600, y0 = 516100, y1 = 516100, length = 0, lwd = 2)
                text(x = 358350, y = 516150, label = "500 m")
                arrows(x0 = 358900, x1 = 358900, y0 = 517450, y1 = 517650, length = .2, lwd = 2, code = 2)
                text(x = 358900, y = 517700, label = "N")
                lines(surfacewater, col = 4)
                lines(road, col = 2)
                asp = 1 ,
                levels = c(263, 270:280, 290,305, 315), 
                nlevels = 15,
                color.palette = topo.colors)
par(xpd = TRUE)
text(x=358890, y=515940, label="Elevation\nm")
Topographic map of Winter Tarn

Topographic map of Winter Tarn

Winter Tarn Farm appears to be higher than the overflow from Winter Tarn to the northwest, so is not at risk of being flooded by the tarn.

It would be possible to extract height for specific locations, or along transects using extract() from the raster package. Something for another day perhaps.

Posted in Uncategorized | Tagged | 3 Comments

Biased outcomes

The results of this year’s Norwegian Research Council (NFR) FRIMEDBIO call have been announced. This is an open call for proposals in medicine and biology (parallel calls exist for other subjects under the FRIPRO umbrella).

Here is a summary of the outcomes: all is not good.

Proposal type Number of proposals Successful proposals
Total Women Men Total Women Men
N % N % N %
Researcher projects 338 115 223 33 10 12 10 21 9
Young research talent 118 49 69 21 18 5 10 16 23
Mobility-stipend 22 12 10 6 27 4 33 2 20
Total 478 176 302 60 13 21 12 39 13

I’m not going to complain today about the pitifully low success rate, even for projects that are rated as very good (6) or excellent (7).

FRIPRO evaluation character

FRIPRO evaluation character. Seven is excellent.

Instead, I’m going to raise concerns about gender balance.

The researcher projects have similar success rates for men and women, but have almost twice as many male applicants.

Forty two percent of the applicants for the young research talent projects are women (already signs of the leaky pipeline), who have a success rate less than half as high as that for the men. This difference is statistically significant at the p=0.05 level.

The number of applicants and grants for the mobility stipends for people who have recently defended their PhD (funds two years postdoc research abroad, one year in Norway) are roughly equal and too small to test for any imbalance.

This news comes days after the University of Bergen (UiB) announced the results of its own scheme for excellent young researchers. It is appointing four men. I don’t know the gender balance of the applicants for these positions. I don’t care either: it does not matter. It looks as bad if the university cannot attract female applicants as it does if the university’s procedures are biased against them.

What is going on here?

The low proportion of applications for researcher projects from women probably reflects the low proportion of women in the pool of potential applicants, the result of biases occurring over decades. One might argue that the similar success rate for male and female applicants for researcher projects indicates a lack of bias. A more cynical position is that the female applicants are those that have succeeded against bias over their career because they are exceptional, and this exceptionality balances any bias against women applicants.

The bias against female applicants for both the NFR and UiB young research talent projects is alarming. These postdocs are effectively tenure-track positions: filling them with men condemns us to another generation of male-dominated academic staff, another generation of female students with few role models.

It is not immediately obvious where the bias is coming from. Here are some (overlapping) possibilities (there are certainly more):

  1. Direct, perhaps unconscious, biases by the evaluation panel against women. This is hardly implausible given the evidence of discrimination against women in academic evaluation. If this is a problem and cannot be overcome by training, perhaps NFR should consider anonymising applications, but it is difficult to remove all trace of gendered pronouns in supporting letters.
  2. The language used in the applications is gendered, and the evaluation panel prefers the language used by men. Perhaps men are better at writing the accounts needed to sell the project’s importance and their own excellence. Perhaps they use the passive voice less. It would be interesting to compare the language used (getting hold of the applications would be difficult). It would be scary if (probably small) differences in language could have such a large effect on success. I’m not going to suggest that women should be trained to write more like a man; evaluation panels should be trained to overcome gendered differences in language if they exist (and shouldn’t pay attention to bullshit anyway).
  3. Men get more support and encouragement from senior academics and so are able to write better applications. This, NFR would have no control over, but it could recognise the issue and discount it. If this is a problem, then professors need to provide assistance in a more equitable manner.

NFR has taken some steps to address gender issues, for example,  the main evaluation panel is gender balanced, but judging by this year’s outcome, more needs to be done by NFR and UiB. There probably isn’t a single factor responsible for the bias, so there probably isn’t a magic solution that will solve the problem. Acknowledging that there is a bias is the first small step to eliminating it.

Note, this post is not a case of sour grapes: my research group was awarded two grants under FRIMEDBIO this year. News on these and PhD/postdoc positions will be announced in the New Year.

Posted in Uncategorized | Tagged , , | Leave a comment

I am so close to deleting my ResearchGate profile

Yesterday, it a fit of procrastination, I updated my ResearchGate profile, adding recently published papers.

I wish I hadn’t bothered.

Today I have been deluged (and I exaggerate only slightly – OK, perhaps more than slightly) with requests for copies of one of these papers.

This paper isn’t available only in the University of Bergen library in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign on the door saying “Beware of The Leopard”.

Nor does it languish behind Elsevier’s monstrous paywalls.

It is in an open-access journal, available to read by anybody who cares to click on this link. Except that ResearchGate does not provide that link nor any other, instead it encourages readers to “request full-text” from me. Why? To encourage me to upload a copy of my paper to halt the requests. Why? I have no idea – I cannot see that it serves any useful purpose to host a copy of an open-access paper on ResearchGate.

While I am gratified that so many people are interested in reading my work, ResearchGate could have lightened the load on my email by simply linking to my paper.

Posted in Uncategorized | Tagged | 7 Comments