Skip to content

Commit

Permalink
Merge pull request #142 from jessicalundquist/main
Browse files Browse the repository at this point in the history
updated lab and module 7 for 2022 ENSO
  • Loading branch information
jessicalundquist authored Nov 8, 2022
2 parents 2b90a5a + 0bd89e3 commit 0f73f39
Show file tree
Hide file tree
Showing 5 changed files with 463 additions and 11 deletions.
74 changes: 74 additions & 0 deletions modules/.ipynb_checkpoints/module7-checkpoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 7) Markov Chains

```note
## Lab 7: Markov Models & Markov Chain Monte Carlo (MCMC)
Download the lab and data files to your computer. Then, upload them to your JupyterHub [following the instructions here](/resources/b-learning-jupyter.html#working-with-files-on-our-jupyterhub).
* [Lab 7-1: Markov Chains - Basic Examples](lab7/lab7-1.ipynb)
* data: [markov_random4.txt](data/markov_random4.txt)
* [Lab 7-2: Markov Chain - ENSO Phases](lab7/lab7-2.ipynb)
* data: [ENSO_to2022.csv](data/ENSO_to2022.csv)
* [Lab 7-3: MCMC Rating Curves](lab7/lab7-3.ipynb)
* data: [Lyell_h_Q_sorted.mat](data/Lyell_h_Q_sorted.mat)
```


## Homework 7:


### Problem 1: ENSO Phases
Following Lab 7-1 and Lab 7-2,
A) Use the time series of the phase of the El Niño Southern Oscillation (ENSO) from 1900-2022 to create a lag-1 Markov model of the ENSO phase.
where the observed Phases of ENSO are as follows:

1: warm (El Niño)
2: neutral (ENSO neutral)
3: cool, (La Niña)

B) Using this Markov model and a random number generator, simulate 5,000 years of ENSO data.

C) Using this randomly generated data, answer the following questions.

- According to the model, what is the probability that three warm ENSO years would occur in a row?
- What is the large-sample probability that three cool ENSO years would happen in a row? (Try refreshing the numbers several times to increase the sample size if the condition never happens.)
- Check out this [blog](https://www.climate.gov/news-features/blogs/september-2022-la-ni%C3%B1a-update-it%E2%80%99s-q-time) about why we care about ENSO and the exciting current probability of getting a cool ENSO (La Nina) again in 2023, making it three in a row.

### Probelm 2: Rating Curves and Application of Bayes Theorem with MCMC

Following the class discussion and Lab 7-3, explore how the rating curve and the 95% confidence intervals for the Lyell Fork streamflow site change depending on the method you use to determine the rating curve:

- Least squares linear regression fitting (with transformed variables) using b = 0.28 m
- Make 95% confidence intervals around this regression fit
- Then, assume that we don't know exactly what b is. Try additional linear regressions using different values of b = 0.10, 0.20, 0.30, 0.40, and 0.50 m (you do not need to calculate 95% confidence intervals for these additional fits)
- Qualitatively, is the range between these 5 additional lines with different b values larger or smaller than the range between the 95% confidence lines from the original fitted line (the one with b = 0.28 cm)?
- Direct monte carlo parameter estimation
- Bayesian MCMC fitting

Using the code in Lab 7-3, create plots and discuss the differences in the results from these three methods.

### Problem 2 grads: Work on your term projects (CEWA 565)


### Problem 2 undergrads: Statistics Synthesis (CEE 465)

(Your final exam questions will look similar to this.)
You are given the below dataset of annual peak flows on the Sauk River:

![Sauk River Plot](lab7/sauk-river-plot.png)

(Note, you do not need to do any actual analysis here)

For each of the following questions about this dataset, I want you to answer:
- How do you ask this question statistically?
- What tools should you use to answer this question? (think of techniques we’ve learned in class)
- What should you be careful about? (think of caveats and requirements of the tools you’re recommending).

**A.** Presume some logging occurred in the watershed in 1970. Are peak flows higher after 1970 than before 1970?

**B.** Presume some logging occurred in the watershed in 1970. Have peak flows become more variable after 1970 than before 1970?

**C.** If the mean annual peak flow has increased to above 50,000 cfs, the town will rebuild the levees. What are the chances that our statistical test would fail to identify this change?

**D.** Has there been a trend in peak flows between 1930 and 2010? How fast are peak flows changing, and is this trend significant?
129 changes: 129 additions & 0 deletions modules/data/ENSO_to2022.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Observed Phase of the ENSO,,
#state number,state,description
#1,El Nino,warm
#2,ENSO neutral,neutral
#3,La Nina,cool
Water Year,ENSO Phase,
1900,1,
1901,2,
1902,2,
1903,1,
1904,3,
1905,1,
1906,1,
1907,3,
1908,2,
1909,3,
1910,3,
1911,3,
1912,1,
1913,2,
1914,1,
1915,1,
1916,2,
1917,3,
1918,3,
1919,1,
1920,1,
1921,3,
1922,2,
1923,3,
1924,1,
1925,3,
1926,1,
1927,2,
1928,2,
1929,2,
1930,1,
1931,1,
1932,3,
1933,2,
1934,3,
1935,2,
1936,2,
1937,2,
1938,3,
1939,3,
1940,1,
1941,1,
1942,1,
1943,3,
1944,3,
1945,3,
1946,2,
1947,2,
1948,2,
1949,2,
1950,3,
1951,3,
1952,1,
1953,2,
1954,2,
1955,3,
1956,3,
1957,2,
1958,1,
1959,1,
1960,2,
1961,2,
1962,2,
1963,3,
1964,1,
1965,3,
1966,1,
1967,2,
1968,3,
1969,1,
1970,1,
1971,3,
1972,3,
1973,1,
1974,3,
1975,3,
1976,3,
1977,1,
1978,1,
1979,2,
1980,1,
1981,2,
1982,2,
1983,1,
1984,3,
1985,3,
1986,3,
1987,1,
1988,1,
1989,3,
1990,2,
1991,2,
1992,1,
1993,2,
1994,2,
1995,1,
1996,3,
1997,2,
1998,1,
1999,3,
2000,3,
2001,3,
2002,2,
2003,1,
2004,2,
2005,1,
2006,3,
2007,1,
2008,3,
2009,3,
2010,1,
2011,3,
2012,3,
2013,2,
2014,2,
2015,1,
2016,1,
2017,3,
2018,3,
2019,1,
2020,2,
2021,3,
2022,3,
Loading

0 comments on commit 0f73f39

Please sign in to comment.