Sunday, April 3, 2011

Photo of the Day - Black-Winged Stilt


Read more...

Thursday, March 3, 2011

Photo of the Day - In a Fish Bowl


Read more...

Wednesday, November 3, 2010

R tips - How to calculate diet indices from time-series data?

Ok, since I am supposed to write also about my work here, I'll start a new series called "R tips". R is an open source statistical program useful especially for nature scientists. This might be very nerdy and useless "shait" for the most, but I hope that some lucky Googlers find these tips useful. At least I have found this kind of blog entries very helpful when doing my work.

Lately I have been working with a seabird diet time-series. I have learned that there are tens of different indices that can be used to describe the dataset. Best fitting index has to be chosen individually depending on the questions and data. Swanson & Krapu (1974) made a review of the issue. Here I am going to demonstrate how to calculate "frequency of occurrence", "aggregate mass", "aggregate percentage" and mean mass for a time-series.

Shortly, frequency of occurrence tells how frequently a diet item occurs in the dataset. The aggregate mass tells the percentage for a diet item of summed total volume of all samples. Finally, the mean of mass percentages, or aggregate percentage, tells the average over the dataset of how many percentages a diet item constitutes of a stomach sample. This is much better explained in Swanson & Krapu 1974.

There are of course thousands of ways to do this, but simplest I have found so far is by using "reshape" package. Here is the R code:

#Assume a dataset where "a", "b" and "c" are diet items, "x1", "x2" ... are diet samples from individual birds and "y1" and "y2" are different years. Values for diet items are given in grams:

a <- c(1, 1, 2, 0, 3, 0, 5, 6, 1, 2)
b <- c(2, 1, 3, 2, 5, 2, 3, 5, 1, 0)
c <- c(0, 0, 1, 2, 4, 0, 20, 0, 0, 0)
year <- c(rep("y1", 5), rep("y2", 5))
bird <- paste(rep("x", 10), seq(1,10,1), sep="")

data <- cbind.data.frame(bird, year, a, b, c)

library(reshape)  # start the reshape package

data$total.mass <- rowSums(data[3:5]) # create total.mass column for later use
melt.data <- melt(data, id=1:2, measured=3:6) # melt the data so that we can cast it in desired format

# start from easiest, mean mass and standard deviation.

t(cast(melt.data, formula = year ~ variable, mean)) #Transposing t() because it is better to list diet items as rows when there are a lot of prey items
t(cast(melt.data, formula = year ~ variable, sd))

# aggregate mass needs column sum and total mass for each year

mass.sum <- cast(melt.data, formula = year ~ variable, sum)
aggregate.mass <- (mass.sum[2:5]/mass.sum$total.mass)*100

#if you want to print the dataframe, you can do following:

rownames(aggregate.mass) <- levels(mass.sum$year)
print(t(aggregate.mass), digits = 1)

#aggregate percentage

data.per <- cbind.data.frame(data[1:2], (data[3:6]/data$total.mass)*100) # calculate how big percentage each diet item consitutes in each sample
data.per <- data.per[-6] # drop off useless total.mass column
melt.data.per <- melt(data.per, id=1:2, measured=3:5)
aggregate.percentage <- cast(melt.data.per, formula = year ~ variable, mean)

#frequency of occurrence

data.na <- data
data.na[data.na==0] <- NA
melt.data.na <- melt(data.na, id=1:2, measured=3:6, na.rm = T)
occur <- cast(melt.data.na, formula = year ~ variable, length)
t(cbind.data.frame(occur[2:4]/occur$total.mass, row.names = levels(occur$year)))

#comparison between aggregate percentage and aggregate mass

rownames(aggregate.percentage) <- levels(aggregate.percentage$year)
aggregate.percentage <- aggregate.percentage[-1]
aggregate.mass <- aggregate.mass[-4]

aggregate.percentage-aggregate.mass

# differences are mainly because of 20 grams of item c in bird x7. The aggregate volume method gives equal weight to each unit of food consumed by any bird while the aggregate percent method gives equal weight in the analysis to each bird as Swanson & Krapu (1974) says.

Please tell, if there are mistakes in scripts.

References

Swanson, G. A., G. L. Krapu, et al. (1974). "Advantages in Mathematically Weighting Waterfowl Food-Habits Data." Journal of Wildlife Management 38(2): 302-307.

Read more...

Friday, September 24, 2010

Photos from the field season 2010



All my albums in Picasa are finally updated with fresh photos from field season 2010. You can check them out here.

Read more...

Thursday, September 23, 2010

Forskningsdagene


Forskningsdagene is a popular scientific event arranged once a year in Norway. The idea is that institutions are presenting their research for interested public. I think this is a great idea, since the public is often funding our research. Only problem with the event is that the "big names" are not having time to talk to the mortals. The task is often given for younger people. Well, on the other hand it's great fun for us and maybe we are as able to show scallops for kids as any experienced researcher...

This was my second year with Forskningsdagene. My input for popular science this year was to take part for a cruise to Senjahopen with the University's research vessel Johan Ruud. This was also my first time, and probably the last for a long time, as a cruise leader. We went to show marine organisms for school kids on Senja. The science was not that interesting after all, but they found it incredibly entertaining when a sea cucumber was "pissing" on their pants...
Tomorrow we will anchor the boat to the harbour by Stortorget. The show starts at 11 o'clock. Come to check out where the sea cucumber pisses...

Read more...

Wednesday, September 22, 2010

No Health-Care for a Beaten Bird

In nature unexpected events follow each other. Many times observing nature is possible only, when you manage to forget observing yourself. Patience is the number one gift of a nature observer.
Guillemots seem to be a bird-world equivalent to people from India. The huge density of breeding colonies forces the birds to give an impression of compliant sitting next to each other, but real life in the colonies is often unlike the impression. Fights do occur. Fighting starts with slight pecking and sometimes develops into a serious attempt of murder. Most serious matches are solved in the air and finally end up into the ocean, where the weaker party is trying to escape by diving, flying, swimming and splashing from the murderous rage of the strong.
Sometimes Brünnich’s guillemots are bleeding after fighting, but I have never before seen any serious damage due to these fights. When counting birds in vicinity of tens of thousands of guillemots, probability of seeing rare occasions is higher. This combatant lost his fight and came to look for refuge from us, while swarming glaucous gulls were waiting to attack the beaten bird. There was not much we could do, except for taking photos. Finally we had to leave and the bird ended up as a meal for the hungry glaucous gulls. To live is to die. 

Read more...

Friday, August 27, 2010

A Bivalve Challenge



Some words about my work this time. As said, I am working with marine bivalves. The first and foremost challenge in the PhD student life, compared to my former jobs, is the freedom. Ok, I have supervisors, who are trying to keep me on the right path, but still there are so many ways to go. Asking me "what are you exactly working with?" is a bad idea. I hardly know it myself. Projects are numerous. Maybe some of them gives results in the end.
Lisää kuvateksti

Right now I am trying to find out the most effective ways to take samples. Since I need quantitative (=sampled area of seafloor is known) samples for bivalve population study, I have been experimenting with an under-water suction pump. Playing with the pump is turning out to a success and I even got my first useful sample. With the sample became another challenge: which species are these guys? Unlike with crustaceans, there is no really descriptive literature on mollusc shells. One just have to ask around and look for photos on the internet and in old books.


Lisää kuvateksti
In addition I am writing a funding application to study growth band formation in bivalve shells. These growth bands can be used as archives to study past climate and the variability of conditions between sites. First we have to find out in what kind of conditions various elements and isotopes are deposited into the shells...
Lisää kuvateksti

Read more...