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...

Thursday, August 26, 2010

A fishless fishing trip to Senja

Sunset somewhere at the "yttersida" of Senja.
Should not write only about Svalbard all the time. So here comes something quick about my free time activities. Senja is the next island south from Kvaløya. It offers almost everything for outdoor activities all the way from climbing to hunting, fishing or diving. Last weekend we went for a fishing trip to some lakes in the mountains on the island. The trip did not offer that much fish, but great time in the nature anyhow. On the way back we stopped for a dive. Visibility was not that great, but the site is amongst the best I have been diving around here.

Mytilus (blue mussels) collected under the wharf were not poisonous after all, although you shouldn't eat those from the inner coast at this time of the year. These bivalves are filter-feeders and may accumulate algae toxins, which can contain some fairly serious stuff. The bivalves were collected close to the open ocean and the risk to get sick is fairly low. It's called exiting eating, like fugu, either you brag that you survived or then you'll die.

Mefjordbotn, one of the most spectacular nature diving sites in the area

Read more...

Wednesday, August 25, 2010

Photo of the Day - The Isle of Hope

Hopen (eng. The Isle of Hope) is one of those miserable islands surrounded by a cold ocean. During summer sunny hours on the island can be counted with fingers of one hand and the record of continuous fog is about three months. Considering these facts, we were quite lucky to see the island at all, although we spent a week anchored next to it.

Read more...

Tuesday, August 24, 2010

Photo of the Day - Great Skua


The great skua is "the predator" of Svalbard bird life. In addition to bird chicks and eggs their diet consists of adult birds, such as kittiwakes, eiders and little auks. The eagle like look is not a coincidence... 

Read more...

Wednesday, August 18, 2010

Photo of the Day - "Who's your Daddy?"

Feet of new-born bird chicks are those that grow first. This grey phalarope chick was catching small insects with its father, while the mother was keeping some distance.

Read more...

Tuesday, August 17, 2010

Photo of the Day - A Finwhale Nose

Fin whales are the second largest animals on the Earth. This individual was almost the length of our sailing boat (49 ft). It is an exiting sight when this huge animal dives under your boat. You never know where it comes up...

Read more...

Monday, August 16, 2010

Photo of the Day - Descended from Reptiles

Have you ever wondered why they say that birds are evolved from reptiles? Well, this Arctic skua has some dinosaur-look, doesn't it?

Read more...

Saturday, August 14, 2010

Photo of the Day - Almost Brave

Walruses are curious animals. If you are sitting still in a boat, they may come pretty close, but get also scared very easily. Here a group of young males (as long as I can say) is getting scared - once again - while trying to check us out.

Read more...

Friday, August 13, 2010

Photo of the Day - Black Guillemots in Mist

Black guillemots are difficult to photograph, because of their almost pure black and white plumage. Sometimes in right conditions it is possible to get the feathers visible. This one was taken in mist, while sun was shining partly through the clouds. 

Read more...

Thursday, August 12, 2010

Photo of the Day - And So It Dives...Again

Here is an other piece of evidence: polar bears are - indeed - marine mammals. There were six polar bears diving for rotten blubber. Most of the whale (probably a fin whale) was already eaten, although some blubber was left at the deepest (about 3-4 meters) parts of the whale. This dive was a success. The polar bear came up with a junk of rotten whale blubber.  

Read more...

Wednesday, August 11, 2010

Photo of the Day - Nordaustlandet

Read more...

Tuesday, August 10, 2010

Photo of the Day - Bear Posing

Getting good photos of polar bears may be tricky sometimes, since it is not actively allowed to search for them. Very often they get scared of people and following them is about the worst thing one can do. On Storøya, east of Nordaustlandet, things were different. While counting birds we counted 13 polar bears on the island. Most of the encounters were like this one. Due to our silent 4-stroke engine, the polar bears did not hear us coming while taking it easy somewhere between rocks. We on our behalf spotted them while trying to go on land to count birds. A few times we had to return back to our boat or turn back just when trying to go on land, because of curious individuals...then we were just staring and examining each other. It is difficult to tell which one, us or the bear, was more facinated about the behaviour of the other. 

Read more...

Monday, August 9, 2010

Faceshow!

 
Comment something poor in your status, add me as a friend, join into my stupid group and I'll jump out from a window, try posting most embracing photos of your friends - especially if they are in a state that they cannot remember next morning or just play a Jesus and join a cause to save the world.
 
In the modern world possibilities to lose your face on the internet are almost endless - partly thanks to Facebook.
 
Therefore this Walrus Faceshow (TM) is dedicated to the slaves of the Devils invention. You hate it, but yet you are a slave of it - you never know, if someone actually had something important to tell...this haven't happened yet, but maybe tomorrow?

 
 Try to give this your friends name. He won't like it, but can' really remove it either, because this would show bad sense of humour. Very funny trick, isn't it? 

