<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Nechako River | Poisson Consulting</title>
    <link>/tag/nechako-river/</link>
      <atom:link href="/tag/nechako-river/index.xml" rel="self" type="application/rss+xml" />
    <description>Nechako River</description>
    <generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en-us</language><copyright>© Poisson Consulting</copyright><lastBuildDate>Fri, 25 Oct 2024 00:00:00 +0000</lastBuildDate>
    <image>
      <url>/media/logo_hu_f47d9b87cbc5aa6e.png</url>
      <title>Nechako River</title>
      <link>/tag/nechako-river/</link>
    </image>
    
    <item>
      <title>Spatial Stream Network Analysis of Nechako Watershed Stream Temperatures 2022b</title>
      <link>/analyses/fish-passage-22b/</link>
      <pubDate>Fri, 25 Oct 2024 00:00:00 +0000</pubDate>
      <guid>/analyses/fish-passage-22b/</guid>
      <description>


&lt;p&gt;The suggested citation for this &lt;a href=&#34;https://www.poissonconsulting.ca/analytic-appendices.html&#34;&gt;analytic
appendix&lt;/a&gt; is:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Hill, N.H., Thorley, J.L., &amp;amp; Irvine, A. (2024) Spatial Stream Network
Analysis of Nechako Watershed Stream Temperatures 2022b. A Poisson
Consulting Analysis Appendix. URL:
&lt;a href=&#34;https://www.poissonconsulting.ca/f/1295467017&#34; class=&#34;uri&#34;&gt;https://www.poissonconsulting.ca/f/1295467017&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;div id=&#34;background&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Background&lt;/h2&gt;
&lt;p&gt;The primary goal of the current analyses is to answer the following
question:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;How can we model stream temperature to include spatial correlation
through a stream network?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div id=&#34;data-preparation&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Data Preparation&lt;/h3&gt;
&lt;p&gt;Sub-hourly water temperature data collected in the Nechako Watershed in
northern British Columbia between 2019 and 2021 were downloaded as csv
files from &lt;a href=&#34;https://zenodo.org/records/6426024#.ZEAqr-zMI0Q&#34;&gt;Zenodo&lt;/a&gt;
&lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-morris_sub-hourly_2022&#34;&gt;Morris et al. 2022&lt;/a&gt;)&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Hourly air temperature data (at two metres above ground level) for the
Nechako Watershed for the years 2019-2021 were downloaded from the
&lt;a href=&#34;https://cds.climate.copernicus.eu/cdsapp#!/dataset/10.24381/cds.e2161bac?tab=overview&#34;&gt;ERA-5-Land
simulation&lt;/a&gt;
using the Copernicus Climate Change Service (C3S) Climate Data Store as
NetCDF files &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-munoz_sabater_era5-land_2019&#34;&gt;Muñoz Sabater 2019&lt;/a&gt;)&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Daily baseflow and surface runoff data for the Nechako Watershed for the
years 2019-2021 using the ACCESS1-0_rcp85 climate scenario were
downloaded from the &lt;a href=&#34;https://www.pacificclimate.org/data/gridded-hydrologic-model-output&#34;&gt;Pacific Climate Impacts Consortium’s Gridded
Hydrologic Model
Output&lt;/a&gt;
as NetCDF files
&lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-pacific_climate_impacts_consortium_university_of_victoria_gridded_2020&#34;&gt;Victoria Pacific Climate Impacts Consortium 2020&lt;/a&gt;)&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The data were prepared for analysis using R version 4.4.1
&lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-r_core_team_r_2022&#34;&gt;R Core Team 2022&lt;/a&gt;)&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Key assumptions of the data preparation included:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All stream temperature data are correct, except those flagged
“Fail”, which were excluded from analysis (see
&lt;span class=&#34;citation&#34;&gt;Gilbert et al. (&lt;a href=&#34;#ref-gilbert_sub-hourly_2022&#34;&gt;2022&lt;/a&gt;)&lt;/span&gt; for details).&lt;/li&gt;
&lt;li&gt;The simulated air temperature and discharge data from their
respective modeled simulations are reasonable approximations of the
truth.&lt;/li&gt;
&lt;li&gt;The daily discharge at each stream temperature site was calculated
by taking the weighted average of the sum of the baseflow and runoff
for the watershed area upstream of the site; these were then
averaged over weekly periods for each site.&lt;/li&gt;
&lt;li&gt;One site that corresponded to just four consecutive observed data
points proved insufficient to capture the annual-scale fluctuations
in stream temperature; this site (WHC) was dropped from the
analysis.&lt;/li&gt;
&lt;li&gt;There were 146 observations with negative stream temperatures
measurements, which were all set to 0˚C.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;statistical-analysis&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Statistical Analysis&lt;/h3&gt;
&lt;p&gt;Model parameters were estimated using Bayesian methods. The estimates
were produced using Stan &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-carpenter_stan_2017&#34;&gt;Carpenter et al. 2017&lt;/a&gt;)&lt;/span&gt;. For additional
information on Bayesian estimation the reader is referred to
&lt;span class=&#34;citation&#34;&gt;McElreath (&lt;a href=&#34;#ref-mcelreath_statistical_2020&#34;&gt;2020&lt;/a&gt;)&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Unless stated otherwise, the Bayesian analyses used weakly informative
prior distributions &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-gelman_prior_2017&#34;&gt;Gelman et al. 2017&lt;/a&gt;)&lt;/span&gt;. The posterior distributions
were estimated from 1500 Markov Chain Monte Carlo (MCMC) samples thinned
from the second halves of 3 chains &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-kery_bayesian_2011&#34;&gt;Kery and Schaub 2011, 38–40&lt;/a&gt;)&lt;/span&gt;.
Model convergence was confirmed by ensuring that the potential scale
reduction factor &lt;span class=&#34;math inline&#34;&gt;\(\hat{R} \leq 1.05\)&lt;/span&gt; &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-kery_bayesian_2011&#34;&gt;Kery and Schaub 2011, 40&lt;/a&gt;)&lt;/span&gt; and
the effective sample size &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-brooks_handbook_2011&#34;&gt;Brooks et al. 2011&lt;/a&gt;)&lt;/span&gt;
&lt;span class=&#34;math inline&#34;&gt;\(\textrm{ESS} \geq  150\)&lt;/span&gt; for each of the monitored parameters
&lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-kery_bayesian_2011&#34;&gt;Kery and Schaub 2011, 61&lt;/a&gt;)&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The sensitivity of the posteriors to the choice of prior distributions
was evaluated by doubling the standard deviations of the priors and then
using &lt;span class=&#34;math inline&#34;&gt;\(\hat{R}\)&lt;/span&gt; to evaluate whether the samples were drawn from the same
posterior distribution &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-thorley_fishing_2017&#34;&gt;Thorley and Andrusak 2017&lt;/a&gt;)&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The parameters are summarized in terms of the point &lt;em&gt;estimate&lt;/em&gt;, &lt;em&gt;lower&lt;/em&gt;
and &lt;em&gt;upper&lt;/em&gt; 95% compatibility limits &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-rafi_semantic_2020&#34;&gt;Rafi and Greenland 2020&lt;/a&gt;)&lt;/span&gt; and the
surprisal &lt;em&gt;s-value&lt;/em&gt; &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-greenland_valid_2019&#34;&gt;Greenland 2019&lt;/a&gt;)&lt;/span&gt;. Together a pair of lower
and upper compatibility limits (CLs) are referred to as a compatibility
interval (CI). The estimate is the median (50th percentile) of the MCMC
samples while the 95% CLs are the 2.5th and 97.5th percentiles. The
s-value indicates how surprising it would be to discover that the true
value of the parameter is in the opposite direction to the estimate
&lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-greenland_valid_2019&#34;&gt;Greenland 2019&lt;/a&gt;)&lt;/span&gt;. An s-value of &lt;span class=&#34;math inline&#34;&gt;\(&amp;gt;\)&lt;/span&gt; 4.32 bits, which is
equivalent to a p-value &lt;span class=&#34;math inline&#34;&gt;\(&amp;lt;\)&lt;/span&gt; 0.05
&lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-kery_bayesian_2011&#34;&gt;Kery and Schaub 2011&lt;/a&gt;; &lt;a href=&#34;#ref-greenland_living_2013&#34;&gt;Greenland and Poole 2013&lt;/a&gt;)&lt;/span&gt;, indicates that the
surprise would be equivalent to throwing at least 4.3 heads in a row on
a fair coin.&lt;/p&gt;
&lt;p&gt;Variable selection was based on the heuristic of directional certainty
&lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-kery_bayesian_2011&#34;&gt;Kery and Schaub 2011&lt;/a&gt;; &lt;a href=&#34;#ref-murtaugh_defense_2014&#34;&gt;Murtaugh 2014&lt;/a&gt;; &lt;a href=&#34;#ref-castilho_towards_2021&#34;&gt;Castilho and Prado 2021&lt;/a&gt;)&lt;/span&gt;.
Fixed effects were included if their s-value was &lt;span class=&#34;math inline&#34;&gt;\(&amp;gt;\)&lt;/span&gt; 4.32 bits
&lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-kery_bayesian_2011&#34;&gt;Kery and Schaub 2011&lt;/a&gt;)&lt;/span&gt;. Based on a similar argument, random effects were
included if their standard deviation had a lower 95% CL &lt;span class=&#34;math inline&#34;&gt;\(&amp;gt;\)&lt;/span&gt; 5% of the
median estimate.&lt;/p&gt;
&lt;p&gt;The analyses were implemented using R version 4.4.1
&lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-r_core_team_r_2022&#34;&gt;R Core Team 2022&lt;/a&gt;)&lt;/span&gt; and the
&lt;a href=&#34;https://github.com/poissonconsulting/embr&#34;&gt;&lt;code&gt;embr&lt;/code&gt;&lt;/a&gt; family of packages.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;model-descriptions&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Model Descriptions&lt;/h3&gt;
&lt;div id=&#34;stream-temperature&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Stream Temperature&lt;/h4&gt;
&lt;p&gt;The data were analyzed using a Spatial Stream Network model
&lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-ver_hoef_moving_2010&#34;&gt;Ver Hoef and Peterson 2010&lt;/a&gt;; &lt;a href=&#34;#ref-peterson_mixedmodel_2010&#34;&gt;Peterson and Hoef 2010&lt;/a&gt;)&lt;/span&gt;, with code adapted
from the &lt;a href=&#34;https://github.com/EdgarSantos-Fernandez/SSNbayes&#34;&gt;&lt;code&gt;SSNbayes&lt;/code&gt;&lt;/a&gt;
package &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-santos-fernandez_bayesian_2022&#34;&gt;Santos-Fernandez et al. 2022&lt;/a&gt;)&lt;/span&gt;. The necessary stream network
distances and connectivity were calculated using the BC Freshwater
Atlas. Air and stream temperature data were averaged by site and week;
modeling was done on this weekly time scale.&lt;/p&gt;
&lt;p&gt;The expected stream temperatures were modeled using the 4-parameter
version of the air2stream model &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-toffolon_hybrid_2015&#34;&gt;Toffolon and Piccolroaz 2015&lt;/a&gt;)&lt;/span&gt;. The average
stream temperature (in ˚C) in the first week, &lt;span class=&#34;math inline&#34;&gt;\(W_{s,j=1}\)&lt;/span&gt; was estimated
by the model and assumed to be the same for all sites.&lt;/p&gt;
&lt;p&gt;For all subsequent weeks (i.e., &lt;span class=&#34;math inline&#34;&gt;\(j &amp;gt; 1\)&lt;/span&gt;), the change in the stream
temperature (in ˚C) between week &lt;span class=&#34;math inline&#34;&gt;\(j - 1\)&lt;/span&gt; and week &lt;span class=&#34;math inline&#34;&gt;\(j\)&lt;/span&gt; for the &lt;span class=&#34;math inline&#34;&gt;\(s^{th}\)&lt;/span&gt;
site, &lt;span class=&#34;math inline&#34;&gt;\(\Delta W_{s,j}\)&lt;/span&gt;, was modeled as follows:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[\begin{equation} \Delta W_{s,j} = \frac{1}{(\theta_{s,j})^{a4_s}}(a1_s + a2_s A_{s,j} - a3_s W_{s,j - 1}), \end{equation}\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;where &lt;span class=&#34;math inline&#34;&gt;\(a1_s\)&lt;/span&gt;, &lt;span class=&#34;math inline&#34;&gt;\(a2_s\)&lt;/span&gt;, &lt;span class=&#34;math inline&#34;&gt;\(a3_s\)&lt;/span&gt;, and &lt;span class=&#34;math inline&#34;&gt;\(a4_s\)&lt;/span&gt; are the parameters of the
air2stream model for the &lt;span class=&#34;math inline&#34;&gt;\(s^{th}\)&lt;/span&gt; site, &lt;span class=&#34;math inline&#34;&gt;\(A_{s,j}\)&lt;/span&gt; is the air temperature
(in ˚C) for the &lt;span class=&#34;math inline&#34;&gt;\(s^{th}\)&lt;/span&gt; site in the &lt;span class=&#34;math inline&#34;&gt;\(j^{th}\)&lt;/span&gt; week, &lt;span class=&#34;math inline&#34;&gt;\(W_{s, j - 1}\)&lt;/span&gt; is
the expected stream temperature at the &lt;span class=&#34;math inline&#34;&gt;\(s^{th}\)&lt;/span&gt; site in the previous
week, and &lt;span class=&#34;math inline&#34;&gt;\(\theta_{s,j}\)&lt;/span&gt; is the dimensionless discharge for the &lt;span class=&#34;math inline&#34;&gt;\(s^{th}\)&lt;/span&gt;
site in the &lt;span class=&#34;math inline&#34;&gt;\(j^{th}\)&lt;/span&gt; week. &lt;span class=&#34;math inline&#34;&gt;\(\theta_{s,j}\)&lt;/span&gt; was calculated as follows:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[\begin{equation} \theta_{s,j} = \frac{d_{s,j}}{\bar{d_s}} \end{equation}\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;where &lt;span class=&#34;math inline&#34;&gt;\(d_{s,j}\)&lt;/span&gt; is the discharge for the &lt;span class=&#34;math inline&#34;&gt;\(s^{th}\)&lt;/span&gt; site in the &lt;span class=&#34;math inline&#34;&gt;\(j^{th}\)&lt;/span&gt;
week, and &lt;span class=&#34;math inline&#34;&gt;\(\bar{d_s} = \frac{\sum_{j = 1}^{J}(d_{s,j})}{J}\)&lt;/span&gt; is the mean
discharge across all &lt;span class=&#34;math inline&#34;&gt;\(J\)&lt;/span&gt; weeks for the &lt;span class=&#34;math inline&#34;&gt;\(s^{th}\)&lt;/span&gt; site.&lt;/p&gt;
&lt;p&gt;The expected stream temperature for the &lt;span class=&#34;math inline&#34;&gt;\(s^{th}\)&lt;/span&gt; site in the &lt;span class=&#34;math inline&#34;&gt;\(j^{th}\)&lt;/span&gt;
week was then calculated:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[\begin{equation} W_{s,j} = W_{s,j - 1} + \Delta W_{s,j}. \end{equation}\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Growing Season Degree Days (GSDD) are the accumulated thermal units (in
˚C) during the growing season based on the mean daily water temperature
values, which is a useful predictor of age-0 rainbow and westslope
cutthroat trout size at the beginning of winter. The start and end of
the growing season were based on the definitions of &lt;span class=&#34;citation&#34;&gt;Coleman and Fausch (&lt;a href=&#34;#ref-coleman_cold_2007&#34;&gt;2007&lt;/a&gt;)&lt;/span&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Start: the beginning of the first week that average stream
temperatures exceeded and remained above 5˚C for the season.&lt;/li&gt;
&lt;li&gt;End: the last day of the first week that average stream temperature
dropped below 4˚C.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;GSDD were derived for each site and year by assuming that the daily
stream temperatures at each site were the predicted weekly mean stream
temperature for every day in the given week.&lt;/p&gt;
&lt;p&gt;Key assumptions of the model include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The stream network is dendritic, not braided.&lt;/li&gt;
&lt;li&gt;The expected stream temperatures were set to 0˚C if they were
estimated to be negative by the model.&lt;/li&gt;
&lt;li&gt;The stream temperature in the first week is the same for all sites.&lt;/li&gt;
&lt;li&gt;The parameters of the air2stream model (&lt;span class=&#34;math inline&#34;&gt;\(a1\)&lt;/span&gt;, &lt;span class=&#34;math inline&#34;&gt;\(a2\)&lt;/span&gt;, &lt;span class=&#34;math inline&#34;&gt;\(a3\)&lt;/span&gt;, and &lt;span class=&#34;math inline&#34;&gt;\(a4\)&lt;/span&gt;)
vary randomly by site.&lt;/li&gt;
&lt;li&gt;The residual variation is multivariate normally distributed.&lt;/li&gt;
&lt;li&gt;The covariance structure of the residual variation combines the
following covariance components:
&lt;ul&gt;
&lt;li&gt;Nugget (allows for variation at a single location)&lt;/li&gt;
&lt;li&gt;Exponential tail-down (allows for spatial dependence between
flow-connected and flow-unconnected locations)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Preliminary analysis found that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The exponential tail-down model was better at explaining the spatial
correlation in the data than exponential tail-up or euclidean
distance models &lt;span class=&#34;citation&#34;&gt;(&lt;a href=&#34;#ref-ver_hoef_moving_2010&#34;&gt;Ver Hoef and Peterson 2010&lt;/a&gt;; &lt;a href=&#34;#ref-peterson_mixedmodel_2010&#34;&gt;Peterson and Hoef 2010&lt;/a&gt;)&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;The full 8-parameter air2stream model did not converge.&lt;/li&gt;
&lt;li&gt;Preliminary analysis found that allowing the initial stream
temperature to vary randomly by site produced unrealistic stream
temperatures for January (&amp;gt; 10˚C).&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;model-templates&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Model Templates&lt;/h3&gt;
&lt;div id=&#34;stream-temperature-1&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Stream Temperature&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;.data {
  int nsite;
  int nweek;

  int &amp;lt;lower=0&amp;gt; N_y_obs; // number observed values
  int &amp;lt;lower=0&amp;gt; N_y_mis; // number missing values
  int &amp;lt;lower=1&amp;gt; i_y_obs [N_y_obs] ;  // [N_y_obs,T]
  int &amp;lt;lower=1&amp;gt; i_y_mis [N_y_mis] ;  // [N_y_mis,T]
  vector [N_y_obs] y_obs;  // matrix[N_y_obs,1] y_obs[T];
  real discharge [nsite * nweek];
  real air_temp [nsite * nweek];
  int&amp;lt;lower=0&amp;gt; site[nsite * nweek];
  int&amp;lt;lower=0&amp;gt; week[nsite * nweek];

  matrix [nsite, nsite] D;
  matrix [nsite, nsite] I;
  matrix [nsite, nsite] H;
  matrix [nsite, nsite] flow_con_mat;

parameters {
  vector&amp;lt;lower=0, upper=30&amp;gt;[N_y_mis] y_mis; // declaring the missing y

  real&amp;lt;lower=0&amp;gt; sigma_nug; // sd of nugget effect
  real&amp;lt;lower=0&amp;gt; sigma_td; // sd of tail-down
  real&amp;lt;lower=0&amp;gt; alpha_td; // range of the tail-down model
  real&amp;lt;lower=0&amp;gt; bInitialTemp;
  real&amp;lt;lower=0&amp;gt; s1;
  real&amp;lt;lower=0&amp;gt; s2;
  real&amp;lt;lower=0&amp;gt; s3;
  real&amp;lt;lower=0&amp;gt; s4;
  real&amp;lt;lower=-5, upper=15&amp;gt; m1;
  real&amp;lt;lower=-5, upper=1.5&amp;gt; m2;
  real&amp;lt;lower=-5, upper=5&amp;gt; m3; 
  real&amp;lt;lower=-1, upper=1&amp;gt; m4;
  real&amp;lt;lower=-5, upper=15&amp;gt; a1[nsite];
  real&amp;lt;lower=-5, upper=1.5&amp;gt; a2[nsite]; 
  real&amp;lt;lower=-5, upper=5&amp;gt; a3[nsite]; 
  real&amp;lt;lower=-1, upper=1&amp;gt; a4[nsite];

transformed parameters {
  vector[nsite * nweek] y; // long vector of y
  vector[nsite] Y[nweek]; // array of y
  matrix[nsite, nsite] C_td; // tail-down cov
  real &amp;lt;lower=0&amp;gt; var_nug; // nugget
  real &amp;lt;lower=0&amp;gt; var_td; // partial sill tail-down

  vector[nsite * nweek] eTempDiff;
  vector&amp;lt;lower=0, upper=30&amp;gt;[nsite * nweek] eTemp;
  vector[nsite] mu [nweek];
  y[i_y_obs] = y_obs;
  y[i_y_mis] = y_mis;
  var_nug = sigma_nug^2; // variance nugget
  var_td = sigma_td^2; // variance tail-down
  // Place observations into matrices
  for (t in 1:nweek){
    Y[t] = y[((t - 1) * nsite + 1):(t * nsite)];
  }
  eTemp[1:nsite] = rep_vector(bInitialTemp, nsite);
  for (i in (nsite + 1):(nweek * nsite)) {
    eTempDiff[i] = (1/(discharge[i]^a4[site[i]])) * (a1[site[i]] + a2[site[i]] * air_temp[i] - a3[site[i]] * eTemp[i - nsite]);
    
    eTemp[i] = eTemp[i - nsite] + eTempDiff[i];
    if (eTemp[i] &amp;lt; 0) {
      eTemp[i] = 0.0;
    }
  }
  // Define 1st mu
  mu[1] = eTemp[1:nsite];
  // Define rest of mu; ----
  for (t in 2:nweek){
    mu[t] = eTemp[((t - 1) * nsite + 1):(t * nsite)];
  }
  // Covariance matrices ----
  // Tail-down exponential model
    for (i in 1:nsite) {
    for (j in 1:nsite) {
      if (flow_con_mat[i, j] == 1) { // if points are flow connected
        C_td[i, j] = var_td * exp(-3 * H[i, j] / alpha_td);
      }
      else{ // if points are flow unconnected
        C_td[i, j] = var_td * exp(-3 * (D[i, j] + D[j, i]) / alpha_td);
      }
    }
  }

model {
  sigma_nug ~ exponential(0.05); // sd nugget
  sigma_td ~ exponential(2); // sd tail-down
  alpha_td ~ normal(0, 20000) T[0, ]; // range tail-down
  bInitialTemp ~ normal(0, 0.1) T[0, ];

  s1 ~ exponential(50);
  s2 ~ exponential(50);
  s3 ~ exponential(50);
  s4 ~ exponential(50);
  m1 ~ normal(0.8, 1);
  m2 ~ normal(0.4, 1);
  m3 ~ normal(0.4, 1);
  m4 ~ normal(0.1, 1);
  a1 ~ normal(m1, s1);
  a2 ~ normal(m2, s2);
  a3 ~ normal(m3, s3);
  a4 ~ normal(m4, s4);

  for (t in 1:nweek) {
    target += multi_normal_cholesky_lpdf(Y[t] | mu[t], cholesky_decompose(C_td + var_nug * I + 1e-6));
  }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Block 1. Model description.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;results&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Results&lt;/h2&gt;
&lt;div id=&#34;tables&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Tables&lt;/h3&gt;
&lt;div id=&#34;stream-temperature-2&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Stream Temperature&lt;/h4&gt;
&lt;p&gt;Table 1. Parameter descriptions.&lt;/p&gt;
&lt;table style=&#34;width:98%;&#34;&gt;
&lt;colgroup&gt;
&lt;col width=&#34;20%&#34; /&gt;
&lt;col width=&#34;77%&#34; /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;left&#34;&gt;Parameter&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;C_td&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Covariance matrix of the tail-down exponential model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;D&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Downstream hydrologic distance matrix&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;H&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Total hydrologic distance matrix&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;I&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;The identity matrix&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;N_y_mis&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Number of missing water temperature values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;N_y_obs&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Number of observed water temperature values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;Y[t]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Vector of water temperature values for all sites in the &lt;code&gt;t&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt;
week&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;a1[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Intercept-type parameter of the air2stream model for the &lt;code&gt;i&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt;
site&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;a2[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Effect of &lt;code&gt;air_temp[i]&lt;/code&gt; on &lt;code&gt;eTempDiff[i]&lt;/code&gt; for the &lt;code&gt;i&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt; site&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;a3[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Effect of the previous week’s expected water temperature
(&lt;code&gt;eTemp[i - nsite]&lt;/code&gt;) on &lt;code&gt;eTempDiff[i]&lt;/code&gt;, for the &lt;code&gt;i&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt; site&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;a4[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Effect of &lt;code&gt;discharge[i]&lt;/code&gt; on &lt;code&gt;eTempDiff[i]&lt;/code&gt; for the &lt;code&gt;i&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt; site&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;air_temp[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;The &lt;code&gt;i&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt; air temperature value (˚C)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;alpha_td&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;The variance of spatially independent points&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;bInitialTemp&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Expected average water temperature for the week starting
01-01-2019 for all sites&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;discharge[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Dimensionless discharge for the &lt;code&gt;i&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt; observation (discharge
for that observation divided by the mean discharge across all
observations for that site)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;eTempDiff[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Expected difference in average water temperature from the
previous week&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;eTemp[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Expected value of &lt;code&gt;water_temp[i]&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;flow_con_mat&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Site connectivity matrix&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;i_y_mis&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Indexes of missing water temperature values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;i_y_obs&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Indexes of observed water temperature values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;m1&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Mean of the site-wise random effect for the &lt;code&gt;a1&lt;/code&gt; parameter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;m2&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Mean of the site-wise random effect for the &lt;code&gt;a2&lt;/code&gt; parameter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;m3&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Mean of the site-wise random effect for the &lt;code&gt;a3&lt;/code&gt; parameter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;m4&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Mean of the site-wise random effect for the &lt;code&gt;a4&lt;/code&gt; parameter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;mu[t]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Vector of &lt;code&gt;eTemp&lt;/code&gt; values for all sites in the &lt;code&gt;t&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt; week&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;nsite&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Number of sites&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;nweek&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Number of weeks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;s1&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Standard deviation of the site-wise random effect for the &lt;code&gt;a1&lt;/code&gt;
parameter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;s2&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Standard deviation of the site-wise random effect for the &lt;code&gt;a2&lt;/code&gt;
parameter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;s3&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Standard deviation of the site-wise random effect for the &lt;code&gt;a3&lt;/code&gt;
parameter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;s4&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Standard deviation of the site-wise random effect for the &lt;code&gt;a4&lt;/code&gt;
parameter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;sigma_nug&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Standard deviation of the nugget effect&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;sigma_td&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Standard deviation of the exponential tail-down covariance model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;site[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;The &lt;code&gt;i&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt; site&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;var_nug&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Variance of the nugget effect&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;var_td&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Variance of the exponential tail-down covariance model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;week[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;The &lt;code&gt;i&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt; week&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;y[i]&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;The &lt;code&gt;i&lt;/code&gt;&lt;sup&gt;th&lt;/sup&gt; water temperature value (˚C)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;y_mis&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Vector of missing water temperature values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;&lt;code&gt;y_obs&lt;/code&gt;&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Vector of observed water temperature values&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Table 2. Model coefficients.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;left&#34;&gt;term&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;estimate&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;lower&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;upper&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;svalue&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;alpha_td&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9.77e+03&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;6.16e+03&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.69e+04&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;bInitialTemp&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7.14e-02&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4.01e-03&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.36e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;m1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;6.30e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4.65e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7.96e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;m2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.22e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.67e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.76e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;m3&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.21e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.73e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.74e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;m4&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.79e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.80e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.93e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;s1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.67e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.07e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.45e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;s2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.18e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9.08e-02&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.59e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;s3&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.08e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;8.46e-02&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.45e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;s4&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.01e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.55e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.66e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;sigma_nug&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4.20e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.85e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4.58e-01&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;sigma_td&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.37e+00&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.19e+00&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.59e+00&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10.6&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Table 3. Model convergence.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;right&#34;&gt;n&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;K&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;nchains&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;niters&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;nthin&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;ess&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;rhat&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;converged&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;3297&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2126&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;500&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;543&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.013&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;TRUE&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Table 4. Model sensitivity.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;left&#34;&gt;all&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;analysis&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;sensitivity&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;bound&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;all&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.013&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.076&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1.132&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;figures&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Figures&lt;/h3&gt;
&lt;div id=&#34;stream-temperature-3&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Stream Temperature&lt;/h4&gt;
&lt;figure&gt;
&lt;img alt = &#34;figures/temperature-air2stream/covariance-distance.png&#34; src = &#34;/analyses/fish-passage-22b/figures/temperature-air2stream/covariance-distance.png&#34; title = &#34;figures/temperature-air2stream/covariance-distance.png&#34; width = &#34;50%&#34;&gt;
&lt;figcaption&gt;
Figure 1. Tail-down covariance by hydrologic distance (with 95% CIs).
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure&gt;
&lt;img alt = &#34;figures/temperature-air2stream/water-temp.png&#34; src = &#34;/analyses/fish-passage-22b/figures/temperature-air2stream/water-temp.png&#34; title = &#34;figures/temperature-air2stream/water-temp.png&#34; width = &#34;100%&#34;&gt;
&lt;figcaption&gt;
Figure 2. Predicted water temperature by date (with 95% CIs). The points
are the observed data.
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure&gt;
&lt;img alt = &#34;figures/temperature-air2stream/gsdd-annual-site.png&#34; src = &#34;/analyses/fish-passage-22b/figures/temperature-air2stream/gsdd-annual-site.png&#34; title = &#34;figures/temperature-air2stream/gsdd-annual-site.png&#34; width = &#34;83.3333333333333%&#34;&gt;
&lt;figcaption&gt;
Figure 3. Predicted GSDD by year and site (with 95% CIs).
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure&gt;
&lt;img alt = &#34;figures/temperature-air2stream/gsdd-map.png&#34; src = &#34;/analyses/fish-passage-22b/figures/temperature-air2stream/gsdd-map.png&#34; title = &#34;figures/temperature-air2stream/gsdd-map.png&#34; width = &#34;100%&#34;&gt;
&lt;figcaption&gt;
Figure 4. GSDD median estimate and width of 95% CI by year and site. The
black lines are the stream network.
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;acknowledgements&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Acknowledgements&lt;/h2&gt;
&lt;p&gt;The organisations and individuals whose contributions have made this
analytic appendix possible include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hillcrest Geographics
&lt;ul&gt;
&lt;li&gt;Simon Norris&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&#34;page-break-after: always;&#34;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;references&#34; class=&#34;section level2 unnumbered&#34;&gt;
&lt;h2&gt;References&lt;/h2&gt;
&lt;div id=&#34;refs&#34; class=&#34;references csl-bib-body hanging-indent&#34;&gt;
&lt;div id=&#34;ref-brooks_handbook_2011&#34; class=&#34;csl-entry&#34;&gt;
Brooks, Steve, Andrew Gelman, Galin L. Jones, and Xiao-Li Meng, eds. 2011. &lt;em&gt;Handbook for &lt;span&gt;Markov&lt;/span&gt; &lt;span&gt;Chain&lt;/span&gt; &lt;span&gt;Monte&lt;/span&gt; &lt;span&gt;Carlo&lt;/span&gt;&lt;/em&gt;. Taylor &amp;amp; Francis.
&lt;/div&gt;
&lt;div id=&#34;ref-carpenter_stan_2017&#34; class=&#34;csl-entry&#34;&gt;
Carpenter, Bob, Andrew Gelman, Matthew D. Hoffman, et al. 2017. &lt;span&gt;“&lt;em&gt;Stan&lt;/em&gt; : &lt;span&gt;A&lt;/span&gt; &lt;span&gt;Probabilistic&lt;/span&gt; &lt;span&gt;Programming&lt;/span&gt; &lt;span&gt;Language&lt;/span&gt;.”&lt;/span&gt; &lt;em&gt;Journal of Statistical Software&lt;/em&gt; 76 (1). &lt;a href=&#34;https://doi.org/10.18637/jss.v076.i01&#34;&gt;https://doi.org/10.18637/jss.v076.i01&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-castilho_towards_2021&#34; class=&#34;csl-entry&#34;&gt;
Castilho, Leonardo Braga, and Paulo Inácio Prado. 2021. &lt;span&gt;“Towards a Pragmatic Use of Statistics in Ecology.”&lt;/span&gt; &lt;em&gt;PeerJ&lt;/em&gt; 9 (September): e12090. &lt;a href=&#34;https://doi.org/10.7717/peerj.12090&#34;&gt;https://doi.org/10.7717/peerj.12090&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-coleman_cold_2007&#34; class=&#34;csl-entry&#34;&gt;
Coleman, Mark A., and Kurt D. Fausch. 2007. &lt;span&gt;“Cold &lt;span&gt;Summer&lt;/span&gt; &lt;span&gt;Temperature&lt;/span&gt; &lt;span&gt;Limits&lt;/span&gt; &lt;span&gt;Recruitment&lt;/span&gt; of &lt;span&gt;Age&lt;/span&gt;-0 &lt;span&gt;Cutthroat&lt;/span&gt; &lt;span&gt;Trout&lt;/span&gt; in &lt;span&gt;High&lt;/span&gt;-&lt;span&gt;Elevation&lt;/span&gt; &lt;span&gt;Colorado&lt;/span&gt; &lt;span&gt;Streams&lt;/span&gt;.”&lt;/span&gt; &lt;em&gt;Transactions of the American Fisheries Society&lt;/em&gt; 136 (5): 1231–44. &lt;a href=&#34;https://doi.org/10.1577/T05-244.1&#34;&gt;https://doi.org/10.1577/T05-244.1&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-gelman_prior_2017&#34; class=&#34;csl-entry&#34;&gt;
Gelman, Andrew, Daniel Simpson, and Michael Betancourt. 2017. &lt;span&gt;“The &lt;span&gt;Prior&lt;/span&gt; &lt;span&gt;Can&lt;/span&gt; &lt;span&gt;Often&lt;/span&gt; &lt;span&gt;Only&lt;/span&gt; &lt;span&gt;Be&lt;/span&gt; &lt;span&gt;Understood&lt;/span&gt; in the &lt;span&gt;Context&lt;/span&gt; of the &lt;span&gt;Likelihood&lt;/span&gt;.”&lt;/span&gt; &lt;em&gt;Entropy&lt;/em&gt; 19 (10): 555. &lt;a href=&#34;https://doi.org/10.3390/e19100555&#34;&gt;https://doi.org/10.3390/e19100555&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-gilbert_sub-hourly_2022&#34; class=&#34;csl-entry&#34;&gt;
Gilbert, Derek E., Jeremy E. Morris, Anna R. Kaveney, and Stephen J. Déry. 2022. &lt;span&gt;“Sub-Hourly Water Temperature Data Collected Across the &lt;span&gt;Nechako&lt;/span&gt; &lt;span&gt;Watershed&lt;/span&gt;, 2019-2021.”&lt;/span&gt; &lt;em&gt;Data in Brief&lt;/em&gt; 43 (August): 108425. &lt;a href=&#34;https://doi.org/10.1016/j.dib.2022.108425&#34;&gt;https://doi.org/10.1016/j.dib.2022.108425&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-greenland_valid_2019&#34; class=&#34;csl-entry&#34;&gt;
Greenland, Sander. 2019. &lt;span&gt;“Valid &lt;em&gt;p&lt;/em&gt; -&lt;span&gt;Values&lt;/span&gt; &lt;span&gt;Behave&lt;/span&gt; &lt;span&gt;Exactly&lt;/span&gt; as &lt;span&gt;They&lt;/span&gt; &lt;span&gt;Should&lt;/span&gt;: &lt;span&gt;Some&lt;/span&gt; &lt;span&gt;Misleading&lt;/span&gt; &lt;span&gt;Criticisms&lt;/span&gt; of &lt;em&gt;p&lt;/em&gt; -&lt;span&gt;Values&lt;/span&gt; and &lt;span&gt;Their&lt;/span&gt; &lt;span&gt;Resolution&lt;/span&gt; &lt;span&gt;With&lt;/span&gt; &lt;em&gt;s&lt;/em&gt; -&lt;span&gt;Values&lt;/span&gt;.”&lt;/span&gt; &lt;em&gt;The American Statistician&lt;/em&gt; 73 (sup1): 106–14. &lt;a href=&#34;https://doi.org/10.1080/00031305.2018.1529625&#34;&gt;https://doi.org/10.1080/00031305.2018.1529625&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-greenland_living_2013&#34; class=&#34;csl-entry&#34;&gt;
Greenland, Sander, and Charles Poole. 2013. &lt;span&gt;“Living with p Values: Resurrecting a Bayesian Perspective on Frequentist Statistics.”&lt;/span&gt; &lt;em&gt;Epidemiology&lt;/em&gt; 24 (1): 62–68. &lt;a href=&#34;https://doi.org/10.1097/EDE.0b013e3182785741&#34;&gt;https://doi.org/10.1097/EDE.0b013e3182785741&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-kery_bayesian_2011&#34; class=&#34;csl-entry&#34;&gt;
Kery, Marc, and Michael Schaub. 2011. &lt;em&gt;Bayesian Population Analysis Using &lt;span&gt;WinBUGS&lt;/span&gt; : A Hierarchical Perspective&lt;/em&gt;. Academic Press. &lt;a href=&#34;http://www.vogelwarte.ch/bpa.html&#34;&gt;http://www.vogelwarte.ch/bpa.html&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-mcelreath_statistical_2020&#34; class=&#34;csl-entry&#34;&gt;
McElreath, Richard. 2020. &lt;em&gt;Statistical Rethinking: A &lt;span&gt;Bayesian&lt;/span&gt; Course with Examples in &lt;span&gt;R&lt;/span&gt; and &lt;span&gt;Stan&lt;/span&gt;&lt;/em&gt;. 2nd ed. &lt;span&gt;CRC&lt;/span&gt; Texts in Statistical Science. Taylor; Francis, CRC Press.
&lt;/div&gt;
&lt;div id=&#34;ref-morris_sub-hourly_2022&#34; class=&#34;csl-entry&#34;&gt;
Morris, Jeremy, Derek Gilbert, Anna Kaveney, and Stephen Déry. 2022. &lt;em&gt;Sub-Hourly Water Temperature Collected by &lt;span&gt;UNBC&lt;/span&gt;’s Northern Hydrometeorology Group (&lt;span&gt;NHG&lt;/span&gt;) Across the &lt;span&gt;Nechako&lt;/span&gt; &lt;span&gt;Watershed&lt;/span&gt;, 2019-2021&lt;/em&gt;. &lt;a href=&#34;https://doi.org/10.5281/zenodo.6426023&#34;&gt;https://doi.org/10.5281/zenodo.6426023&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-munoz_sabater_era5-land_2019&#34; class=&#34;csl-entry&#34;&gt;
Muñoz Sabater, J. 2019. &lt;em&gt;&lt;span&gt;ERA5&lt;/span&gt;-&lt;span&gt;Land&lt;/span&gt; Hourly Data from 1950 to Present&lt;/em&gt;. Copernicus Climate Change Service (C3S) Climate Data Store (CDS). &lt;a href=&#34;https://doi.org/10.24381/cds.e2161bac&#34;&gt;https://doi.org/10.24381/cds.e2161bac&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-murtaugh_defense_2014&#34; class=&#34;csl-entry&#34;&gt;
Murtaugh, Paul A. 2014. &lt;span&gt;“In Defense of &lt;em&gt;p&lt;/em&gt; Values.”&lt;/span&gt; &lt;em&gt;Ecology&lt;/em&gt; 95 (3): 611–17. &lt;a href=&#34;https://doi.org/10.1890/13-0590.1&#34;&gt;https://doi.org/10.1890/13-0590.1&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-peterson_mixedmodel_2010&#34; class=&#34;csl-entry&#34;&gt;
Peterson, Erin E., and Jay M. Ver Hoef. 2010. &lt;span&gt;“A Mixed‐model Moving‐average Approach to Geostatistical Modeling in Stream Networks.”&lt;/span&gt; &lt;em&gt;Ecology&lt;/em&gt; 91 (3): 644–51. &lt;a href=&#34;https://doi.org/10.1890/08-1668.1&#34;&gt;https://doi.org/10.1890/08-1668.1&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-r_core_team_r_2022&#34; class=&#34;csl-entry&#34;&gt;
R Core Team. 2022. &lt;em&gt;R: &lt;span&gt;A&lt;/span&gt; &lt;span&gt;Language&lt;/span&gt; and &lt;span&gt;Environment&lt;/span&gt; for &lt;span&gt;Statistical&lt;/span&gt; &lt;span&gt;Computing&lt;/span&gt;&lt;/em&gt;. R Foundation for Statistical Computing. &lt;a href=&#34;https://www.R-project.org/&#34;&gt;https://www.R-project.org/&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-rafi_semantic_2020&#34; class=&#34;csl-entry&#34;&gt;
Rafi, Zad, and Sander Greenland. 2020. &lt;span&gt;“Semantic and Cognitive Tools to Aid Statistical Science: Replace Confidence and Significance by Compatibility and Surprise.”&lt;/span&gt; &lt;em&gt;BMC Medical Research Methodology&lt;/em&gt; 20 (1): 244. &lt;a href=&#34;https://doi.org/10.1186/s12874-020-01105-9&#34;&gt;https://doi.org/10.1186/s12874-020-01105-9&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-santos-fernandez_bayesian_2022&#34; class=&#34;csl-entry&#34;&gt;
Santos-Fernandez, Edgar, Jay M. Ver Hoef, Erin E. Peterson, James McGree, Daniel Isaak, and Kerrie Mengersen. 2022. &lt;span&gt;“Bayesian Spatio-Temporal Models for Stream Networks.”&lt;/span&gt; &lt;em&gt;Computational Statistics &amp;amp; Data Analysis&lt;/em&gt; 170 (June): 107446. &lt;a href=&#34;https://doi.org/10.1016/j.csda.2022.107446&#34;&gt;https://doi.org/10.1016/j.csda.2022.107446&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-thorley_fishing_2017&#34; class=&#34;csl-entry&#34;&gt;
Thorley, Joseph L., and Greg F. Andrusak. 2017. &lt;span&gt;“The Fishing and Natural Mortality of Large, Piscivorous &lt;span&gt;Bull&lt;/span&gt; &lt;span&gt;Trout&lt;/span&gt; and &lt;span&gt;Rainbow&lt;/span&gt; &lt;span&gt;Trout&lt;/span&gt; in &lt;span&gt;Kootenay&lt;/span&gt; &lt;span&gt;Lake&lt;/span&gt;, &lt;span&gt;British&lt;/span&gt; &lt;span&gt;Columbia&lt;/span&gt; (2008–2013).”&lt;/span&gt; &lt;em&gt;PeerJ&lt;/em&gt; 5 (January): e2874. &lt;a href=&#34;https://doi.org/10.7717/peerj.2874&#34;&gt;https://doi.org/10.7717/peerj.2874&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-toffolon_hybrid_2015&#34; class=&#34;csl-entry&#34;&gt;
Toffolon, Marco, and Sebastiano Piccolroaz. 2015. &lt;span&gt;“A Hybrid Model for River Water Temperature as a Function of Air Temperature and Discharge.”&lt;/span&gt; &lt;em&gt;Environmental Research Letters&lt;/em&gt; 10 (11): 114011. &lt;a href=&#34;https://doi.org/10.1088/1748-9326/10/11/114011&#34;&gt;https://doi.org/10.1088/1748-9326/10/11/114011&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-ver_hoef_moving_2010&#34; class=&#34;csl-entry&#34;&gt;
Ver Hoef, Jay M., and Erin E. Peterson. 2010. &lt;span&gt;“A &lt;span&gt;Moving&lt;/span&gt; &lt;span&gt;Average&lt;/span&gt; &lt;span&gt;Approach&lt;/span&gt; for &lt;span&gt;Spatial&lt;/span&gt; &lt;span&gt;Statistical&lt;/span&gt; &lt;span&gt;Models&lt;/span&gt; of &lt;span&gt;Stream&lt;/span&gt; &lt;span&gt;Networks&lt;/span&gt;.”&lt;/span&gt; &lt;em&gt;Journal of the American Statistical Association&lt;/em&gt; 105 (489): 6–18. &lt;a href=&#34;https://doi.org/10.1198/jasa.2009.ap08248&#34;&gt;https://doi.org/10.1198/jasa.2009.ap08248&lt;/a&gt;.
&lt;/div&gt;
&lt;div id=&#34;ref-pacific_climate_impacts_consortium_university_of_victoria_gridded_2020&#34; class=&#34;csl-entry&#34;&gt;
Victoria Pacific Climate Impacts Consortium, University of. 2020. &lt;em&gt;Gridded &lt;span&gt;Hydrologic&lt;/span&gt; &lt;span&gt;Model&lt;/span&gt; &lt;span&gt;Output&lt;/span&gt;&lt;/em&gt;. &lt;a href=&#34;https://data.pacificclimate.org/portal/hydro_model_out/map/&#34;&gt;https://data.pacificclimate.org/portal/hydro_model_out/map/&lt;/a&gt;.
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
    
  </channel>
</rss>
