Skip to content

Commit bee76ed

Browse files
committed
small teaks to the time dep reg bit, added it to the materials page
1 parent 012ef44 commit bee76ed

10 files changed

Lines changed: 314 additions & 228 deletions

docs/materials.html

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ <h2 id="toc-title">On This Page</h2>
149149
<li><a href="#simple-tpc-fitting-pipeline-using-nlls" id="toc-simple-tpc-fitting-pipeline-using-nlls" class="nav-link" data-scroll-target="#simple-tpc-fitting-pipeline-using-nlls">Simple TPC fitting pipeline using NLLS</a></li>
150150
<li><a href="#introduction-to-the-vecdyn-database" id="toc-introduction-to-the-vecdyn-database" class="nav-link" data-scroll-target="#introduction-to-the-vecdyn-database">Introduction to the VecDyn database</a></li>
151151
<li><a href="#environmental-covariates-for-time-and-space-dependent-data" id="toc-environmental-covariates-for-time-and-space-dependent-data" class="nav-link" data-scroll-target="#environmental-covariates-for-time-and-space-dependent-data">Environmental covariates for time and space dependent data</a></li>
152-
<li><a href="#introduction-to-time-dependent-data" id="toc-introduction-to-time-dependent-data" class="nav-link" data-scroll-target="#introduction-to-time-dependent-data">Introduction to Time Dependent Data</a></li>
153-
<li><a href="#simple-time-dependent-data-pipeline" id="toc-simple-time-dependent-data-pipeline" class="nav-link" data-scroll-target="#simple-time-dependent-data-pipeline">Simple Time-dependent data pipeline</a></li>
152+
<li><a href="#introduction-to-time-dependent-data-and-reproducible-data-pipelines" id="toc-introduction-to-time-dependent-data-and-reproducible-data-pipelines" class="nav-link" data-scroll-target="#introduction-to-time-dependent-data-and-reproducible-data-pipelines">Introduction to Time Dependent Data and reproducible data pipelines</a></li>
154153
</ul></li>
155154
</ul>
156155
</nav>
@@ -282,17 +281,12 @@ <h3 class="anchored" data-anchor-id="environmental-covariates-for-time-and-space
282281
</ul>
283282
<p><br></p>
284283
</section>
285-
<section id="introduction-to-time-dependent-data" class="level3">
286-
<h3 class="anchored" data-anchor-id="introduction-to-time-dependent-data">Introduction to Time Dependent Data</h3>
284+
<section id="introduction-to-time-dependent-data-and-reproducible-data-pipelines" class="level3">
285+
<h3 class="anchored" data-anchor-id="introduction-to-time-dependent-data-and-reproducible-data-pipelines">Introduction to Time Dependent Data and reproducible data pipelines</h3>
287286
<ul>
288-
<li><a href="">Coming Soon!</a></li>
289-
</ul>
290-
<p><br></p>
291-
</section>
292-
<section id="simple-time-dependent-data-pipeline" class="level3">
293-
<h3 class="anchored" data-anchor-id="simple-time-dependent-data-pipeline">Simple Time-dependent data pipeline</h3>
294-
<ul>
295-
<li><a href="">Coming Soon!</a></li>
287+
<li><a href="./vectorByte2026_timedepRegression.html">Practical</a></li>
288+
<li><a href="./reproducibleReport.html">Example reproducible report</a></li>
289+
<li><a href="https://github.com/VectorByteOrg/vectorbyte-training2026">Git repository</a></li>
296290
</ul>
297291
<p><br></p>
298292

docs/search.json

Lines changed: 271 additions & 187 deletions
Large diffs are not rendered by default.

docs/vectorByte2026_NLLS.html

Lines changed: 8 additions & 8 deletions
Large diffs are not rendered by default.
-665 Bytes
Loading
1.13 KB
Loading
545 Bytes
Loading
41 Bytes
Loading

