hagenaue / bHRbLR_Enrichment_Stress_BehaviorAndHormoneData

Code used for the analysis of behavioral and hormonal data within the publication "Adolescent environmental enrichment induces social resilience and alters neural gene expression in a selectively bred rodent model with anxious phenotype" by O'Connor, Hagenauer, et al.
1 stars 0 forks source link

Analyze open field data as time series? #17

Open hagenaue opened 3 years ago

hagenaue commented 3 years ago

We currently have the open field variables (% time in center, distance traveled) treated as a single summary value for each animal (the average or sum across minutes 2-5), but there is actually some interesting time series structure in the data that might be worth analyzing using formal inferential statistics (multilevel modeling vs. just graphing).

hagenaue commented 3 years ago

I will need to dig out the data frame that contains the full time series for the open field data as well as the code that I used earlier to make the spaghetti plots (time series plots).

hagenaue commented 3 years ago

I uploaded the code files that I had previously adapted to plot the open field data (distance, time in center) as a time series of five 1-minute time bins: ForOF_01_ReadingInData.R ForOF_02_TransformingData.R ForOF_03_ReformattingTimeSeriesForModeling.R ForOF_055s_TimeSeriesPlots_Prettier_OF.R

These adapted code files use this version of the dataset: ForOF_HRLR_EE_Stress_AllBehavData_forR_withNewCORTOxytIL6_SI_OFSDScoresFixed_FixedFormatIDs_TimeOnTopforFullBehavior2.csv (although the dataset isn't called "ForOF..." in the code - I added "ForOF_..." to the front of the dataset name to make it easier to identify it on Github)

Multilevel modeling code still needs to be written to analyze the treatment effects in the time series data. To do that, you can adapt this multilevel modeling code: 08_Stats_TimeSeriesData.R

To Adapt:

Here is the code that I used to recenter Day - you can adapt it for recentering Min: DefeatDays_LongVersion$Day_CenteredOn4<-DefeatDays_LongVersion$Day-3

hagenaue commented 3 years ago

Add trend lines to represent the average intercept and slope for each treatment group to each subpanel.

Code files to steal code from:

Making matrices of time series data and calculating intercept and slope for each subject: https://github.com/hagenaue/Angela_HRLR_StressEnrichData/blob/master/04_TimeSeries_InterceptSlope.Rf

Making time series plots ("spaghetti plots") that include intercept and slope for each subject: https://github.com/hagenaue/Angela_HRLR_StressEnrichData/blob/master/05s_TimeSeriesPlots_Prettier.R