Tuesday, November 1, 2016

Moving blog

Moving blog and will be better updated
damiepak.wordpress.com

Saturday, August 13, 2016

ESA 2016 Powerpoint

What I presented at ESA 2016.
Very preliminary stuff and 100% somethings will be changed and such.

Sunday, August 7, 2016

ESA 2016


Ugh I suck at updating my blog.
I swear by god I will start updating frequently.
My dad was discussing that I should keep this as a log of what I did everyday.

AT ESA, at Fort Lauderdale.

Woot.
Woot.

Too hot though


Wednesday, March 30, 2016

Well I can't believe it.


I was awarded the NSF GRFP fellowship.
I'm more relieved that I don't have to reapply for it again.

Honestly, looking at the reviews- I think it was sheer luck. My research proposal was about looking at how temperature can affect development rate and the consequences it could have on multitrophic systems. My first reviewer seem to have a background in this as he gave a specific research advice on this proposal. I have a hunch that all these people work with insects.

I have no advice to give because what worked for me will not work for everyone, but I have to say that getting a bunch of non-STEM people to read my personal statement was helpful. I went to the writing center every week to get my statement critiqued.

Now time to get back to work.




Saturday, February 27, 2016

New stuff is incoming I promise- but first: I would love this as a poster.


Looking at synchronizing behavior of three species (Codling Moth, Tufted Apple Bud Moth, an the Obliquebanded leafroller). All bivoltine species.

Using T. Keitt- mvcwt package we can do multivariable wavelet transformation.

Red = synchronizing behavior.
Blue = compensatory behavior

Interspecific dynamics can vary across scale.

Still working on this.
But dang, what a piece of beauty.

Tuesday, February 9, 2016

Nonlinear Physiological Time Scale

Insects do not really have a concept of time. Insect development (and really most metabolic functions) is based on temperature. This is one reason why many entomology papers do not utilise  standard Julian dates. Instead, entomologists use  physiological time scales which take into account that temperature drives insect development. Most people use the standard cumulative degree days (another blog post) , but in the "Generation Separation in Simple Structured Life Cycles: Models and 48 Years of Field Data on a Tea Tortrix Moth" (Yamanaka et al. 2012), the authors decided to use a logistic development-rate function because it approaches a "finite level at high temperatures" and "approaches 0 smoothly at low temperatures".

The equations are as follow: (Please read the paper as it gives a better explanation)




"The new physiologicla timescale is calculated by integrating the stage-independent base function"

Read Appendix A as it gives a nice guide on creating a physiological time scale. I just need data on how development rate is affected by temperature!

So case guide for the coddling moth: Luckily there is a group who already found out what the development rate of the coddling moth (Cydia pomonella) is at different temperatures! 


Temperature-Dependent Development and Temperature Thresholds of Codling Moth (Lepidoptera: Tortricidae) in Iran (Aghdam et al. 2009) 

I put it into a nice excel file: 

The mean development rate is simply 1/days that Aghdam and his colleagues provided. 
The first thing to do is fit the equation (1) to the data I have above (Four stages: egg-to-pupa (total) , egg-to-larva, larva-to-pupa, pupa-to-adult). I graph the four stages to see what they look like, 

(Left to Right: Egg-to-pupa, egg-to-larva, larva-to-pupa, pupa-to-adult, different scale on the y-axis)

My adviser suggested that I cut out the last temperature (33C) because there might be a chance that insects do not have lower development rate at higher temperatures. Higher temperature could bring about higher physiological stress killing the samples and thus skewing the results. 

So I took out the developmental data based on 33C out (the sixth entree).
\
So eyeballing the graph, it seems that half the asymtoptic value is reached at around 22C. I also decided to use the parameters given by Yamanaka as starting points for parameter estimation. I will be using the nls function (nonlinear least-squares estimates) to estimate the three parameters, alpha, gamma, and h). I'm assuming that gamma and h will be similar through all the stages and that alpha is the only one that will be drastically changed as it is a scaling parametric.

Note that if you do not choose a good starting point, nls throws a big hissy fit. 


So basically put in your Y and your equation. Y will be the vector containing the mean.dev. 


So I got some estimates of the parameters. 


Then we will fit a line (red)  to our original data points 

And we can do this for the three other stages.

So playing soft-sciences, I decide to just estimate my gamma to be about .22 and my h to be at around 22C.  Now to need to add the temperature data.

Now this part is the investigation part. If this is fieldwork or benchwork you will have the daily temperature at your site of work (Hopefully!) . For me, I can only find the temperature for a place three hours from where the coddling moth was found. This is only for the sake of practice and when it comes to actual work, we will use more accurate temperatures.
But my temperature data frame should be set up like this.


Just the dates, average temperature in Fahrenheit (unimportant) and average temperature in Celsius.
Now we just need to put the daily temperature (C)  into our g(t) equation (2). We have h and we have gamma already!

Simple function is below.



So similar to the first equation except we excluded the scaling factor.
The g.t function takes the average temperature daily in Celsius.

Now I created a new data frame with the Julian dates, the g(t), but remember that the physiological time scale is the integral of g(t) from 0 to the end date. So I simply use cumsum.
I fancied up my new data frame with new column names


Now I have the physiological time scale and I have the observations to put in!
I have the coddling moth data that shows the number of coddling moth (phermone traps) caught weekly/biweekly. I averaged the abundance across all sites. 




This is what my coddling moth look like, I just have the Julian dates and the mean observations. 

Now I just have to say "Hey R, looking at my coddling moth data... If the dates matches up with the dates in my phi-scale data.frame, I want you to add the observation data to that date.. Also get rid of any rows where the observed number of moth is NA (In other words, get rid of rows where there is no observed number of moths)"

Two functions- merge and na.omit



 Ta-Da!


This makes sense, I would not expect to see any moths before April in Pennsylvania (It's snowing basically!) 

So now we have the Julian Dates, Physiological Time scale, and the Observations.

For my own data, i removed the first three months! and this is my ggplot




I will try to upload a cleaned up R-Code
Next time: Smoothing out the time series so you can resample data-points 

Monday, January 4, 2016

Little R Code for quantitative dissimilarity coefficients (Legendre et al. 2015)

Really interesting paper by Pierre Legendre and co-authors- Thirty-year recovery of mollusc communities after nuclear experimentations on Fangataufa atoll (Tuamotu, French Polynesia. Great paper for the community ecologists. Friend is trying to do a similar thing with the before-after analysis. The authors provide a how-to guide to answer this question of the paper: "We analysed the survey data (electronic supplementary material, appendix S1) to answer the following question: after the nuclear tests, were the assemblages generated during primary succession similar to those found before the tests?" Legendre provided his own code on his website , and I modified the code for my own work. All credit goes to Legendre.