Insect Counter

Necrophilous Beetles

Hello world! For my research on scavenging guilds in the Australian Alps, I tallied nearly 30,000 insects. To do so, I made a quick web-based tool that I could quickly tally what I found. Its easy to use including features to copy the tally in a table format to paste into MS Excel.

I know this is a tool taylored specifically for my project, but I think its functionality can be applied for others out there.

Project Map

Experimental Transect

Hello world!

I’d like to share some maps I’ve made of my master’s project. I’ve conducted an ecological project looking at scavenging dynamics in the Australian Alps, specifically in Kosciuszko National Park in New South Wales. The maps show the Australian Alps (the highest region in mainland Australia) and my autumn replicate transect. The transect runs along Island Bend Fire Trail and Guthega road. Each site is roughly 1km distance from each other with treatments approximately 50m from one another.

Each site consists of three treatments 1) Open / No Exclusion, 2) Vertebrate Exclusion, and 3) Vertebrate + Insect Exclusion.

These maps were produced with QGIS version 3.2+.

Permutation Pyramid

OK so here’s an update to the permutation pyramid I made.

I had to make a list of different permutations of models but it became hard to keep track of all the different variables and their combinations. Hence, the permutation pyramid. The goal is to make a list of vector combinations and permutations. I found this super useful when generating formulas for AICc/Model selection.

Enjoy!

The function has a few options:

  1. vec
    • The vector to draw the combinations/permutations from
  2. order.matters = FALSE
    • A simple boolean TRUE / FALSE to add in the permutations of each vector combination. This will generate permutations of the combinations and add them to the list. This may only be useful for certain models
  3. req
    • A vector of elements that should be required in the combinations.
  4. interact
    • A list of vector combinations that can be found in the original combinations

Function

pyramid <- function( vec, order.matters = FALSE, req, interact ){
  # pyramid of variable combinations
  # this doesn't include different
  # arrangements
  vrz <- lapply(
    1:length( vec ), 
    function( x ){ 
      combn( vec, x ) %>% as.data.frame()
    } 
  ) %>% purrr::flatten() %>% unname()
  
  # If there are interactions
  if( !missing( interact ) ){
    # possible interaction combos
    intx <- seq( from = 1, to = length( interact ), by = 1 ) %>% knp.perm.pyramid()
    
    # extra interactions
    vrz.int <- list()
    
    # look through vars
    for( v in vrz ){
      
      # make a list of interactions
      # and add them to the list
      vrz.int <- append( 
        vrz.int, 
        lapply( intx, function( ints ){
          # count number of matches to compare
          # and filter out unaltered var lists
          mt <- 0
          
          # for each interaction
          # check if its in the array
          # then add it if it is
          for ( int in ints ) {
            if( 
                length( intersect( v, interact[[ int ]] ) ) == length( interact[[ int ]] ) & 
                length( interact[[ int ]] ) > 1 
              ){
                v <- c( v, paste0( interact[[ int ]], collapse = ":" ) )
                mt <- mt + 1
            }
          }
          
          # if the number of matches equals
          # the number of interactions then
          # return the altered array
          if( mt == length(ints) ){
            return( v )
          }
          return( NULL )
          
        }) %>% plyr::compact()
      )
    }
    
    # append interactions
    vrz <- append( vrz, vrz.int )
  }
  
  # order matters so lets rearrange
  if( order.matters ){
    vrz <- lapply( vrz, function( x ){
      combinat::permn( x )
    }) %>% purrr::flatten()
  }
  
  # if there's any required variables in each combination
  if( !missing( req ) ){
    vrz <- lapply(vrz, function( x ){
      if( length( intersect( x, req ) ) == length( req ) ){
        return( x )
      }
      return( NULL )
    }) %>% plyr::compact()
  }
  
  # return list of character
  # permutations
  return( vrz )
}

Examples / Usage

Plain vanilla use

> a <- c( "A", "B", "C" )
> pyramid( a )
[[1]]
[1] "A"

[[2]]
[1] "B"

[[3]]
[1] "C"

[[4]]
[1] "A" "B"

[[5]]
[1] "A" "C"

[[6]]
[1] "B" "C"

[[7]]
[1] "A" "B" "C"

If the order of the elements matters

> a <- c( "A", "B", "C" )
> pyramid( a, order.matters = TRUE )
[[1]]
[1] "A"