materials.qmd

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,11 @@ We are assuming familiarity with `R` basics as well as at least introductory sta
111111

112112
<br>
113113

114-
### Introduction to Time Dependent Data
114+
### Introduction to Time Dependent Data and reproducible data pipelines
115115

116-
- [Coming Soon!]()
117-
118-
<br>
119-
120-
### Simple Time-dependent data pipeline
121-
122-
- [Coming Soon!]()
116+
- [Practical](vectorByte2026_timedepRegression.qmd)
117+
- [Example reproducible report](reproducibleReport.qmd)
118+
- [Git repository](https://github.com/VectorByteOrg/vectorbyte-training2026)
123119

124120
<br>
125121

reproducibleReport.qmd

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
---
22
title: "Reproducible Report"
3-
author: "VectorByte 2026"
3+
author:
4+
- name:
5+
given: VB
6+
family: Network
7+
affiliation: VectorByte
8+
citation: true
9+
date: 2026-05-29
410
format: html
511
editor: visual
612
---
@@ -136,7 +142,7 @@ ggplot(summaryDat, aes(x = year, y = mean))+
136142
137143
```
138144

139-
The year `{r} summaryDat$year[which.max(summaryDat$mean)]` had the highest average mosquito abundance. The year `{r} summaryDat$year[which.max(summaryDat$outliers)]` had the most outlier abundance observations. There were `{r} length(boxplot.stats(mosqDFcomb$totalMos)$out)` total outliers in the data set.
145+
The year `{r} summaryDat$year[which.max(summaryDat$mean)]` had the highest average mosquito abundance, with an average of `r max(summaryDat$mean)` mosquitoes observed. The year `{r} summaryDat$year[which.max(summaryDat$outliers)]` had the most outlier abundance observations. There were `{r} length(boxplot.stats(mosqDFcomb$totalMos)$out)` total outliers in the data set.
140146

141147
**Make one more plot that might be interesting and add some text to describe it using inline code**
142148

@@ -268,4 +274,4 @@ It is always good to think about how our models do well and where they fall shor
268274

269275
## Challenge
270276

271-
Using the skills you learned in the time-dependent covariate module, gather mean monthly temperature data for Suffolk, VA for the appropriate time frame and include temperature as a covariate in your model.
277+
Using the skills you learned in the time-dependent covariate module, gather mean monthly temperature data for Suffolk, VA for the appropriate time frame and include temperature as a covariate in your model. Consider transforming the response variable (e.g., taking a square-root) to address non-homoskedastic elements of the data.

vectorByte2026_timedepRegression.qmd

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
---
22
title: "Time Series Linear Regression and Automated Reports"
3-
author: "Alicia Surratt"
3+
author:
4+
- name:
5+
given: Alicia
6+
family: Surratt
7+
affiliation: Virginia Tech and VectorByte
8+
citation: true
9+
date: 2026-05-29
10+
date-format: long
411
format: html
5-
editor: visual
612
error: true
713
execute:
814
message: false
@@ -19,11 +25,11 @@ library(tidyverse)
1925

2026
Remember that simple linear regression fits a straight line through data by minimizing the distance between the fitted line and the actual data points (Ordinary Least Squares approach we explored in the NLLS session).
2127

22-
![](images/clipboard-659488832.png){fig-align="center" width="283"}
28+
![](graphics/clipboard-659488832.png){fig-align="center" width="283"}
2329

2430
While we often use a straight line for demonstration, also remember that linear models can be used to model data that doesn't *look* linear by incorporating higher order terms or using categorical predictors.
2531

26-
![](images/clipboard-2514654178.png){fig-align="center"}
32+
![](graphics/clipboard-2514654178.png){fig-align="center"}
2733

2834
Linear regression comes with certain assumptions about our data, and we check that the fitted model meets those assumptions using graphical methods or tests. Those assumptions are:
2935

@@ -131,13 +137,13 @@ The way we approach modeling time series data (and data in general) often depend
131137

132138
When we want to extract information about a system as it exists now or existed in the past, our goal is to use the model for *inference*. In this case, we may choose to focus more on the validity of the model within the data we already have. This helps us to characterize structures of interest within the data set (e.g. seasonal patterns, annual trends).
133139

134-
![Decomposition plot showing the seasonal and trend structures present in a time series data set](images/stlPlot.png){fig-align="center" width="507"}
140+
![Decomposition plot showing the seasonal and trend structures present in a time series data set](graphics/stlPlot.png){fig-align="center" width="507"}
135141

136142
#### Prediction
137143

138144
When we want to anticipate how a system will exist in the future, our goal is to use the model for *prediction*. In this case, we may choose the focus more on how well the model predicts responses from data we did not use to fit the model. This helps provide an idea about how the model will predict the future, which can be especially useful for people in resource management positions.
139145

140-
![Example of a simple forecast and the uncertainty around it. Found [here](https://stackoverflow.com/questions/29146353/how-to-interpret-forecasting-models-in-r).](images/clipboard-2136995412.png){fig-align="center" width="538"}
146+
![Example of a simple forecast and the uncertainty around it. Found [here](https://stackoverflow.com/questions/29146353/how-to-interpret-forecasting-models-in-r).](graphics/clipboard-2136995412.png){fig-align="center" width="538"}
141147

142148
Our practical will focus primarily on the inferential case.
143149
:::
@@ -248,11 +254,11 @@ summary(tempregAuto)
248254

249255
When the coefficient associated with an autoregressive variable is greater than 1, we call the time series an "exploding series", because this means that the observations are going to become exponentially far away from one another over time. In this case, an autoregressive term is often not very useful in our model.
250256

251-
![Exploding series, $\beta_1$ = 1.02](images/clipboard-2418282490.png){fig-align="center"}
257+
![Exploding series, $\beta_1$ = 1.02](graphics/clipboard-2418282490.png){fig-align="center"}
252258

253259
On the other hand, when the coefficient is less than 1, the series is likely "stationary". This means that the values tend to move back toward the mean value when they start to get far away from the mean. In these cases, autoregressive terms are very useful and informative.
254260

255-
![Stationary series, $\beta_1$ = 0.8](images/clipboard-3536036317.png)
261+
![Stationary series, $\beta_1$ = 0.8](graphics/clipboard-3536036317.png)
256262

257263
In our model, the coefficient was about 0.64, so the NY temperatures tend to regress toward the mean value over time!
258264
:::
@@ -299,7 +305,7 @@ The drawback to this approach is the number of dummy variables that will be intr
299305

300306
On the other hand, if you want to simply account for seasonality so you can focus on other information in the data, we can use trigonometric (sine and cosine) seasonality terms. We can represent any smooth periodic function as the sum of sines and cosines. Remember what the sine and cosine functions look like? They repeat every period ($\frac{2\pi}{k}$).
301307

302-
![](images/clipboard-2237205476.png)
308+
![](graphics/clipboard-2237205476.png)
303309

304310
It can be harder to directly compare these continuous functions to say that one season is statistically warmer than another, for example, but they require only 2 degrees of freedom! Adding these into the linear regression model from earlier looks like
305311

@@ -361,4 +367,4 @@ In cases where we expect to keep generating new data in a data set or where we e
361367

362368
In the next activity, we will use the VecDyn API to access mosquito population data collected over several years in Suffolk, VA to produce a report that explores and models the data. These data continue to be collected, so there's a good chance we would want to repeat any analyses we did with these data in the future.
363369

364-
Download and open the 'reproducibleReport.qmd' file to get started using the skills you learned in this practical to build a simple reproducible report!
370+
Download and open the [reproducibleReport.qmd](reproducibleReport.qmd) file to get started using the skills you learned in this practical to build a simple reproducible report!

0 commit comments

Comments
 (0)