Guam Coconut Rhinoceros Project Technical Report
Aubrey Moore, Roland Quitugua and Ian Iriarte
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:
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.
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'.
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# 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()
startDate | endDate | days | netted | beetles | notes | net_top | net_side | net_bottom | in_trap | trap_rate | |
---|---|---|---|---|---|---|---|---|---|---|---|
trapSite | |||||||||||
P2 | 2015-04-17 | 2015-05-24 | 7 | 1 | 3 | NaN | 1 | 1 | NaN | 1 | 0.428571 |
P3 | 2015-04-17 | 2015-05-24 | 7 | 0 | 4 | NaN | NaN | NaN | NaN | NaN | 0.571429 |
P4 | 2015-04-17 | 2015-05-24 | 7 | 1 | 1 | NaN | NaN | 1 | NaN | NaN | 0.142857 |
P5 | 2015-04-17 | 2015-05-24 | 7 | 0 | 1 | NaN | NaN | NaN | NaN | NaN | 0.142857 |
P6 | 2015-04-17 | 2015-05-24 | 7 | 1 | 7 | NaN | 6 | 1 | NaN | NaN | 1.000000 |
mean1 = mean daily trap rate for unwrapped panel traps
mean2 = mean daily trap rate for panel traps wrapped in tekken
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')
xs = df['trap_rate'][df['netted']==0].values
ys = df['trap_rate'][df['netted']==1].values
mytest = permtest(xs, ys)
df.drop(['days', 'netted', 'beetles', 'trap_rate'], 1).sum()
net_top 31 net_side 34 net_bottom 3 in_trap 8 dtype: float64