[[2]]
[1] "B"

[[3]]
[1] "C"

[[4]]
[1] "A" "B"

[[5]]
[1] "B" "A"

[[6]]
[1] "A" "C"

[[7]]
[1] "C" "A"

[[8]]
[1] "B" "C"

[[9]]
[1] "C" "B"

[[10]]
[1] "A" "B" "C"

[[11]]
[1] "A" "C" "B"

[[12]]
[1] "C" "A" "B"

[[13]]
[1] "C" "B" "A"

[[14]]
[1] "B" "C" "A"

[[15]]
[1] "B" "A" "C"

Require variables

> a <- c( "A", "B", "C", "D", "E" )
> b <- c( "B", "D" )
> pyramid( a, req = b )
[[1]]
[1] "B" "D"

[[2]]
[1] "A" "B" "D"

[[3]]
[1] "B" "C" "D"

[[4]]
[1] "B" "D" "E"

[[5]]
[1] "A" "B" "C" "D"

[[6]]
[1] "A" "B" "D" "E"

[[7]]
[1] "B" "C" "D" "E"

[[8]]
[1] "A" "B" "C" "D" "E"

Include interactions

> a <- c( "A", "B", "C")
> b <- list( c( "A", "B" ), c( "A", "B", "C" ) )
> pyramid( a, interact = b )
[[1]]
[1] "A"

[[2]]
[1] "B"

[[3]]
[1] "C"

[[4]]
[1] "A" "B"

[[5]]
[1] "A" "C"

[[6]]
[1] "B" "C"

[[7]]
[1] "A" "B" "C"

[[8]]
[1] "A"   "B"   "A:B"

[[9]]
[1] "A"   "B"   "C"   "A:B"

[[10]]
[1] "A"     "B"     "C"     "A:B:C"

[[11]]
[1] "A"     "B"     "C"     "A:B"   "A:B:C"

Confidence Intervals

A small little function written in R to get the 95% confidence intervals and some quick stats of a vector. I found this useful in error reporting in some stats. I got the concept from this tutorial.

This does require the dplyr library

Function

library( dplyr )

ci <- function( x ){
  cnf <- dplyr::tibble(
    mean = mean( x, na.rm = TRUE),
    st.dev = sd( x, na.rm = TRUE),
    n = length( x ),
    error = qnorm( 0.975 ) * st.dev / sqrt( n ),
    ci05 = mean - error,
    ci95 = mean + error
  )
  
  cat( cnf$mean, "(", cnf$ci05, "-", cnf$ci95, ")\n" )
  return( cnf )
}

Use

> x <- sample(10)
> ci(x)
5.5 ( 3.623477 - 7.376523 )
# A tibble: 1 x 6
   mean st.dev     n error  ci05  ci95
  <dbl>  <dbl> <int> <dbl> <dbl> <dbl>
1   5.5   3.03    10  1.88  3.62  7.38

Weekend at Wolgan

Wolgan Valley

It was a lovely day at Wolgan Valley in the Blue Mountains seeing some site setups for my upcoming research in Kosciusko NP. Got lucky with this display from an Eastern Bearded Dragon

Outback Science

Sunset from Ethabuka

I recently went on a trip with the Desert Ecology Research Group to their Ethabuka site to assist in some field studies. I got to say this was an amazing experience driving out into the loneliness of the Outback.

Desert ecologists guided by Dr Chris Dickman

It’s really been a great exhibition of different land and livestock management. People out here own HUGE amounts of land measured in the hundreds of thousands of hectares and outlined by their fencing. Each barrier creates an ecological experiment and window into the risks of poor management choices. It becomes quite obvious who is treating their land well with an eye towards sustainable agriculture and who would prefer to liquidate any sort of productivity as they graze their land into oblivion. Even out in a place where as little as 30ml of rain and an average low temperature of 30C the landscape was never meant to be completely barren.

In places where the cattle are restricted or not at all there are beautiful slow growing gidgee tree and spinifex which play host to countless diversity of reptiles, amphibians, mammals, and birds. It’s hard to imagine that such an intensely harsh environment is jam-packed with life.