The Drowsyhead and The Madeye - eyes red as in a bad hangover. Gaze as hateful as if he would like to eat you. Still a relaxed and funny fellow. Often looks are difficult to interpret.
 
  Surprised how personal walrus faces can look? Me too. Here I photographed six different animals. Guess who is photographed more than once...
 
Wildlife photography is a great hobby. This photography session was something I will remember for a long time. All you needed to do was to stand on the shore and whistle - they came to you. Walruses are very curious animals.
 

Read more...

Photo of the Day - Walrus Sunrise

Read more...

Sunday, August 8, 2010

Photo of the Day - Still a Long Way Somewhere?

Polar bears may be bears, but they are also counted as marine mammals. This polar bear family was waiting on land until waves calmed down during the night. They took off from Storøya towards Nordaustlandet swimming past our boat on the dead calm sea. Closest land from Storøya is at least 40 km away. Pretty impressive swimming effort from a small polar bear cub. 

Read more...

Saturday, August 7, 2010

Photo of the Day - Splash It Up...

Read more...

Friday, August 6, 2010

Photo of the Day - Dance, Skua, Dance!

Arctic skuas are protecting their nest from large predators, such as people, by acting wounded. Sometimes this acting looks like a dance...


Read more...

Thursday, August 5, 2010

Photo of the Day - The King of Sea Ice

Read more...

Back Home

I have returned from Svalbard and Arctica sailing trip. After five summers on Svalbard in a row +18 degrees, occassional sun and the summer of Tromsø feels incredibly warm and exotic. Pity that it ends within a few weeks...Maybe a summer in Tromsø next year?

However, I wrote a story during our month length sailing / bird counting trip around the whole archipelago of Svalbard. Due to the Government's and Norwegian Polar Institutes publishing policy, I have to get it approved first in the Communication Department. This probably takes some time. While waiting for green light, I'll post some wild-life photos I took during the Arctica trip.

Read more...

Wednesday, August 4, 2010

Photo of the Day - A Long Way to Hospital


Read more...

Tuesday, July 20, 2010

Photo of the Day - Svalbard

Read more...

Thursday, July 15, 2010

Photo of the Day - Eider Action

Read more...

Saturday, July 10, 2010

Photo of the Day - Billefjorden from the Air

Read more...

Monday, July 5, 2010

Photo of the Day - Mirror?

Read more...

Thursday, July 1, 2010

Photo of the Day - Selanderneset

Read more...

Tuesday, June 29, 2010

Arctica

Norwegian Polar Institute has a task to estimate the number of breeding seabirds on Svalbard. For this purpose they hire a sailing boat and a crew for counting the breeding colonies. Since there are several million of these birds, the counting can not be done over one season. Once before I have been with S/Y Arctica counting seabirds in breeding colonies on Edgeøya and the East Coast of Svalbard. The trip was one of those unforgettable field experiences in my life. This year I was lucky again and got a one month's assignment on board.  

We'll take off tomorrow and come back in the end of July. A month on the sea is a welcomed change over the busy field season in Longyearbyen. Finally the time for departure has came...I'll be hopefully back in August. With some photos, naturally.

 

Read more...

Monday, June 21, 2010

The greatest metal show on Earth

Travelling thousands of kilometers, neglecting tasks at work in middle of the most effective field season, spending thousands of kroner. Everything just to see the Big Four: Metallica, Slayer, Megadeth and Anthrax. The bands which started the act named trash metal.

This might all sound crazy, but it was easily worth it.

90 000 people had packed into an old airport in Warsaw to witness the most significant occasion in history of American heavy metal: after 25 years of squabble Metallica and Megadeth could finally fit their rather large egos on one stage. Not only that, but the bands had managed to unite all of the Big Four into one concert. "The greatest show on Earth" as James Hetfield put it. I don't know if it was that, but certainly it remains as the greatest heavy metal show I have ever seen.

There was no excuse. No work, no private reason, no cost could stop me. I just had to see it. And I am so happy that I did.

Anthrax started the show in a bright sun shine at five o'clock afternoon. Classical 80's heavy metal singer Joey Belladonna had reunited the band for this occasion. The sound was just like that. Classical. It was like Iron Maiden playing Anthrax hits (sorry for this classification, I really haven't been listening the band before. On tape they just sound different). The show was cool, though. The band was clearly impressed by the mass of people.

Medadeth, instead, was acting rather spiritless. Dunno, if it was the bright sun light (metal should be faced in pitch dark) or my rather low alcohol level (getting a beer required half an hour battle in the crowd, half a kilometer outside the stage), but they just did not find the crowd. Apart from four last songs, which were the classics such as Peace sells and Symphony of Destruction

No matter the light of darkening evening. No matter the bad beer arrangement. Crowd just went berserk when Slayer started their set. Slayer is one of those bands, you won't really get before you see their far too loud life performance. Easily the best performance during the whole exceptional day. Awesome feeling to jump, push and being pushed in the mosh pit just front of the stage.

Night had finally fallen when Metallica started their two hours show. A decade of listening to the band almost every day and I hadn't seen them before. It all was close to mass hysteria. People weren't acting rationally. There wasn't that normal taking care of the fallen. If someone fell, people almost crushed them to death. Everyone wanted their share of the most popular metal band in the history. However, hearing them live was an unforgettable moment. The professionalism that band has is just above any other. They just know how to make people crazy. Two hours felt like two minutes. I have never seen anything like the video technique and pyrotechnics Metallica used.

Read more...

Tuesday, June 15, 2010

Photo of the Day - Black legged kittiwake

Read more...

Monday, June 14, 2010

Photo of the Day - Cold Eyed Bird Watching

Norwegian Polar Institute mounts cameras around the island. These cameras are taking photos of certain bird colonies around the archipelago in order to monitor reproduction and population variations between years. This one was mounted on a bird colony in Nordaustlandet.  

Read more...

Sunday, June 13, 2010

Photo of the Day - Pyramiden

Believe it or not - the old Russian mining town Pyramiden - is the most beautiful settlement on the island. Russian mining activities have left long lasting traces on the mountain.

Read more...

Saturday, June 12, 2010

Photo of the Day - Nest building

Read more...

Thursday, June 10, 2010

Photo of the Day - Restless times

Spring, prior to incubating, is a restless time for the geese. First a long flight to Svalbard following "the Green Wave" that travels slowly towards the North when snow melts. There is only couple of weeks time to recover before the geese have to lay their eggs. In order to recover, grow eggs and prepare for a long starvation during incubation one has to eat as much as possible. During this time life is a constant fight over those few plants that are green in early June. Packs of barnacle geese tend to dominate over pink-footed geese that are larger in size, but often moving in pairs. The cock in barnacle pack seems to get the most juicy bites.  

 Losers have to bend their neck and look for food somewhere else. 

Read more...

Monday, May 31, 2010

Polar bear in the town

A visit of a polar bear in Longyearbyen is not an every day event, but not unheard of either. First clear indicators of a polar bear visit are the people, who are running around with their cameras, laughing and smiling exaltedly – like small children in the Christmas Eve – erecting tripods for spotting scopes and cameras or behaving hysterically in other ways. 

This week it happened. Some sea ice from the South had drifted into the fjord. Seeing the ice coming night before, I was not that surprised to see people running around following behavioural characteristics described above. Clearly, there was a polar bear around. Polar bear watching took place for the whole Friday. People giggling, whispering and running for the whole day just a few steps from my office. Sometimes it is just more interesting to observe the behaviour of the people, when they see an animal, than the behaviour of the animal itself…

That necessary polar bear photo. “It’s there, it’s there! Can’t you see that yellow dot?!”. As tourist quality as ever possible… 

People watching the yellow dot somewhere on sea ice.

Read more...

Svalbard rock ptarmigans

Not a summer without birds. This time I got an opportunity to take photos of Svalbard rock ptarmigan (lat. Lagopus muta, nor. fjellrype, fin. kiiruna) couple. They were more interested in pecking seeds and probably fairly excited about the idea of having sex that they forgot to pay attention to us. We could lay still and observe their pecking almost for half an hour only a few meters away. An unforgettable experience!

Read more...

Saturday, May 22, 2010

The first weeks in Longyearbeyn

Svalbard is a place for winter. During the summer landscape feels paranormal. Like the archipelago was waiting for the winter to start again. Unfortunately I haven't had the opportunity to visit Svalbard during winter very much lately. Misfortune with science became a fortune with private life the weekend after my arrival.

When I arrived Longyearbyen, I came in the middle of winter. There was ice in the fjord. About -10 degrees and typical Svalbard winter wind was blowing fiercely through my clothing. Dusty fine snow was forming clouds, whose tingled freshly on my face. Sea-ice had brought the polar bears and three of them had been seen in the town just a day before my arrival. 

Since everything was delayed, we had a change to go for a combined snow scooter and skiing trip to a UNIS staff cabin. Skiing with over-long fjell-ski and size 47 boots was not that enjoyable, but the trip reminded me, why I had once years ago, called home this cold Arctic island. Summers I spent on Svalbard were generally just filled with work. The hectic fuzziness was enough to kill the longing I once felt towards the archipelago. 

Winter went on for two more weeks. Those weeks I spent in a lab working for no results. Our experiments failed due to problems with logistics and finally to the fact that clams we were trying to spawn had done it already. This winter was warmer than the last one. Difference was enough to cause the clam populations to spawn a couple of weeks earlier than last year.

Melting season started some weeks ago. Now it is impossible to go anywhere without braving the thundering rivers. I am desperately trying to find someone, who could dive with me to collect samples. At the same time, I do some pilot experiments in the lab. Ideas are many, but making them to work seems like a difficult task. Right now it's a wrong time to give up... 

Read more...