Open hagenaue opened 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).
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:
Defeat Day will now be the Minute variable
You will need to add in SocialDefeat as a variable.
One version of the previous multilevel model analysis of social defeat behavior outputs results with the main effects centered on Day 4 ("DayCenteredOn4") of social defeat instead of Day 1. For adapting it, this will need to be changed to Min 5 to be the last minute of the open field task.
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
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
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).