Life in the outback is just different than what we know as a western culture. We have been conditioned to be able to do anything when and where we want without consequences but life here operates as a powerful reactive force; the boom and bust cycle. Life out here knows that it must wait until times are good to flourish. Desert amphibians are just one superb example of this hibernating beneath the sand dunes for years until the slightest bit of rain awakens them. On any other day of the year you would never expect the sun-scorched dunes to be covered in so much semi-aquatic life.

But unfortunately the outback is under attack by misguided agricultural practices. Huge areas of land have all but been annihilated due to intense overgrazing, their surface more resembling the barren deserts of Mars than our own world. Farmers leave their cattle on these decimated landscapes for years propped up by artificial watering holes with the business model of: “the rain will save me next year”. But in arid-Australia that’s not how life works and agricultural land is steadily losing all it’s productivity

There is hope though and it comes from bringing an ecological prospective into the agricultural industry. Like a thought that’s been pushed to the back of your mind everyone knows it but refuses to acknowledge it; who knew that treating your land well is better for your future and your profits. Slowly but surely some livestock owners are adopting ecologically minded practices and reaping the benefits of them.

Angus Emmott is among them as a beef farmer who has decided to not shoot and poison bait Dingos and as a result receives less grazing competition from kangaroos. This benefit is very apparent as evidenced by his greater vegetative productivity. This free ecosystem service this top carnivore provides creates a landscape of fear in the kangaroos and some cattle moving them more in the pastures and relieving grazing pressure on plants. This agrigated precious time regained by the foliage allows more nutrients to stay in the topsoil which in turn allows for more plants. More Dingos leads to more plants leads to more food for animals.

Greater productivity in the outback can also be seen in lands that have been allowed to rest between flooding events. Absent of people, outback fauna are largely scarce until large booms of green-up brought on by chance rains. Animals out here have learned to utilize the good times and become scarce in the bad. So why do livestock owners leave their animals out in the harsh landscape in times of drought? Most operations appear to make a profit when it rains. Wouldn’t they favor letting the land rest and allow for greater vegetative build-up so they can have more profits more often?

So maybe the future of an agricultural outback needs the support of natural patterns to thrive. Understanding these boom and bust cycles is essential to insure a healthy Outback for nature and livestock. The alternative of relentless grazing pressure is far worse than letting it recover. No one wants to see these farmers graze themselves and their communities to oblivion which is what is currently happening.

This isn’t anyone’s particular fault though and a lot of why things are hard to change are because state and federal rules regarding agriculture have not been given any incentive to change. From a country commerce level the difference of managing your land responsibly vs utter destruction is purely on the output of livestock. There is no widely accepted way to quantify the resilience and the sustainably these animals come from and what matters more to the future of the industry. This is where governmental power can really shine and where foresight can make so many lives that much better. Unfortunately for Australia no political official in recent history on the state or federal level has stepped up to challenge this blight of poor agricultural policy and has instead opted for the cowardice of inaction. As a nation the position is open for someone to be brave and act accordingly with the science and the small farm communities to incentivize sustainable practices. We know they work so why not make them more effective.

There are ways to responsibly use some Outback that allows for some grazing without the annihilation of icon desert species. This might take:

  1. Allow for the recovery of Dingos and wild dogs (ecologically they do the same thing) and prevent further baiting programs. Carnivores manage grazers and land better than people can.
  2. Reduce some grazing pressure in times of drought. Vegetation begets vegetation.
  3. Government incentives need to change from anti-carnivore productivity liquidation to policies that reflect how ecology works. Compensate farmers on their losses not encourage them to burn up the tool which they use to live.

Right now some of these farms run a deficit each year there is no rain but it’s too expensive to change their current operation. Farmers may be locked into a certain way of doing things on land that continually declines until it becomes entirely unusable. No one wants to see these economic hardships so that’s why it is imperative we change and reinforce sustainable practices so we can thrive into the future.

Nature and people can live together and we want to work with each other do do so. It just takes the trust that changing to an eco-friendly is a better option.

The comfort of a familiar dirt track. Home sweet home

Coral Timelapse

2 minute videos of damselfish on corals at One Tree Island in the southern portion of the Great Barrier Reef. Videos are 20x normal speed

I’ve compiled our data we collected at One Tree Island into this video and sped it up. Its kind of mesmerising watching the schools of fish dart in, out, and between the corals.

Science question: Do the Whitetail dascyllus (humbug damselfish) prefer acropra sp. or isopora sp. and can it be quantified?