#!/usr/bin/env python # coding: utf-8 # Guam Coconut Rhinoceros Project Technical Report # # # Netted Panel Traps to Test if CRB are Deflected # # Aubrey Moore, Roland Quitugua and Ian Iriarte # # # ## Summary # # It has been hypothesised that CRB adults are sometimes physically deflected when arriving at panel traps. This hypthesis was tested in a field trial by wrapping alternate traps in tekken. If beetles are bouncing off traps, we would expect to see more captured in those wrapped in tekken. However, we observed no significant difference in trap capture rate. Unwrapped traps caught 0.30 beetles per trap-day, wrapped traps caught 0.26 beetles per trap-day (p = 0.56; permutation test). # # The beetles caught in traps wrapped in tekken were located as follows: # # - 34 entangled in tekken on side of net # - 31 entangled in tekken covering the cone at the top of the trap # - 8 'at large' in the receptacle at the botton of the trap # - 3 entangled in tekken covering the funnel at the top of the trap # # ## Methods # # Two transects of panel traps were established in southern Guam. Alternate traps were wrapped in tekken. Traps were visited weekly and captured beetles were counted. For traps wrapped in tekken, the location of each beetle was recorded. During each visit, traps were moved to the next station within each transect. # # ## Analysis # # Data were stored in a CSV file, 'trapCatch.csv', and analysed using the IPython notebook, 'Netted Panel Traps Experiment to See if CRB are Deflected'. # In[1]: get_ipython().run_line_magic('matplotlib', 'inline') import matplotlib.pyplot as plt import numpy as np import pandas as pd # ### Get data from CSV file # In[2]: # netted=1: panel trap wrapped in tekken # netted=0: panel trap not wrapped df = pd.DataFrame.from_csv('trapCatch.csv', parse_dates=[1]) df['trap_rate'] = df['beetles']/df['days'] df.tail() # ### Apply permutation test for significance of difference between means # # mean1 = mean daily trap rate for unwrapped panel traps
# mean2 = mean daily trap rate for panel traps wrapped in tekken # In[3]: class permtest: def __init__(self, xs, ys, ntrials=10000): """ xs an ys are numpy arrays """ self.ntrials = ntrials self.xs = xs self.ys = ys self.meanxs = np.mean(self.xs) self.meanys = np.mean(self.ys) self.diff = np.abs(self.meanxs-self.meanys) self.simdiff = [] self.estimate_p() self.plot() def estimate_p(self): n = len(self.xs) zs = np.concatenate([self.xs, self.ys]) self.simdiff = [] for j in range(self.ntrials): np.random.shuffle(zs) self.simdiff.append(np.abs(np.mean(zs[:n]) - np.mean(zs[n:]))) self.p = np.sum(self.diff < self.simdiff) / (self.ntrials*1.0) def plot(self): fig = plt.figure() ax1 = fig.add_subplot(111) ax1.hist(self.simdiff) ax1.set_ylim(0,1.1*ax1.get_ylim()[1]) ax1.vlines(self.diff, 0, ax1.get_ylim()[1], color='red', linewidth=3) s = ''' Result of permutation test with %d trials mean1 = %f mean2 = %f diff = %f p = %f ''' % (self.ntrials, self.meanxs, self.meanys, self.diff, self.p) ax1.set_title(s) ax1.set_xlabel('Absolute difference between means') # In[4]: xs = df['trap_rate'][df['netted']==0].values ys = df['trap_rate'][df['netted']==1].values mytest = permtest(xs, ys) # ### Position of beetles caught by netted panel traps # In[5]: df.drop(['days', 'netted', 'beetles', 'trap_rate'], 1).sum() # ### BibTex record for this document @unpublished {Netted-Panel-Traps, title = {Netted Panel Traps to Test if CRB are Deflected}, year = {2015}, type = {CRB Technical Report}, author = {Aubrey Moore and Roland Quitugua and Ian Iriarte} } # In[ ]: