diff --git a/.github/workflows/update-s3.yml b/.github/workflows/update-s3.yml new file mode 100644 index 0000000..0283b1c --- /dev/null +++ b/.github/workflows/update-s3.yml @@ -0,0 +1,25 @@ +name: Deploy site to S3 +on: + pull_request: + push: + branches: + - main + +jobs: + update-site: + name: Update public site + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-west-2 + - name: Deploy newly built site to S3 + CloudFront + run: | + aws s3 sync --delete public/ s3://${{ secrets.LTRR_SITE_BUCKET }}/ + aws cloudfront create-invalidation --distribution-id ${{ secrets.LTRR_SITE_CDN }} --paths '/*' + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e3d2951 --- /dev/null +++ b/.gitignore @@ -0,0 +1,78 @@ +# Created by https://www.toptal.com/developers/gitignore/api/linux,macos,windows +# Edit at https://www.toptal.com/developers/gitignore?templates=linux,macos,windows + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/linux,macos,windows diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2515a21 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-2022 The Arizona Board of Regents on behalf of The University of Arizona + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a9297d7 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Dave Meko faculty web site + Time Series course + +Automatic maintenance of a static web site in an AWS S3 bucket. diff --git a/public/Document Scrap 'csaps_m i...'.shs b/public/Document Scrap 'csaps_m i...'.shs new file mode 100755 index 0000000..05eca33 Binary files /dev/null and b/public/Document Scrap 'csaps_m i...'.shs differ diff --git a/public/Files_pooled.zip b/public/Files_pooled.zip new file mode 100644 index 0000000..d9a12a9 Binary files /dev/null and b/public/Files_pooled.zip differ diff --git a/public/Geos585A_notes2017.zip b/public/Geos585A_notes2017.zip new file mode 100755 index 0000000..8c81f76 Binary files /dev/null and b/public/Geos585A_notes2017.zip differ diff --git a/public/Geos585A_notes2019.zip b/public/Geos585A_notes2019.zip new file mode 100644 index 0000000..d6f0650 Binary files /dev/null and b/public/Geos585A_notes2019.zip differ diff --git a/public/MekoWeb.bfproject b/public/MekoWeb.bfproject new file mode 100755 index 0000000..133888e --- /dev/null +++ b/public/MekoWeb.bfproject @@ -0,0 +1,61 @@ +view_main_toolbar: 1 +bmarksearchmode: 0 +snr_scope: 0 +snr_type: 0 +view_cline: 1 +editor_indent_wspaces: 0 +c2e.convert_xml: 1 +snr_dotmatchall: 0 +htmlbar_view: 1 +fb_focus_follow: 1 +adv_open_recursive: 0 +encoding: UTF-8 +autoindent: 1 +e2c.convert_special: 0 +fb_viewmode: 0 +snippets_show_as_menu: 1 +bookmarks_show_mode: 0 +outputb_show_all_output: 0 +autocomplete: 1 +spell_lang: en_ZA +c2e.convert_symbol: 0 +snr_escape_chars: 0 +view_blockstack: 1 +htmlbar_notebooktab: 0 +last_filefilter: +spell_insert_entities: 0 +spell_check_default: 1 +savedir: file:///home/david/Data/web +files: /home/david/Data/web/geos585a.html +snr_replacetype: 0 +recent_files: file:///home/david/Data/web/geos585a.html +charmap_block: 1 +e2c.convert_iso: 0 +enable_syntax_scan: 1 +outputb_scroll_mode: 0 +leftpanel_active_tab: 0 +c2e.IE_apos_workaround: 0 +display_right_margin: 0 +editor_tab_width: 3 +view_statusbar: 1 +fb_show_hidden_f: 0 +name: MekoWeb +view_blocks: 1 +snr_casesens: 0 +c2e.convert_iso: 0 +bookmarks_filename_mode: 0 +wrap_text_default: 0 +opendir: file:///home/david/Data/web +e2c.convert_xml: 1 +default_mime_type: text/plain +view_left_panel: 1 +htmlbar_thumbnailwidth: 300 +fb_show_backup_f: 0 +view_line_numbers: 1 +show_mbhl: 1 +adv_open_matchname: 0 +convertcolumn_horizontally: 0 +snr_recursion_level: 0 +e2c.convert_symbol: 0 +e2c.convert_num: 0 +c2e.convert_special: 0 diff --git a/public/contact.html b/public/contact.html new file mode 100755 index 0000000..e471bb2 --- /dev/null +++ b/public/contact.html @@ -0,0 +1,34 @@ + + + +
++Email: dmeko@LTRR.arizona.edu +
+David M. Meko
+Laboratory of Tree-Ring Research
+University of Arizona
+Tucson, AZ 85721
(520)621-3457 (phone)
+(520)621-8229 (fax)
Home | +Vita | +Course | +Toolbox | +Contact | +
+Laboratory of Tree-Ring Research, , Room 417, Bryant Bannister Tree-Ring Building (Bldg #45B) +
+Email: dmeko@LTRR.arizona.edu
+Phone: (520) 621-3457
+Fax: (520) 621-8229
+Office hours Friday, 1:00-6:00 PM (please email to schedule zoom meeting) +
+
+Back to Top of Page + + +
+The course is 3 credits for University of Arizona students, and 1-3 credits for others. +
+Any time series with a constant time increment (e.g., year, month, day) is a candidate for use in the course. Examples are annual precipitation, monthly mean temperature, and daily cases of COVID-19.
+Matlab version. I update scripts and functions now and then using the current site-license release of Matlab. For 2021, I am still using MATLAB Version 9.5.0.944444 (R2018b). Beware that cripts and functions used in the course may not run on earlier versions of Matlab.
+ +Install the whole Matlab package (includes all toolboxes) when installing from the U of A site license. Not all of the toolboxes are needed, but this is the easiest installation. If you are not using the site license, keep in mind that my scripts and functions make extensive use of four toolboxes: Statistics, Signal Processing, System Identification, and Curve Fitting.
+ + +
A small number of students not at the University of Arizona can also be accommodated through the "iCourse" path descrbed above. +Back to Top of Page + +
+ +The schedule typically allows about two weeks for gathering data and becoming familiar with Matlab. After that, one week (two class periods) is devoted to each of the 12 lessons or topics. Class meets on Tuesday and Thursday. A new topic is introduced on Tuesday, and is continued on the following Thursday. Thursday's class ends with an assignment and a demonstration of running the assignment Matlab script on my sample data. The assignment is due (must be uploaded by you to D2L) before class the following Tuesday. + +
+Any online students not at the University of Arizona are expected to follow the same schedule of submitting assignments as regular students. In the "live online" mode, students have access to recorded zoom lectures. All students have access to D2L for submitting assignments. + + + +
+Once we are into into the assignments on data analysis (after first couple of weeks), the class routine is as follows: + +
+Tuesday +
+In the lightning talk, the student puts one or more figures from the submitted assignment up on the screen, and describes the time series analyzed and at least one finding from the analysis. Goals of this activity, new in spring 2019, are to 1) expose students to a variety of time series, 2) provide experience in communication of time series methods, and 3) give practical experience in the lightning-talk of briefly and concisely describing research. + +
+Thursday +
+The breakout-room discussion is new for Spring Semester 2021. Students are assigned to breakout rooms and to discuss a specific time series question related to the current topic. After 10 minutes, students return, and one student representing a breakout group reports on their discussion. +
+ + +Back to Top of Page + +
+ +Back to Top of Page + + +
+ +You submit assignments by uploading them to D2L before the Tuesday class when the next topic is introduced. Students self-grade their assignments at the beginning of class on Tuesday. I browse the self-graded assignments the next day, assess the writing in the assignment, and may or may not change the student's self-assessed grade. To find out how to access assignments, click assignment files. + + + +
+ +Back to Top of Page + +
+ +The instructor looks over the self-graded assignments the next day, and may subtract up to an additional point for shortcomings in the writing quality (e.g., too long, incomprehensible, many spelling or grammatical errors). + +Assignments, given in class on Thursday, are due (must be uploaded to D2L by you) before the start of class the following Tuesday. The first half hour of Tuesday's meeting period will be dedicated to presentation of a grading rubric, self-assessment of completed assignments, and uploading of self-graded assignments to D2L. This schedule gives you 4 days to complete and upload the assignment to D2L before 9:00 am Tuesday. D2L keeps track of the time the assignment was uploaded, and no penalty is assessed as long as it is uploaded before 9:00 AM on Tuesday of the due date.
+ +A late penalty of 3 points is assessed if the assignment is not submitted to D2L by 9 AM Tuesday. A late penalty of 1 point is assessed if the graded assignment is not uploaded to D2L by 5 AM Wednesday, which is when I begin looking over your self-graded assignments. + +If you have some scheduled need to be away from class (e.g., attendance at a conference), you are responsible for uploading your assignment before 9:00 AM the Tuesday it is due, and for uploading the self-graded version by 10:15 AM the same day. In other words, the schedule is the same as for the students who are in class. If an emergency comes up (e.g., you catch COVID) and cannot do the assignment or assessment on schedule, please send me an email and we will reach some accommodation. Otherwise, the late penalties described above will apply. +
+ +Back to Top of Page + + +
+ +A time series is broadly defined as any series of measurements taken at different times. Some basic descriptive categories of time series are 1) long vs short, 2) even time-step vs uneven time-step, 3) discrete vs continuous, 4) periodic vs aperiodic, 5) stationary vs nonstationary, and 6) univariate vs multivariate. These properties as well as the temporal overlap of multiple series, must be considered in selecting a dataset for analysis in this course. You will analyze your own time series in the course. The first steps are to select those series and to store them in structures in a mat file. Uniformity in storage at the outset is convenient for this class so that attention can then be focused on understanding time series methods rather debugging computer code to ready the data for analysis. A structure is a Matlab variable similar to a database in that the contents are accessed by textual field designators. A structure can store data of different forms. For example, one field might be a numeric time series matrix, another might be text describing the source of data, etc. In the first assignment you will run a Matlab script that reads your time series and metadata from ascii text files you prepare beforehand and stores the data in Matlab structures in a single mat file. In subsequent assignments you will apply time series methods to the data by running Matlab scripts and functions that load the mat file and operate on those structures. +
+ + Assignments
+ Select sample data to be use for assignments during the course
+ Read: (1) Notes_1.pdf, (2) "Getting Started", accessible from the MATLAB help menu
+ Answer: Run script geosa1.m and answer questions listed in the file in a1.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+The probability distribution of a time series describes the probability that an observation falls into a specified range of values. An empirical probability distribution for a time series can be arrived at by sorting and ranking the values of the series. Quantiles and percentiles are useful statistics that can be taken directly from the empirical probability distribution. Many parametric statistical tests assume the time series is a sample from a population with a particular population probability distribution. Often the population is assumed to be normal. This chapter presents some basic definitions, statistics and plots related to the probability distribution. In addition, a test (Lilliefors test) is introduced for testing whether a sample comes from a normal distribution with unspecified mean and variance. +
+ + Assignments
+ Read: Notes_2.pdf
+ Answer: Run script geosa2.m and answer questions listed in the file in a2.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+
+ +Autocorrelation refers to the correlation of a time series with its own past and future values. Autocorrelation is also sometimes called lagged correlation or serial correlation, which refers to the correlation between members of a series of numbers arranged in time. Positive autocorrelation might be considered a specific form of persistence, a tendency for a system to remain in the same state from one observation to the next. The likelihood of tomorrow being rainy is greater if today is rainy than if today is dry. Geophysical time series are frequently autocorrelated because of inertia or carryover in the physical system. The slowly evolving low pressure systems in the atmosphere might impart persistence to daily rainfall. The slow drainage of groundwater reserves might impart correlation to successive annual flows of a river. Stored photosynthates might impart correlation to successive annual values of tree-ring indices. Autocorrelation complicates the application of statistical tests by reducing the number of independent observations. Autocorrelation can also complicate the identification of significant covariance or correlation between time series (e.g., precipitation with a tree-ring series). Autocorrelation can be exploited for predictions: an autocorrelated time series is predictable, probabilistically, because future values depend on current and past values. Three tools for assessing the autocorrelation of a time series are (1) the time series plot, (2) the lagged scatterplot, and (3) the autocorrelation function. +
+ + Assignments
+ Read: Notes_3.pdf
+ Answer: Run script geosa3.m and answer questions listed in the file in a3.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+ +The spectrum of a time series summarizes the partitioning of variance of the series to rapid and gradual fluctuations. Rapid fluctuations are those with short wavelength, or high frequency. Gradual fluctuations are those with long-wavelength, or low-frequency The spectrum by definition describes the variance of the series as a function of frequency or wavelength. The object of spectral analysis is to estimate and study the spectrum. The spectrum contains no new information beyond that in the autocovariance function (acvf), and in fact the spectrum can be computed mathematically by transformation of the acvf. But the spectrum and acvf present the information on the variance of the time series from complementary viewpoints. The acf summarizes information in the time domain and the spectrum in the frequency domain. + +
+ + Assignments
+ Read: Notes_4.pdf
+ Answer: Run script geosa4.m and answer questions listed in the file in a4.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+
+ +Autoregressive-moving-average (ARMA) models are mathematical models of the persistence, or autocorrelation, in a time series. ARMA models are widely used in hydrology, dendrochronology, econometrics, and other fields. There are several possible reasons for fitting ARMA models to data. Modeling can contribute to understanding the physical system by revealing something about the physical process that builds persistence into the series. For example, a simple physical water-balance model consisting of terms for precipitation input, evaporation, infiltration, and groundwater storage can be shown to yield a streamflow series that follows a particular form of ARMA model. ARMA models can also be used to predict behavior of a time series from past values alone. Such a prediction can be used as a baseline to evaluate possible importance of other variables to the system. ARMA models are widely used for prediction of economic and industrial time series. ARMA models can also be used to remove persistence. In dendrochronology, for example, ARMA modeling is applied routinely to generate residual chronologies – time series of ring-width index with no dependence on past values. This operation, called prewhitening, is meant to remove biologically-related persistence from the series so that the residual may be more suitable for studying the influence of climate and other outside environmental factors on tree growth.
+ + Assignments
+ Read: Notes_5.pdf
+ Answer: Run script geosa5.m and answer questions listed in the file in a5.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+
+
+Trend in a time series is a slow, gradual change in some property of the series over the whole interval under investigation. Trend is sometimes loosely defined as a long term change in the mean, but can also refer to change in other statistical properties. For example, tree-ring series of measured ring width frequently have a trend in variance as well as mean. Years ago a time series was typically decomposed into trend, seasonal or periodic components, and irregular fluctuations, and the various parts were studied separately. Modern analysis techniques frequently treat the series without such routine decomposition, but separate consideration of trend is still often required. One of the most frequent question asked about a time series is whether there is significant trend in mean.
+ + Assignments
+ Read: Notes_6.pdf
+ Answer: Run script geosa6.m and answer questions listed in the file in a6.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+
+ +Detrending is the statistical or mathematical operation of removing trend from the series. Detrending is often applied to remove a feature thought to distort or obscure the relationships of interest. In climatology, for example, a temperature trend due to urban warming might obscure a relationship between cloudiness and air temperature. Detrending is also sometimes used as a preprocessing step to prepare time series for analysis by methods that assume stationarity. Many alternative methods are available for detrending. Simple linear trend in mean can be removed by subtracting a least-squares-fit straight line. More complicated trends might require different procedures. For example, the cubic smoothing spline is commonly used in dendrochronology to fit and remove ring-width trend that might not be linear, or not even monotonically increasing or decreasing over time. In studying and removing trend, it is important to understand the effect of detrending on the spectral properties of the time series. This effect can be summarized by the frequency response of the detrending function.
+ + Assignments
+ Read: Notes_7.pdf
+ Answer: Run script geosa7.m and answer questions listed in the file in a7.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+
+ +The estimated spectrum of a time series gives the distribution of variance as a function of frequency. Depending on the purpose of analysis, some frequencies may be of greater interest than others, and it may be helpful to reduce the amplitude of variations at other frequencies by statistically filtering them out before viewing and analyzing the series. For example, the high-frequency (year-to-year) variations in a gauged discharge record of a watershed may be relatively unimportant to water supply in a basin with large reservoirs that can store several years of mean annual runoff. Where low-frequency variations are of main interest, it is desirable to smooth the discharge record to eliminate or reduce the short-period fluctuations before using the discharge record to study the importance of climatic variations to water supply. Smoothing is a form of filtering which produces a time series in which the importance of the spectral components at high frequencies is reduced. Electrical engineers call this type of filter a low-pass filter, because the low-frequency variations are allowed to pass through the filter. In a low-pass filter, the low frequency (long-period) waves are barely affected by the smoothing. +It is also possible to filter a series such that the low-frequency variations are reduced and the high-frequency variations unaffected. This type of filter is called a high-pass filter. Detrending is a form of high-pass filtering: the fitted trend line tracks the lowest frequencies, and the residuals from the trend line have had those low frequencies removed. A third type of filtering, called band-pass filtering, reduces or filters out both high and low frequencies, and leaves some intermediate frequency band relatively unaffected. +In this lesson, we cover several methods of smoothing, or low-pass filtering. We have already discussed how the cubic smoothing spline might be useful for this purpose. Four other types of filters are discussed here: 1) simple moving average, 2) binomial, 3) Gaussian, and 4) windowing (Hamming method). Considerations in choosing a type of low-pass filter are the desired frequency response and the span, or width, of the filter. + +
+ + Assignments
+ Read: Notes_8.pdf
+ Answer: Run script geosa8.m and answer questions listed in the file in a8.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+
+ +The Pearson product-moment correlation coefficient is probably the single most widely used statistic for summarizing the relationship between two variables. Statistical significance and caveats of interpretation of the correlation coefficient as applied to time series are topics of this lesson. Under certain assumptions, the statistical significance of a correlation coefficient depends on just the sample size, defined as the number of independent observations. If time series are autocorrelated, an effective sample size, lower than the actual sample size, should be used when evaluating significance. Transient or spurious relationships can yield significant correlation for some periods and not for others. The time variation of strength of linear correlation can be examined with plots of correlation computed for a sliding window. But if many correlation coefficients are evaluated simultaneously, confidence intervals should be adjusted (Bonferroni adjustment) to compensate for the increased likelihood of observing some high correlations where no relationship exists. Interpretation of sliding correlations can be also be complicated by time variations of mean and variance of the series, as the sliding correlation reflects covariation in terms of standardized departures from means in the time window of interest, which may differ from the long-term means. Finally, it should be emphasized that the Pearson correlation coefficient measures strength of linear relationship. Scatterplots are useful for checking whether the relationship is linear.
+ + Assignments
+ Read: Notes_9.pdf
+ Answer: Run script geosa9.m and answer questions listed in the file in a9.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+
+Lagged relationships are characteristic of many natural physical systems. Lagged correlation refers to the correlation between two time series shifted in time relative to one another. Lagged correlation is important in studying the relationship between time series for two reasons. First, one series may have a delayed response to the other series, or perhaps a delayed response to a common stimulus that affects both series. Second, the response of one series to the other series or an outside stimulus may be smeared in time, such that a stimulus restricted to one observation elicits a response at multiple observations. For example, because of storage in reservoirs, glaciers, etc., the volume discharge of a river in one year may depend on precipitation in the several preceding years. Or because of changes in crown density and photosynthate storage, the width of a tree-ring in one year may depend on climate of several preceding years. The simple correlation coefficient between the two series properly aligned in time is inadequate to characterize the relationship in such situations. Useful functions we will examine as alternative to the simple correlation coefficient are the cross-correlation function and the impulse response function. The cross-correlation function is the correlation between the series shifted against one another as a function of number of observations of the offset. If the individual series are autocorrelated, the estimated cross-correlation function may be distorted and misleading as a measure of the lagged relationship. We will look at two approaches to clarifying the pattern of cross-correlations. One is to individually remove the persistence from, or prewhiten, the series before cross-correlation estimation. In this approach, the two series are essentially regarded on equal footing. An alternative is the systems approach: view the series as a dynamic linear system -- one series the input and the other the output -- and estimate the impulse response function. The impulse response function is the response of the output at current and future times to a hypothetical pulse of input restricted to the current time.
+ + Assignments
+ Read: Notes_10.pdf
+ Answer: Run script geosa10.m and answer questions listed in the file in a10.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+
+
+ +Multiple linear regression (MLR) is a method used to model the linear relationship between a dependent variable and one or more independent variables. The dependent variable is sometimes also called the predictand, and the independent variables the predictors. MLR is based on least squares: the model is fit such that the sum-of-squares of differences of observed and predicted values is minimized. MLR is probably the most widely used method in dendroclimatology for developing models to reconstruct climate variables from tree-ring series. Typically, a climatic variable is defined as the predictand and tree-ring variables from one or more sites are defined as predictors. The model is fit to a period -- the calibration period -- for which climatic and tree-ring data overlap. In the process of fitting, or estimating, the model, statistics are computed that summarize the accuracy of the regression model for the calibration period. The performance of the model on data not used to fit the model is usually checked in some way by a process called validation. Finally, tree-ring data from before the calibration period are substituted into the prediction equation to get a reconstruction of the predictand. The reconstruction is a "prediction" in the sense that the regression model is applied to generate estimates of the predictand variable outside the period used to fit the data. The uncertainty in the reconstruction is summarized by confidence intervals, which can be computed by various alternative ways.
+ + Assignments
+ Read: Notes_11.pdf
+ Answer: Run script geosa11.m (Part 1) and answer questions listed in the file in a11.pdf
+What to Know
+
+Back to Top of Page
+
+
+
+
+
+ +Regression R-squared, even if adjusted for loss of degrees of freedom due to the number of predictors in the model, can give a misleading, overly optimistic view of accuracy of prediction when the model is applied outside the calibration period. Application outside the calibration period is the rule rather than the exception in dendroclimatology. The calibration-period statistics are typically biased because the model is "tuned" for maximum agreement in the calibration period. Sometimes too large a pool of potential predictors is used in automated procedures to select final predictors. Another possible problem is that the calibration period itself may be anomalous in terms of the relationships between the variables: modeled relationships may hold up for some periods of time but not for others. It is advisable therefore to "validate" the regression model by testing the model on data not used to fit the model. Several approaches to validation are available. Among these are cross-validation and split-sample validation. In cross-validation, a series of regression models is fit, each time deleting a different observation from the calibration set and using the model to predict the predictand for the deleted observation. The merged series of predictions for deleted observations is then checked for accuracy against the observed data. In split-sample calibration, the model is fit to some portion of the data (say, the second half), and accuracy is measured on the predictions for the other half of the data. The calibration and validation periods are then exchanged and the process repeated. In any regression problem it is also important to keep in mind that modeled relationships may not be valid for periods when the predictors are outside their ranges for the calibration period: the multivariate distribution of the predictors for some observations outside the calibration period may have no analog in the calibration period. The distinction of predictions as extrapolations versus interpolations is useful in flagging such occurrences.
+ + Assignments
+ Read: Notes_12.pdf
+ Answer: Run script geosa11.m (Part 2) and answer questions listed in the file in a12.pdf
+What to Know
+
+ +
+ +Powerpoint lecture outlines & miscellaneous files. Downloadable file other_Stale.zip has miscellaneous files used in lectures from the previous offering of the course. Included are Matlab demo scripts, sample data files, user-written functions used by demo scripts, and powerpoint presentations, as pdfs (lect1a.pdf, lect1b.pdf, etc.) used in on-campus lectures. Students taking the course this semester should not use other_Stale.zip, but instead get the file "other.zip" from D2L contents. I update other.zip over the semester, and add the presentation for the current lecture within a couple of days after that lecture is given. File other.zip for this semester does not exist till after the first lecture, and then is augmented after each lecture. At the end of the semester I revise the online-available other_Stale.zip.
+ + +
+
+Back to Top of Page + + +
Home | +Vita | +Course | +Toolbox | +Contact | +
Home | +Vita | +Course | +Toolbox | +Contact | +
Dave Meko |
+|
+ | |
Projects |
+
+
+|
Time Series Course |
+|
Toolbox |
+|
Vita |
+|
Contact |
+
+ + | +
+ Considered taking a core, but weighed that against a stay in Soledad Prison, just over the horizon in the other direction. + + |
+
+
+
+
Home | +Vita | +Research | +GEOS595E | +Toolbox | +
+ +
Toolbox | +||
Description | Functions | + |
Home | +Vita | +Course | +Toolbox | +Contact | +
The following contribution, from Simone Alin, describes
Hoaglin et. al's +"Letter Values" method of data summary.
+ +
LETTER VALUES
The "letter values" referred to by Hoaglin et al.
+in the assigned reading
consist of an exploratory way of summarizing the spread and
+location
(median) of values in a data set. The authors of this book prefer this
system of summary statistics for exploratory data analysis
+because the
letter values are not as prone to the effects of outlying
+values as are the
mean and variance, although the letter values do focus more
+on the tails
than the central part of a distribution. In many ways, letter value
summary statistics are similar to those we discussed for box
+plots. I will
give a brief synopsis of the letter value system, using a
+simple data set.
The math behind it is quite simple, and in the interest of
+being succinct, I
will just give a brief description of the math necessary for
+figuring out
the Hoaglin et al. reading (those who are interested in the
+details are
referred to chapter 2 of the same book).
Assigning letter values to a simple batch of data entails
+finding the
median, the fourths, and the extremes. First, the data must be ordered from
smallest to largest.
+The median is simply the middle data point (in terms
of rank), and the extremes are just the highest and lowest
+values. So far,
this is pretty self-explanatory. To determine the fourths, one essentially
finds two more medians, these ones between the median of the
+full data set
and either extreme.
+For a simple data set such as this one:
i= 1 2
+3 4 5 6 7
+8 9 10 11
x(i)= 5 17
+23 30 42
+51 56 61
+69 71 74
(note: that should be x sub(i), but I can't do that on my
+email account)
-the median would be the 6th value (x(6)=51)
-the extremes would be those values in the 1st and 11th
+ranks (5 and 74)
-the fourths would fall between the 3rd and 4th and the 9th
+and 10th (for
this we use linear interpolation to get (23+30)/2=26.5 and
+(69+71)/2=70)
When one has a larger data set, it can be desirable to have
+further
descriptive statistics.
+We already know that 50% of our measurements lie
between the fourths (or alternately, that 1/4 of the
+measurements lie in
either tail).
+Additional "letter values" may be assigned, and they always
further subdivide each tail by two. The next one would be eighths (then
sixteenths, etc.), and here too, one simply divides both
+tails into two
equal-sized pools of data points. This tells the experimenter the values
outside of which the largest and smallest eighths of the
+measured values
occur.
Okay, so you must be thinking "what does this have to
+do with 'letter
values' though?"
+Right. The creator of this
+system decided that M would
represent median, F would represent fourths, and from there
+on down the
letters would work backwards from F, wrapping backwards
+through Z, Y, X,
etc., if necessary.
+Perhaps the following table will lend some clarity:
Tag Tail Area
M 1/2=0.5
F 1/4=0.25
E 1/8=0.125
D 1/16=0.0625
C 1/32=0.03125
and so on... (X -> 1/1024=0.0009765625)
So in terms of decoding the Hoaglin et al. reading, you need
+to know how
letter values are computed and how the information is
+displayed in tables.
For computing the letter values, the ordered measurements
+are assigned
numerical values (1,2,3,...n) BOTH from smallest to largest
+and from largest
to smallest. These
+are their upward and downward ranks, respectively. The
depth of a data point in a batch is the smaller of these two
+ranks. The
depth of the median is (n+1)/2, the depths of the fourths
+are ([depth of
median] +1)/2, or more generally each depth is ([previous
+depth] +1)/2. Now
to understand how this information is displayed in tables,
+please see Table
4-1 in Hoaglin et al..
Some of the first lines are:
# 994
M 497.5 3480
F 249 2412 3678 4944
etc.
The chief elements here are:
# 994 - this indicates the total number of measurements from
+which the
letter summary values are drawn (i.e., n=994)
M 497.5 - this means that the median is at measurement
+#497.5
3480 - this is the
+value of the median
F 249 - the fourths are located at measurement #249 from the
+top _and_ from
the bottom of the list
2412 and 4944 - these are the values of the fourths
3678 - this is the value of the "mid-summary"
+which is the topic of
discussion in part of the assigned reading (i.e., "the
+average of the two
corresponding letter values" or the average of 2412 and
+4944 in this case)
+ crn2vec2: .crn file to column vectors of index, sample size, and year + [x,s,yr]=crn2vec2(pf1) or [x,s,yr]=crn2vec2; + Last revised 2009-8-20 + ++ Reads a ".crn" file of tree-ring indices in ITRDB format and converts + the indices and associated data into vectors that can be used in Matlab. + Input file must be formatted as in ITRDB requirements for crn2vec2 to work. + +
+*** IN + + pf1 (1 x ?)s path and file name of .crn file + (e.g., 'c:\work\mt100.crn'); + alternatively, can call with no input arguments and be prompted to + point to the .crn file + +*** OUT + + x (mx x 1)r tree-ring index, mx years + s (mx x 1)r sample size (number of cores) in each year + yr (mx x 1)i year vector for x and s + +*** REFERENCES -- None + +*** UW FUNCTIONS CALLED -- None + +*** TOOLBOXES NEEDED -- None + ++
+ rwl2tsm: ring-width list (rwl) file to time series matrix + [X,yrX,nms,T]=rwl2tsm(pf1) + Last revised 2009-9-4 + ++ Ring-width list (rwl) file to time series matrix. + Reads an rwl file and puts all its ring-width series into a + time series matrix X with a corresponding year vector yrX. The columns + of X correspond to the individual width series in the order they were + stored in their rwl file. The row-cell of string names, nms, has the + core ids of the series in X, in the same order as the columns of X. The + time series matrix X is filled out with NaNs where data for individual + series is missing.
+ + +
+*** IN + + pf1 (1 x ?)s+path and filename of input rwl file(see notes) (e.g., + 'c:\data\'az023.rwl'); if not included, you are prompted to point + to the file + +*** OUT + + X (mX x nX)r time series matrix, mX years and nX columns + yrX (mX x 1)i year vector for X + nms {size(X,2) x 1}s col-cell of names of series in X + T (nX x 3)i column, first and last years of valid data in each series of X + +*** REFERENCES --- none + +*** TOOLBOXES NEEDED -- none + +*** UW FUNCTIONS CALLED + + rwlinp + sov2tsm3 + +
+ grplot: stacked time series plots of ring-width series from rwl file + grplot; + Last revised 2008-5-2 + ++ Stacked time series plots of ring-width series from rwl file. Up to 8 series + plotted per figure windowm, or printed page. Intended to help in deciding on curve-fits + for detrending in programs such as ARSTAN. Can process single rwl file (interactive + mode), or multiple rlw files(batch mode). Series can be plotted in order as encountered + in the rwl file, or re-ordered by age. Series for each page can also be specified if + user first stores a pointer variable in a .mat file beforehand. + +
+*** IN + + No input arguments + + User prompted for various options, and to point to files for input and + output + +*** OUT + + No output args. + + Plots of time series appear in one or more figure windows. + + If your input ring-width data is from an .rwl file(s), an ascii .txt file with name + xxx_list.txt appears in the working directory. "xxx" is the part of the + rwl filename before the period. Thus, if "az024.rwl" is your input, + "az024_list.txt" is produced. This .txt file is for surveying file + contents and lists each core id and first and last years' measurments + + Other file output is optional, and consists of one or more postscript (.ps) files, one for + each input .mat ring-width file. The user can specify the filename in interactive + mode. In batch mode, the .ps suffix is assigned to the same prefix as the input + .mat file containing the ring-width file. + + In "single" mode you can view the figure windows as the program runs and afterwards. + In "batch" mode, figure windows are not saved, but are overwritten from on + ring-width file to ring-width file. But in batch mode, have the plots stored in + .ps files for later plotting. + +*** REFERENCES -- none + +*** UW FUNCTIONS CALLED + + eightplt - utility function that plots up to 8 sets of axes on page + rwlinp - read rwl file; store data as indexed vector (strung-out-vector) and metadata + trailnan --- misc utility + +*** TOOLBOXES NEEDED -- none + ++
+ rwlinp: read rwl-file data and store in a .mat file + [pf2,X,yrs,nms]=rwlinp(pf1,path1,path2); + Last revised 2009-9-28 + ++ Read rwl-file data and store in a .mat file. + Utility function to read an rwo file and store the data in an accessible + form for MATLAB functions. Data stored as "index-vector", which is each + series one after another in a column vector.
+ + +
+*** INPUT (optionally 0-3 args) + + pf1 (1 x ?)s+combined path and filename of .rwl file + example: 'd:\jack\data\az033.rwl' + path1 (1 x ?)s path to the .rwl file. If this arg is passed, means + that pf1 is the filename only + Example: 'd:\jack\data\' as path1, and 'az033.rwl' as pf1 + path2 (1 x ?)s , only if also have pf1 and path1>: path + for the output .mat files and .tmp files. If no path2 as argument, + default is to the same directory as the .rwl files are in + + Input arguments are optional. There can be 0,1, 2, or 3 input arguments: + None: user prompted to clck on names of input and output files + One: combined path & filename for the .rwl file + Two: first arg is the filename of the .rwl file, and the second is the path + Three: path for the output .mat file; this option is convenienent when user + wants .mat output files to go to different directories that that + of the source .rwl files + + +*** OUTPUT + + pf2 (1 x ?)s path & filename of output .mat file + X (? x 1)i column vector of ringwidths stored one core after another + in units of hundredths of mm + yrs (? x 3)i start year, end year, and row index of start year of each + core's ring-width series in X + nms {?x1}s ids of each core + + Depending on the number of input arguments, the output .mat + file goes to a specified filename or the user is prompted to enter + it. The .mat file contains X, yrs and nms, as well as: + + cmask (? x 1)i mask for core; 1==do not mask, 0==mask. cmask is created as all 1's + by rwlinp. Subsequent functions may change cmask as cores are deleted from analysis. + Fwhen {8 x 4}s history of fits for the data set. Casual user need not be concerned with this + or cmask. Fwhen tracks what was the source and target data file, and what and when things were + done to the data. + + A .tmp ascii file is also produced listing the core id, and first and last years' + data for each core. This file intended for checking that rwlinp.m + indeed stores the ring widths properly + + +*** REFERENCES --none + +*** UW FUNCTIONS CALLED + + intnan.m -- checks for internal NaNs in a vector + trailnan.m -- lops off trailing NaNs from a vector + +*** TOOLBOXES NEEDED -- none + +
+ sov2tsm: strung-out-vector to time series matrix, with names cell + [X,yrX,nms]=sov2tsm3(v,YRS,nms,jpick,tends); + Last revised 2008-4-29 + ++ Strung-out-vector (SOV) to time series matrix, with names cell. + Low-level function to convert ring-width data previously read from an rwl + file into MATLAB by rwlinp in to a time series matrix. This function + called by rwl2tsm. + +
+*** IN + + v (mv x 1)r strung-out-vector (sov) of one or more time series + YRS(nsers x 3)i start year, end year, and starting row index of + each series in v, where nsers is the number of series in v + nms (nsers x ?)s or {nsers x 1}s names of series in v + jpick(? x 1)i or [] index to rows of YRS specifying which series in + v to include in the tsm. For example, jpick=([1 3 4 7])' would pick + only those four series. The series numbers correspond + to rows of YRS. See Notes. + tends(1 x 2)i, or [] first last year of desired tsm X. + + +*** OUT + + X (mX x nX)r time series matrix, mX years and nX columns + yrX (mX x 1)i year vector for X + nms {size(X,2) x 1}s names of series in X + +*** REFERENCES --- none + +*** TOOLBOXES NEEDED -- none + +*** UW FUNCTIONS CALLED -- none + ++
+ trailnan: remove any trailing NaN's from a vector + x=trailnan(x); + Last revised: 2009-10-05 + ++ Utility function used by rwlinp.m and other functions. Most users + will not need to call trailnan in their own code + +
+*** INPUT + + x (1 x ?)r or (? x 1)r vector, usually a time series + +*** OUTPUT + + x (? x 1)r the same vector, but with any trailing NaN's removed + +*** REFERENCES -- none +*** UW FUNCTIONS CALLED -- none +*** TOOLBOXES NEEDED -- none + + ++
+ eightplt: Plot up to eight plotes of ring width per page; utility called by grplot.m + eightplt(datin); + Last revised 2009-9-28 + ++ Plot up to eight plotes of ring width per page; utility called by + grplot.m. You will not typically call eightplt yourself. + + +
+*** IN + datin{} -- contents described later + +*** OUT + No output args + + +*** REFERENCES -- none + +*** UW FUNCTIONS CALLED -- none + +*** TOOLBOXES NEEDED -- none + ++
+ acf: autocorrelation function and approximate 95% confidence bands + [r,SE2,r95]=acf(x,nlags,k); + Last revised 2008-4-29 + ++ Autocorrelation function and approximate 95% confidence bands. Options available + for plotting and for alternative algorithms of calculation. + +
+*** INPUT ARGUMENTS + + x (m x 1) time series, length m + nlags (1 x 1)i number of lags to compute acf to + k (1 x 2) options;++ k(1) -- plotting + ==1 No plotting within function; get this also if no k input + argument + ==2 Function makes stem plot of acf with CI of +-2 times large-lag + standard error + k(2) -- alternative algorithms (see Notes) + ==1 Uses global means, not means computed separately for subsets of + observations, for departures. Computed covariance as sum of products of first k + values and last k values from the the mean. Then standardizes so + that lag 0 autocorrelation is 1.0 by dividing the vector g by g(1), + where g is vector of sums of cross-products at lags 0,1,2,... + ==2 Uses subset means and standard deviations in computations + +*** OUTPUT ARGUMENTS + + r (1 x nlags)r acf at lags 1 to nlags + SE2 (1 x nlags)r two times the large-lag standard error of r + r95 (1 x 1)threshold sample r required for significance in one-tailed test at + 0.05 alpha (95% signficance). Intended for quick check for positive first-order + autocorrelation, the most common form of persistence in many natural. + If the sample r(1) does not exceed r95, cannot reject H0 that the + population r(1) is zero, at 0.05 alpha. + + + +*** REFERENCES + + Large-lag standard error after Box, G.E.P., and Jenkins, G.M., 1976, Time series + analysis: forecasting and control: San Francisco, Holden Day. + + Confidence interval for r(k) from Haan, C.T., 2002, Statistical methods in Hydrology, + second edition: Ames, Iowa, Iowa State University Press. + + Computation formulas for sample r from + Wilks, D.S., 1995, Statistical methods in the atmospheric sciences: Academic Press, 467 p. + + +*** UW FUNCTIONS CALLED -- none + + +*** TOOLBOXES NEEDED -- none + + +
+ whit1: fit AR model to a time series using modified AIC criterion, returning model information and residuals + [e,k1,vrat,arcs] = whit1(y,nhi,k2); + Last revised 2008-4-29 + ++ Fit AR model to a time series using modified AIC criterion, returning model information and residuals + You specify the highest order AR model to consider. Models up to that order are + fit, and the modified (small sample) Akaike Information Criterion (AIC) is used to pick the best model. + +
+*** IN ********************** + + y (my x 1)r time series, vector; NaNs not allowed + nhi (1 x 1)i highest AR order to consider (if k2==1), or the only + AR order model to try fitting (if k2=2) + k2 (1 x 2)i options + k2(1) for order selections + ==1 fit models of order 1 to nhi + ==2 fit model of order nhi only + k2(2) for over-riding selection of null (order = 0) model + ==1 if modified AIC computed from original time series with model order 0 is lower than + any of the entertained models, return the null model (see notes) + ==2 accept the lowest AIC model even if its AIC is not as low as that of the null model + +*** OUT ************************** + + e (my x 1)r AR residuals, with mean added back in; or, if null model, the + original series y + k1 - the order of the AR model deemed best by the AIC, or 0 if null model and k2(2)==1 + vrat - the ratio of variance of AR residuals to variance of original time series y (see notes) + arcs the ar coefs and their two-standard errors in a two-row array; row 1 has + the coefficients; row two has 2*standard error of the coefficients; + arcs==[] if k2==1 and null model has been selected; + +*** REFERENCES + + The loss function and AIC are discussed in Ljung, L. 1995. System identification + toolbox; for use with MATLAB, The MathWorks, Inc., p. 3-46. + + Akaike H. (1974) A new look at the statistical model identification. IEEE Trans. Autom. Control AC-19, 716-723. + Hurvich C. M. and Tsai C. (1989) Regression and time series model selection in small samples. Biometrika 76, 297-307. + + +*** UW FUNCTIONS CALLED + + akaike + + +*** TOOLBOXES NEEDED -- system identification + ++
+ akaike: Akaike information criterion for order of best ARMA model + c=akaike(V,N,m); + Last revised 2004-2-17 + ++ Akaike information criterion for order of best ARMA model + +
+*** INPUT ARGUMENTS + + V (1 x 1)r loss function, or variance of model residuals + N (1 x 1)i number of observations + m (1 x 1)i number of explanatory variables, or sum of AR and MA orders + +*** OUTPUT ARGUMENTS + + c (1 x 2)r Akaike information criterion, with and without correction for small sample bias (see + notes); c(1) == with correction; c(2)= without correction + +*** REFERENCES + + Akaike H. (1974) A new look at the statistical model identification. IEEE Trans. Autom. Control AC-19, 716-723. + Hurvich C. M. and Tsai C. (1989) Regression and time series model selection in small samples. Biometrika 76, 297-307. + + +*** UW FUNCTIONS CALLED -- none + + +*** TOOLBOXES NEEDED + + System identification + + ++
+ intnan: check for internal NaN in a vector + m=intnan(x) + Last revised 2008-4-29 + ++ Utility function for checking whether a vector has an internal, or imbedded, NaN + +
+*** INPUT + + x(? x 1)r or (1 x ?)r -- a time series + +*** OUTPUT + + m(1 x 1)L 1 if x has imbedded NaN, 0 otherwise + +*** REFERENCES -- none + + +*** UW FUNCTIONS CALLED -- none + +*** TOOLBOXES NEEDED -- none + ++
+ rwchng: scaled values or scaled first-difference of a time series + rwchng(x,k); + Last revised 2003-09-10 + ++ Scaled values or scaled first-difference of a time series. + Written as utility function for skelcrn. + The scaled first-difference ring-width or index time series is the + change in the series from the previous year expressed as a decimal fraction + of the local level of the series. The local level is the values of the series + smoothed by a 9-weight Gaussian filter.
+ + +
+*** INPUT ARGS + + x (mx x 1) input time series, a ring-width series or index series + k (1 x 1)i option for first differencing of time series (see notes) + ==1 no first differencing ("local" mode in skelcrn) + ==2 first differencing + +*** OUTPUT ARGS + + y (my x 1) scaled first difference of departures + my=mx-1 + +*** REFERENCES -- none + +*** UW FUNCTIONS CALLED -- none + +*** TOOLBOXES NEEDED + signal processing + ++
+ rwread3: reads a single .rw file + [X,guy,day,pf1]=rwread3(path1,file1); + Last revised 1999-2-15 + ++ Reads a single .rw file + A low-level function called by skelcrn and other + UW functions. rwread3.m reads a file of data in ".rw" format, + and stores the result in a matrix with the year as column 1 and + ring width in column 2 + +
+*** INPUT *********************** + + path1 (1 x ?)ch path to .rw file + file1 (1 x ?)ch filename of .rw file + + +*** OUTPUT ************************ + + X (mX x 2)r year in col 1, ring width in col 2 + guy (1 x ?)ch initials of measurer + day (1 x ?)ch day measured + pf1 (1 x ?)ch path\filename of the .rw file + +*** REFERENCES -- none +*** UW FUNCTIONS CALLED -- none +*** TOOLBOXES NEEDED -- none ++
+ skelcrn: skeleton plot from .crn file or .rw file + skelcrn; + Last revised 2009-9-30 + ++ Draws a skeleton plot from chronology indices in a .crn "ITRDB-format" + file; a measured ring-width series in a .rw file; or a two-column time series + matrix with the year in column 1. + The plot is scaled in the x-direction to 100 yr per 20 cm to match + with manually drawn plots. The 10% of largest values (index or ring width) + indices in each century are marked by small squares on the skeleton plot. + For .crn input, a plot of sample size (number of cores, usually) against + time is also produced.
+ + Optionally a ring can be compared to just the flanking rings (adjacent), or + to all rings within the local region (local). In "adjacent" mode, ring widths + are first-differenced as an intermediate step to emphasize change from + previous year. In "local" mode, no first-differencing is done. With the "local" approach, + the comparison is centered (comparing with rings before and after). With the + adjacent, the comparison can be either centered or backwards (comparing the ring with just the + preceding ring). + + A user-prompted scaling factor allows for stretching or shrinking the x axis + so that the output of your particular printer exactly matches the scale of manual + skeleton plots. + +
+*** IN + + No input arguments. + User is prompted for three things: + 1) type of input (.crn file or .rw file) + 2) local or adjacent mode + 2) centered or backwards approach to building the plot + 3) scaling factor (see notes) + +*** OUT + + No output arguments + + Plots are shown in figure windows on the screen. DO NOT WORRY if when you click on + a figure window you do not see the entire plots. The printouts will stil be OK. + To get a printout, steps depend on your version of matlab. With MATLAB + Version 7.5.0.342 (R2007b)follow these steps: + '1 Click on a desired figure window to make that window current',... + '2 Click File/PrintPreview from the Figure-Window menu',... + '3 Click "Center" option -- rectangle at left center of menu... + '4 Press "Print" from the Print Preview window',... + '6 Press "OK" from the Print Window'}; + + Skelcrn is not likely to work with earlier versions of Matlab, as this version of skelcrn was adapted + to use some new calling conventions. + +*** REFERENCES + + Stokes, M.A., and Smiley, T.L., 1996, An Introduction to Tree-ring Dating: + The University of Arizona Press, Tucson, p. 73 pp. + +*** UW FUNCTIONS CALLED + + filter1.m -- apply filter to time series + rwchng.m -- transforms ring width + rwread3.m -- reads a .rw file + crn2vec2 -- reads a .crn file and converts data to column vector + wtsgaus -- gets Gaussian filter weights + + +*** TOOLBOXES + + statistics + signal processing + + ++
+ wtsgaus: weights for gaussian filter with specified frequency response + b=wtsgaus(p,N); + Last revised 2003-3-14 + ++ Weights for gaussian filter with specified frequency response + Specify te wavelength for the 0.50 respons, and the length of series, get + the coefficients, or weights + +
+*** INPUT + + p (1 x 1)i period (years) at which filter is to have amp frequency response of 0.5 + N (1 x 1)i length of the time series (number of observations) + +*** OUTPUT + + b (1 x n)r computed weights + + +*** REFERENCES + + WMO 1966, p. 47 + +*** UW FUNCTIONS CALLED -- NONE +*** TOOLBOXES NEEDED -- stats + ++
+ filter1: filter a time series, keeping correct phase and adjusting for end effects + [y,ty]=filter1(x,tx,b,k); + Last revised 2003-10-31 + ++ Filter a time series, keeping correct phase and adjusting for end effects + +
+*** INPUT + + x (mx x 1) time series, no NaN allowed + tx (mx x 1) time variable + b (1 x nb) filter weights -- must be odd number of weights + k (1 x 1) option for end effects + 1 - truncate (i.e., use only the observed data) + 2 - reflect about endpoints -- coded, but not rigorously checked out yet + 3 - extend with mean of x + 4 - extend with median of x + + +*** OUTPUT ************************* + + y (my x 1) filtered version of x. my is fewer than mx if k=1 + ty (my x 1) time variable corresponding to y + +*** REFERENCES + + Mitchell, J.M., Jr., Dzerdzeevskii, B., Flohn, H., Hofmeyr, + W.L., Lamb, H.H., Rao, K.N., and Wallen, C.C., 1966, Climatic change, + Technical Note 79: Geneva, World Meteorological Organization. + +*** UW FUNCTIONS NEEDED -- NONE + +*** TOOLBOXES NEEDED + + signal processing + + ++
+ climgram: box-plot graphs showing monthly distributions of precipitation and temperature + [mpcp,npcp,mtmp,ntmp]=climgram(P,T,txtin,windno,koptcolor); + Last revised 2009-10-04 + ++ Box-plot graphs showing monthly distributions of precipitation and temperature. + A figure with two panels, each having 12 box plots, is drawn. The top plot + shows the distribution of monthly precipitation; the bottom plot shows the + distribution of monthly temperature. The plots convey the same information + as the conventional "climatogram", or "climograph", but dislay the variability as + well as the mean level of the monthly climate variables. + +
+*** IN + + P (? x 13)r monthly precipitation matrix, year in col 1 + T (? x 13)r monthly temperature matrix, year in col 1 + txtin{} -- Labeling for plots + {1} (1 x ?)s title for plot (will go above top plot). Say, + 'Climatogram for Rapid City' + {2} (1 x ?)s y axis label for pcp Example + 'Precipitation (mm)' + {3} (1 x ?)s y axis label for tmp + windno: window number for plot + koptcolor (1x1)i color option + ==1 color + ==2 B/W + +*** OUT + + mpcp (1 x 12)r means for pcp + npcp (1 x 12)n number of years in sample + mtmp (1 x 12)r means for tmp + ntmp (1 x 12)n number of years in sample + + +*** REFERENCES -- NONE + +*** UW FUNCTIONS CALLED --NONE + +*** TOOLBOXES NEEDED + stats + ++
+ figsize: figure-window pixel positions from specified fractional screen-width and screen-height + [cL,cB,cW,cH]=figsize(fwidth,fheigth); + Last Revised 2009-10-04 + ++ Figure-window pixel positions from specified fractional screen-width and screen-height. + You want to set position property of figure window such that figure window + covers a specified fraction of screen regardless of how many pixels + are in the x and y directions on your computer. + +
+*** INPUT + + fwidth (1 x 1)r desired figure width as decimal fraction of screen width + fheight (1 x 1)r desired figure height as decimal fraction of screen height + +*** OUTPUT + + cL (1 x 1)i left position as pixel + cW (1 x 1)i width in pixels + cB (1 x 1)i bottom position as pixel + cH (1 x 1)i height in pixelsesult -- structure of results + +*** REFERENCES --- none + + +*** UW FUNCTIONS CALLED -- none + +*** TOOLBOXES NEEDED -- none + ++
+ textcorn: Add annotation text to any corner of a figure + textcorn(txt,pos,xoffset,yoffset,fsz); + Last Revised 2009-10-05 + ++ Add annotation text to any corner of a figure. + Control over which corner, how far from axes, and font size. One common + use is to label subplots as "A", "B", etc. + + +
+*** INPUT + + txt (1 x ?)s or {}s = text of label + pos (1 x 2)s position (one of these: "UL","UR","LL" or "LR") + xoffset (1 x 1)r how far text is from left or right axis, as percentage + of XLim axis property + yoffset (1 x 1)r how far text is from bottom or top axis, as percentage + of YLim axis property + fsz (1 x 1)i font size + +*** OUTPUT + + No output, just puts text on the figure + + +*** REFERENCES --- none + +*** UW FUNCTIONS CALLED -- none + +*** TOOLBOXES NEEDED -- none + + ++
+ nonan1: longest continuous block of a time series matrix without missing data + [yrgo2,yrsp2]=nonan1(X,yr); + Last revised: 2009-10-05 + ++ Longest continuous block of a time series matrix without missing data. + Finds the longest continuous block of rows of a matrix for which none of + the data is NaN. Useful in selecting period for calibration of + tree-ring and climate series. + +
+*** IN + + X (mX x nX)r time series matrix, mX observations and nX variables + yr (mX x 1)i year vector corresponding to X + + +*** OUT + + yrgo2 (1 x 1)i start year of period without any NaN + yrsp2 (1 x 1)i end year ... + + +*** REFERENCES -- none +*** UW FUNCTIONS CALLED -- none +*** TOOLBOXES NEEDED -- none + + ++
+ trimnan: trim any leading and trailing NaNs from a vector time series + [x,yrx]=trimnan(x,yrx); + Last revised: 2009-10-05 + ++ Trim any leading and trailing NaNs from a vector time series. + +
+*** INPUT + + x: time series, a col-vector or row-vector + yrx: year vector, same size as x + + +*** OUTPUT + + x: trimmed vector of data + yrx: trimmed year vector for ouput x + + +*** REFERENCES -- none + +*** UW FUNCTIONS CALLED + + trailnan + + +*** TOOLBOXES NEEDED -- none + + ++
+ mafilt1: evenly-weighted moving average of an annual time series + [y,yry]=mafilt1(x,yr,m,kopt); + Last revised 2009-10-05 + ++ Evenly-weighted moving average of an annual time series. + Option for assigning smoothed value to ending year or middle year of the + moving window + +
+*** INPUT ARGS + + x (mx x 1)r time series + yr (mx x 1)i year vector for x + m (1 x 1)i length of moving average (e.g.,number of weights) + kopt (1 x 1)i options + kopt(1) which year of the m-year period to assign smoothed value + ==1 central year ==2 ending year + + +*** OUTPUT ARGS + + y (?x1) smoothed time series + yry (? x1) years for y + + +*** REFERENCES -- NONE +*** UW FUNCTIONS CALLED -- NONE +*** TOOLBOXES USED -- NONE + + ++
+ c132tss: Thirteen-column monthly climate matrix to time-series structure + function Result=c132tss(D); + Last Revised 2009-10-14 + ++ Thirteen-column monthly climate matrix to time-series structure. + Reorganized the 13 cols (year and jan-to-dec data) into 3 columns -- + year, month, data. Reorganized matrix is stored as a field in structure + Result. The other fields, designed to hold metadata (e.g., longitude, + latitude) are not dealt with by c132tss, whose sole function is + reoroganization of the data matrix. + +
+*** INPUT + + D (mD x nD)r 13-col climate monthly matrix, year as col 1, Jan-Dec as + other cols + +*** OUTPUT + + Result -- structure of results + .tsm: 3-col matrix (year, month, data value) of reorganized input D + + .... all the other fields (below) are set to dummy values (see notes) + Result.units: units of data--> 'null' + Result.names: cell with station ids --> {'null'} + Result.lat: vector with latitude of stns --> NaN + Result.lon: vector with longitude...--> NaN + Result.elv: vector with elevation (m)--> NaN + Result.type data type (Precip or Tmean) --> 'null' + Result.what -- description of fields and history fo generation-->'null' + Result.flnames -- cell with names (prefixes) of .mat input files--> {'null'} + +*** REFERENCES --- none + +*** UW FUNCTIONS CALLED -- none + +*** TOOLBOXES NEEDED + + stats + + ++
+ suplabel: places text as a title, xlabel, or ylabel on a group of subplots + [ax,h]=suplabel(text,whichLabel,supAxes); + Copied 2009-10-18 from MATLAB File Exchange (see Notes) + ++ Places text as a title, xlabel, or ylabel on a group of subplots. + Function written by Ben Barrowes and made availabe free on MATLAB File + Exchange (see Notes). Useful in connection with function subplot when + you want a "supertitle" above all subplots. + +
+*** INPUT + + text(1 x ?)s text to be placed + whichLabel (1 x ?)s specifies where you want text placed + Any of 'x', 'y', 'yy', or 't', specifying whether the + text is to be the xlable, ylabel, right side y-label, + or "supertitle", espectively + supAxes is an optional argument specifying the Position of the + "super" axes surrounding the subplots. + supAxes defaults to [.075 .075 .85 .85] + specify supAxes if labels get chopped or overlay subplots + + +*** OUTPUT + + ax = handle to the axis + h = handle to the label + ax=suplabel(text,whichLabel,supAxes) returns a handle to the axis only + suplabel(text) with one input argument assumes whichLabel='x' + +*** REFERENCES + + Ben Barrowes wrote this function (see Notes) + +*** TOOLBOXES NEEDED -- none + +*** UW FUNCTIONS CALLED -- none + ++
+ arspectrum: spectrum of an AR(1) or AR(2) process + Result=arspectrum(phi,varnoise,nsize,delf,kopt); + Last Revised 2008-3-4 + ++ Spectrum of an AR(1) or AR(2) process. + Returns the theoretical spectrum as a function of frequency for + frequencies f for an autoregressive order 1 or 2 process whose + autoregressive coefficients are in row vector phi. Also requires + information on the noise variance and series length. + + +
+*** INPUT + + phi(1 x 2)r coefficients of autoregressive model; handles AR(1), AR(2), + or white noise (phi(2)==NaN instructs to use AR(1) --see Notes) + varnoise (1 x 1)r noise variance from fit of the AR model -- see Notes + nsize (1 x 1)n number of observations in the time series + delf (1 x 1)r frequency interval at which spectrum to be computed; + will be at frequencies [0:delf:0.5]; modulus of 0.5 and delf must be 0 + kopt (1 x 2)i options + kopt(1): sign convention on AR coefficients + ==1 Ljung (positive autocorrelation goes with NEGATIVE phi(1)) + ==2 Box and Jenkins (positive autocorrelation goes with positive + phi(1) + kopt(2): terse vs verbose mode + ==1 terse, no graphics + ==2 verbose, plot of spectrum in figure 1 + + +*** OUTPUT + + Result -- structure of results + .y spectral estimates at input frequencies Result.f + .f col vector of the frequencies + .A (1 x 1)r area under theoretical spectrum, cumputed as sum of delf + times spectrum + +*** REFERENCES + + Box, G.E.P., and Jenkins, G.M., 1976, Time series analysis: forecasting + and control: San Francisco, Holden Day, p. 575 pp. + + Chatfield, C., 1975, The analysis of time series: Theory and practice, Chapman and Hall, London, 263 pp. + + Ljung, L. 1995. System identification toolbox; for use with MATLAB, The + MathWorks, Inc. + + Wilks, D. S., Statistical Methods in the Atmospheric Sciences, 467 p, + Academic Press, 1995 -- p 352-355 + +*** TOOLBOXES NEEDED + +*** UW FUNCTIONS CALLED -- none + ++
+ specbt1: spectrum of a single time series by Blackman Tukey method + [G,null_str]=specbt1(z,M,f,prevwind,sername,kopt,tlab); + Last revised 2009-10-22 + ++ Compute and optionally plot the sample spectrum with 95% confidence bands. + You can interactively control the spectral smoothing through M, the length + of the smoothing window. Figure includes white noise spectral line and + bandwidth bar. + +
+*** IN + + z (mz x 1)r the time series + M (1 x 1)i length of lag window used in calculations. + f (mf x 1)r frequencies (cycles/yr, in range 0-0.5) for spectral estimates + prevwind(1 x 1)i previous figure window + sername(1 x ?)s name of series: for annotating title + kopt (1 x 2)i or (1x1)i options + kopt(1): whether or not to plot within function + ==1 interactive plotting (linear y) to select final value of M + ==2 no plotting; just compute spectrum given initial M + ==3 interactive plotting using semilogy plot + kopt(2): null-continuum (see notes) + ==1 white noise + ==2 red noise + tlab (time label for frequency (e.g., years^-1) + +*** OUT + + G (mG x 5)r spectrum and related quantities. By column: + 1- frequency + 2- period (time) + 3- spectral estimate + 4- lower 95% confi limit + 5- upper 95% conf limit + null_str: tells what the last col of G is ("white noise" or "red noise" + + Graphics output: + + Figure 1. Spectrum, with 95% confidence interval. Horizontal line marks + spectrum of white noise with same variance as z. Horizontal bar marks + bandwidth of Tukey window used to smooth autocovariance function + +*** REFERENCES + + Chatfield, C. 1975. Time series analysis, theory and practice. + Chapman and Hall, London, 263 p. + + Haan C. T. (2002) Statistical methods in Hydrology, second edition. + Iowa State University Press, Ames, Iowa. + + Ljung, L. (1987). System Identification: Theory for the User, + Prentice-Hall, Englewood Cliffs, NJ. + + Wilks, D.S., 1995, Statistical methods in the atmospheric sciences: + Academic Press, 467 p. + + +*** UW FUNCTIONS CALLED + + arspectrum -- for red-noise null continuum + specbt1/calcspec -- subfunction that does most of the meaty calculations + +*** TOOLBOXES NEEDED + + statistics + system identification + ++
+ corrone: product-moment correlation of one variable with several others + r=corrone(y,X); + Last revised 2006-9-2 + ++ Correlation coefficients between one variable and several other variables. + Written for use as an alternative to corrcoef.m when you do not need the + full cross-correlation matrix between all variables. Ran about 40 times + faster for an example of 1000 time series of length 50 years. + +
+*** INPUT + + y (my x 1)r key variable; desire correlations between this and all others + X (mX x nX)r other variables + +*** OUTPUT + + r (nX x 1)r product moment correlation between y and all series in X + +*** REFERENCES -- none +*** UW FUNCTION CALLED -- none +*** TOOLBOXES NEEDED -- none + ++
+ pdgmsim: Exact simulation of Gaussian time series from its periodogram + Result=pdgmsim1(x,nsim,mtaper,kopt); + Last Revised 2009-10-27 + ++ Exact simulation of Gaussian time series from its periodogram. + Function coded from Percival and Constantine (2006), using the smoothed- + periodogram spectral estimator and cirulant embedding following Dietrich + and Newsam(1997). "Exact" refers to the retetion of the statististical + properties --- including the spectrum --- of the observed series by the + simulations. An option allows final scaling of simulations to have same + and variance as the observed series. + + +
+*** INPUT + + x (mx x 1)r time series + nsim (1 x 1)n number of simulations desired + mtaper (1 x 1)r decimal proportion of series to be tapered. Suggest use mtaper=0.10 + kopt (1 x `1)i options + kopt(1) force simulation means and standard deviations to be same as sample + ==1 yes + ==2 no + +*** OUTPUT + + Result -- structure of results + .Y (mx x nsim)r time series matrix of simulated time series + .I (mx x 1)r periodogram of x + .var (1 x 3)r variance of original series, tapered series, padded and tapered series + +*** REFERENCES + + + Bloomfield, P., 2000. Fourier analysis of time series: an introduction, + second edition. John Wiley & Sons, Inc., New York. 261 p. + + Conover, W., 1980, Practical Nonparametric Statistics, 2nd Edition, John + Wiley & Sons, New York. + + Deitrich, C.R., and Newsam, G.N., 1997. Fast and exact simulation of + stationary Gaussian processes through circulant embedding of the + covariance matrix. SIAM Journal on Scientific Computing, 18(4): 1088-1107. +-- shortened to D&N(1997) in comments + + Ljung, L., 1999. System Identification: Theory for the User (2nd + Edition). Prentice-Hall, Inc., New Jersey + + Percival, D.B., and Constantine, W.L.B., 2006. Exact simulation of + Gaussian time series from nonparametric spectral estimates with + application to bootstrapping. Statistics and Computing, 16: 25-35. +-- shortened to P&C(2006) in comments + + +*** TOOLBOXES NEEDED + + Statistics + +*** UW FUNCTIONS CALLED -- none + + ++
+ wtsbinom: weights for binomial filter of desired length or 50% response period + b=wtsbinom(a,kopt); + Last revised 2003-03-27 + ++ Weights for binomial filter of desired length or 50% response period
+ +
+*** INPUT + + a (1 x 1)i desired number of weights or periof of 50% response . See kopt. + kopt(1 x 1)i option + kopt(1)==1 a is the period for which amp of freq response should be 0.5 + kopt(1)==2 a is the number of weights (odd, central + both sides desired) + +*** OUTPUT + + b (1 x n)r computed weights (see notes) + +*** REFERENCES + + Panofsky, H. and Brier, G., 1958. Some applications of statistics to + meteorology. The Pennsylvania State University. p. 150. + + Mitchell et al. (1966, p. 47) + +*** UW FUNCTIONS CALLED -- NONE +*** TOOLBOXES NEEDED -- NONE + ++
+ pdgmraw: Raw periodogram of tapered and padded time series + [I,f,v]=pdgmraw(x,mtaper,npad,kopt); + Last Revised 2009-12-17 + ++ Raw periodogram of tapered and padded time series. + Computes raw periodogram after tapering and padding time series. Uses + fast Fourier transform (FFT) for discrete Fourier transform (DFT) and + computes periodogram such that average ordinate equals variance of + original time series. + + +
+*** INPUT + + x (mx x 1)r time series + mtaper (1 x 1)r decimal proportion of series to be tapered + npad (1 x 1)n desired padded length, a power of 2 at least as large as series-length + kopt (1 x `1)i options + kopt(1) variance adjustment for tapering and padding + ==1 scale variance of tapered and padded variance before DFT + ==2 scale periodogram by factors depending on tapering and padding + +*** OUTPUT + + I (mI x 1)r periodogram of x, at frequency zero and the Fourier frequencies + f (mI x 1)r frequencies for I + v (3x1) variances + row 1: original series, x + row 2: tapered x + row 3: tapered and padded x + row 4: average periodogram ordinate (average of I) + +*** REFERENCES + + + Bloomfield, P., 2000. Fourier analysis of time series: an introduction, + second edition. John Wiley & Sons, Inc., New York. 261 p. + + Ljung, L., 1999. System Identification: Theory for the User (2nd + Edition). Prentice-Hall, Inc., New Jersey + +*** UW FUNCTIONS -- none +*** TOOLBOXES + + Statistics + + ++
+ dirfiles: cell-list of files with specified suffix(es) in a directory + pre=dirfiles(path1,suff,kopt); + Last revised 2010-02-18 + ++ Cell-list of files with specified suffix(es) in a directory. + Finds all files with specified suffixes in a directory and returns the + filenames (without suffix) in fields of structure output variable. + Example of use would be to make list of all ".rwl" and ".crn" files in + some directory. + + +
+*** INPUT + + path1 (1 x ?)s directory of input files + suff {1x?}s cell array of suffixes of files for which lists desired (no + period) + kopt (1 x 1)i options + kopt(1): case sensitivity of suffixes + ==1 case-insensitive + ==2 case-sensitive + +*** OUTPUT + + pre. structure with fields x1, x2, ... + Each field has a col-cell array of files with the suffix in suff{1}, suff{2}, etc, + or is returned empty (see notes) + +*** REFERENCES -- NONE +*** UW FUNCTIONS -- NONE +*** TOOLBOXES -- NONE + ++
+ crn2vec2: .crn file to column vectors of index, sample size, and year + [x,s,yr]=crn2vec2(pf1) or [x,s,yr]=crn2vec2; + Last revised 2008-4-27 + ++ Reads a ".crn" file of tree-ring indices in ITRDB format and converts + the indices and associated data into vectors that can be used in Matlab. + Input file must be formatted as in ITRDB requirements for crn2vec2 to work. + +
+*** IN + + pf1 (1 x ?)s path and file name of .crn file + (e.g., 'c:\work\mt100.crn'); + alternatively, can call with no input arguments and be prompted to + point to the .crn file + +*** OUT + + x (mx x 1)r tree-ring index, mx years + s (mx x 1)r sample size (number of cores) in each year + yr (mx x 1)i year vector for x and s + +*** REFERENCES -- None + +*** UW FUNCTIONS CALLED -- None + +*** TOOLBOXES NEEDED -- None + ++
+ rwl2tsm: ring-width list (rwl) file to time series matrix + [X,yrX,nms,T]=rwl2tsm(pf1) + Last revised 2008-4-30 + ++
+*** IN + + pf1 (1 x ?)s+path and filename of input rwl file (e.g., + 'c:\data\'az023.rwl'); if not included, you are prompted to point + to the file + +*** OUT + + X (mX x nX)r time series matrix, mX years and nX columns + yrX (mX x 1)i year vector for X + nms {size(X,2) x 1}s names of series in X + T (nX x 3)i column, first and last years of valid data in each series of X + +*** REFERENCES --- none + +*** TOOLBOXES NEEDED -- none + +*** UW FUNCTIONS CALLED + + rwl2sov + sov2tsm3 + +
+ acf: autocorrelation function and approximate 95% confidence bands + [r,SE2,r95]=acf(x,nlags,k); + Last revised 2008-4-29 + ++ Computes autocorrelation function and related information for a time series. + +
+*** INPUT ARGUMENTS + + x (m x 1) time series, length m + nlags (1 x 1)i number of lags to compute acf to + k (1 x 2) options;++ k(1) -- plotting + ==1 No plotting within function; get this also if no k input + argument + ==2 Function makes stem plot of acf with CI of +-2 times large-lag + standard error + k(2) -- alternative algorithms (see Notes) + ==1 Uses global means, not means computed separately for subsets of + observations, for departures. Computed covariance as sum of products of first k + values and last k values from the the mean. Then standardizes so + that lag 0 autocorrelation is 1.0 by dividing the vector g by g(1), + where g is vector of sums of cross-products at lags 0,1,2,... + ==2 Uses subset means and standard deviations in computations + +*** OUTPUT ARGUMENTS + + r (1 x nlags)r acf at lags 1 to nlags + SE2 (1 x nlags)r two times the large-lag standard error of r + r95 (1 x 1)threshold sample r required for significance in one-tailed test at + 0.05 alpha (95% signficance). Intended for quick check for positive first-order + autocorrelation, the most common form of persistence in many natural. + If the sample r(1) does not exceed r95, cannot reject H0 that the + population r(1) is zero, at 0.05 alpha. + + + +*** REFERENCES + + Large-lag standard error after Box, G.E.P., and Jenkins, G.M., 1976, Time series + analysis: forecasting and control: San Francisco, Holden Day. + + Confidence interval for r(k) from Haan, C.T., 2002, Statistical methods in Hydrology, + second edition: Ames, Iowa, Iowa State University Press. + + Computation formulas for sample r from + Wilks, D.S., 1995, Statistical methods in the atmospheric sciences: Academic Press, 467 p. + + +*** UW FUNCTIONS CALLED -- none + + +*** TOOLBOXES NEEDED -- none + + +
+ whit1: fit AR model to a time series using modified AIC criterion, returning model information and residuals + [e,k1,vrat,arcs] = whit1(y,nhi,k2); + Last revised 2008-4-29 + ++ Fit AR model to a time series using modified AIC criterion, returning model information and residuals + You specify the highest order AR model to consider. Models up to that order are + fit, and the modified (small sample) Akaike Information Criterion (AIC) is used to pick the best model. + +
+*** IN ********************** + + y (my x 1)r time series, vector; NaNs not allowed + nhi (1 x 1)i highest AR order to consider (if k2==1), or the only + AR order model to try fitting (if k2=2) + k2 (1 x 2)i options + k2(1) for order selections + ==1 fit models of order 1 to nhi + ==2 fit model of order nhi only + k2(2) for over-riding selection of null (order = 0) model + ==1 if modified AIC computed from original time series with model order 0 is lower than + any of the entertained models, return the null model (see notes) + ==2 accept the lowest AIC model even if its AIC is not as low as that of the null model + +*** OUT ************************** + + e (my x 1)r AR residuals, with mean added back in; or, if null model, the + original series y + k1 - the order of the AR model deemed best by the AIC, or 0 if null model and k2(2)==1 + vrat - the ratio of variance of AR residuals to variance of original time series y (see notes) + arcs the ar coefs and their two-standard errors in a two-row array; row 1 has + the coefficients; row two has 2*standard error of the coefficients; + arcs==[] if k2==1 and null model has been selected; + +*** REFERENCES + + The loss function and AIC are discussed in Ljung, L. 1995. System identification + toolbox; for use with MATLAB, The MathWorks, Inc., p. 3-46. + + Akaike H. (1974) A new look at the statistical model identification. IEEE Trans. Autom. Control AC-19, 716-723. + Hurvich C. M. and Tsai C. (1989) Regression and time series model selection in small samples. Biometrika 76, 297-307. + + +*** UW FUNCTIONS CALLED -- none +*** TOOLBOXES NEEDED -- system identification + ++
+ rwl2sov: read .rwl-file ring widths and store in strung-out-vector format in a .mat file + pf2=rwl2sov(pf1,path1,path4); + Last revised 2008-4-30 + ++ This is a way to get ring-width data into Matlab if the data is in the + notorious ".rwl" format. "SOV" is short for "strung-out-vector", which means + simply that each ring-width series is stacked one after another in a single column vector.
+ + Also stored is a matrix with years and row indices that allows retrieval of + individual ring-width series; and a string matrix of core ids + in the same order as the ring-width series are stored.
+ + SOV storage is expected by several other functions in the + tree-ring toolbox. An example is grplot.m, a function + for plotting multiple ring-width series on a page. + +
+*** INPUT + + pf1 (1 x ?)s path\filename of .rwl file + example: 'd:\jack\data\az033.rwl' + path1 (1 x ?)s path to the .rwl file. If this arg is passed, means + that pf1 is the filename only + Example: 'd:\jack\data\' as path1, and 'az033.rwl' as pf1 + path4 (1 x ?)s+: path + for the output .mat files and .txt files. If no path4 as argument, + default is to the same directory as the .rwl files are in + + Input arguments are optional. There can be 0,1, 2, or 3 input arguments: + None: user prompted to click on names of input and output files + One: path\filename for the .rwl file + Two: first arg is the filename of the .rwl file, and the second is the path + Three: path for the output .mat file; this option is convenienent when user + wants .mat output files to go to different directories that that + of the source .rwl files + +*** OUTPUT ***************************************** + + pf2 (1 x ?)s path & filename of output .mat file + + X (? x 1)i column vector of ringwidths stored one core after another + in units of hundredths of mm + yrs (? x 3)i start year, end year, and row index into X of start year of each + core's ring-width series in X + nms (? x 8)s identification of each core + + + If function call with no or just one output argument, a .mat storage file pf2 is made. Otherwise, + pf2 is returned as [], and it is assumed the user wants to directly use + X, yrs and nms + Depending on the number of input arguments, the output .mat + file goes to a specified path\filename or the user is prompted to enter + the path/filename of the storage file. The .mat stoarge file contains these variables: + + X (? x 1)i column vector of ringwidths stored one core after another + in units of hundredths of mm + yrs (? x 3)i start year, end year, and row index into X of start year of each + core's ring-width series in X + nms (? x 8)s identification of each core + cmask (? x 1)i mask for core; 1==do not mask, 0==mask. cmask is created as all 1's + by rwl2sov. Subsequent functions may change cmask as cores are deleted from analysis. + Fwhen {8 x 4}s history of fits for the data set. Casual user need not be concerned with this + or cmask. Fwhen tracks what was the source and target data file, and what and when things were + done to the data. + + An ascii file "???_list.txt" is also produced in the working directory. + "???" is taken from pf1, and is the part of that filename before the suffix. This file lists + the ids and first and last years' data for each of the ring-width series read. The numbers in + parentheses are the measurements for the first and last years. This file can be used for checking + quickly the contents of an rwl file. + +*** REFERENCES --none + +*** UW FUNCTIONS CALLED + + intnan.m -- checks for internal NaNs in a vector + trailnan.m -- lops off trailing NaNs from a vector + +*** TOOLBOXES NEEDED -- none + +
+ sov2tsm: strung-out-vector to time series matrix, with names cell + [X,yrX,nms]=sov2tsm3(v,YRS,nms,jpick,tends); + Last revised 2008-4-29 + ++
+*** IN + + v (mv x 1)r strung-out-vector (sov) of one or more time series + YRS(nsers x 3)i start year, end year, and starting row index of + each series in v, where nsers is the number of series in v + nms (nsers x ?)s or {nsers x 1}s names of series in v + jpick(? x 1)i or [] index to rows of YRS specifying which series in + v to include in the tsm. For example, jpick=([1 3 4 7])' would pick + only those four series. The series numbers correspond + to rows of YRS. See Notes. + tends(1 x 2)i, or [] first last year of desired tsm X. + + +*** OUT + + X (mX x nX)r time series matrix, mX years and nX columns + yrX (mX x 1)i year vector for X + nms {size(X,2) x 1}s names of series in X + +*** REFERENCES --- none + +*** TOOLBOXES NEEDED -- none + +*** UW FUNCTIONS CALLED -- none + ++
+ akaike: Akaike information criterion for order of best ARMA model + c=akaike(V,N,m); + Last revised 2-17-04 + ++ Akaike information criterion for order of best ARMA model + +
+*** INPUT ARGUMENTS + + V (1 x 1)r loss function, or variance of model residuals + N (1 x 1)i number of observations + m (1 x 1)i number of explanatory variables, or sum of AR and MA orders + +*** OUTPUT ARGUMENTS + + c (1 x 2)r Akaike information criterion, with and without correction for small sample bias (see + notes); c(1) == with correction; c(2)= without correction + +*** REFERENCES + + Akaike H. (1974) A new look at the statistical model identification. IEEE Trans. Autom. Control AC-19, 716-723. + Hurvich C. M. and Tsai C. (1989) Regression and time series model selection in small samples. Biometrika 76, 297-307. + + +*** UW FUNCTIONS CALLED -- none + + +*** TOOLBOXES NEEDED + + System identification + + ++
+ trailnan: remove any trailing NaN's from a vector + x=trailnan(x); + Last revised: Meko 2008-4-29 + ++ Utility function used by rwlinp.m and other functions. Most users + will not need to call trailnan in their own code + +
+*** INPUT + + x (1 x ?)r or (? x 1)r vector, usually a time series + +*** OUTPUT + + x (? x 1)r the same vector, but with any trailing NaN's removed + +*** REFERENCES -- none +*** UW FUNCTIONS CALLED -- none +*** TOOLBOXES NEEDED -- none ++
+ intnan: check for internal NaN in a vector + m=intnan(x) + Last revised 2008-4-29 + ++ Utility function for checking whether a vector has an internal, or imbedded, NaN + +
+*** INPUT + + x(? x 1)r or ((1 x ?)r -- a time series + +*** OUTPUT + + m(1 x 1)L 1 if x has imbedded NaN, 0 otherwise + +*** REFERENCES -- none + + +*** UW FUNCTIONS CALLED -- none + +*** TOOLBOXES NEEDED -- none + ++
Home | +Vita | +Course | +Toolbox | +Contact | +
+ + +
Home | +Vita | +Course | +Toolbox | +Contact | +
Home | +Vita | +Course | +Toolbox | +Contact | +
+Two components of this project are the extension of cool-season precipitation information to the millennial time scale and the investigation of the warm-season precipitation signal. As one approach to the warm-season signal we are developing a network of latewood-width chronologies from various parts of western North America. Dave Stahle and Malcolm Cleaveland ( U Arkansas) are collaborators in this research under a related NOAA award.
+ +An extension was granted in 2000 to allow the the research to be expanded to an detailed examination of the latewood width signal in a daily precipitation data set. +
+ +
This is part of a cooperative agreement between the U.S. Geological Survey and the University of Arizona in which graduate students are supported in various types of thesis work. One supported area is "reconstruction of growing conditions of riparian trees using dendrochronological analysis, with an emphasis on reconstructing hydrological time series -- surface-water flow and (or) ground-water discharge -- using advanced statistical techniques. +
+Kiyomi Morini, o, a PhD candidate in the Department of Geography, is being funded by the agreeement. Kiyomi's research deals with growth and ring-width variations of Freemont cottonwood and other riparian species in southeastern Arizona. + + ++ +
+The long version of the title is "Collaborative Research: Reconstruction of Drought and Streamflow over the Coterminous United States from Tree Rings, with Extensions into Mexico and Canada." The objective of this study is to improve the application of tree-ring data to the reconstruction of regional-scale streamflow variations. Of particular interest is improvement in accuracy of reconstruction of high-flow anomalies.
+ +Collaborators are Connie Woodhouse (NOAA), Ed Cook (Lamont Doherty), and Manu Lall (Utah State). + ++ +
Home | +Vita | +Course | +Toolbox | +Contact | +
+The objective of this study is to explore pros and cons of regional-curve standardization (RCS)in dendrochronology
+ ++ +
Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the title is "A Tree-Ring Based Hydroclimatic Assessment of Synchronous Extreme Streamflow Episodes in the Upper Colorado and Salt-Verde River Basins". The objective of this study is improved knowledge of the likelihood of drought jointly affecting runoff in two key sources of water to the Salt River Project.
+ ++ +
Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the title is "The Frequency, Severity and Causes of Extreme Droughts in the Winnipeg River Basin". This is a grant that PhD student Scott St. George brought with him to the University of Arizona. The Winnipeg River basin, which straddles Manitoba, Ontario and Minnesota, directly influences the production of about 4,500 megawatts of hydropower. An objective is to determine if low flows are predictable and periodic and associated with specific atmospheric circulation patterns.
+ ++ +
Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the title is "Dendrohydrology of Blue Oak in the Central Valley of California. The project is a subcontract from the University of Arkansas and contributes to a multi-institutional project "Hydroclimatic Reconstruction and Ancient Blue Oak Mapping over the Drainage Basin of SanFrancisco Bay". The larger project is headed by David W. Stahle. Co-investigators are Dan Cayan, Mike Dettinger and Kelly Redmond. Some objectives of this study are 1)improved climatic reconstructions of streamflow and precipitation, 2) improved understanding of the ecology of ancient blue oak, and 3) testing of a predictive model for presence of ancient blue oak.
+ +
+ A summary of my recent work on the project is in the powerpoint "spacemode.ppt" at
+Meko blue oak
+
+ More information on this project is available at the mother site
+Blue Oak Woodlands of California
+
+Kelly Redmond and John Abatzoglou, Western Regional Climate Center, have put together a comprehensive analysis of the climate signal in the blue oak chronologies at
+Blue Oak WRCC
+
+
+
+
+
+
+
+
Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the project title is "Integrating Improved Water Supply Predictive Capacity And Response Into Lower Colorado Basin Policy And Management". This project further develops research partnerships and extends four prior years of work on a multi-pronged approach to preparing for and responding to variable Colorado River supply reliability in the Lower Basin. General areas of work include: a) demonstrating potential strategies for enhanced use of climate information in Bureau of Reclamation river system modeling and river operations including use of paleoclimatology, climate forecasts and climate change predictions to improve predictive capacity/reduce system vulnerability for the Colorado River system broadly, with particular focus on the Lower Basin and the Central Arizona Project; b) evaluating specific management tools designed to translate improved predictive capacity into enhanced supply reliability for water users, including market-based tools that can be used by federal and state agencies, municipalities, irrigation districts, tribes and other stakeholders; and c) engaging with other research groups and key stakeholders to tailor research foci, approaches and findings for applications of interest to Reclamation.
++ +
Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the title is "Riparian Thresholds: Using Dendrochronological Metrics to Evaluate Change". The main objective is to pioneer the use of Netleaf Hackberry (Celtis reticulata) as a dendrochronological indicator of riparian health and riparian climate/growth relationships.
+Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the title is "An Investigation of North American Monsoon (NAM) Variability using Instrumental and Tree-Ring Data". A main objective of this study is improved understanding of the long-term variability of the North American Monsoon through use of partial-widthand stable isotope tree-ring data. The project includes both new and existing tree-ring collections.
+Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the title is "Spatiotemporal Drought Variability of the Near East and Eastern Mediterranean from Tree Rings". A main objective of this study is to develop new tree-ring chronologies from the Near East and Eastern Mediterranean and apply them to study the spatio-temporal variability of drought
+Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the title is "Collaborative Research: Past and Future Drought Variability in the +Mediterranean Basin". A main objective of this study is to develop new tree-ring chronologies from North Africa and apply them to study the spatio-temporal variability of drought
+Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the title is "Millennial context for recent hydroclimatic changes in Ob River basin from tree +rings". A main objective of this study is long-term information on variability of Ob River, Siberia, inflow to the Arctic Ocean. Additional funding was obtained after 03/31/2015 to fund a trip to Russia by Panyushkina and a trip to LTRR by Agafonov to develop journal articles
+Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the title is "Collaborative Research: Interannual and seasonal variability of snowpack in the Sierra Nevada from tree rings". A main objective is to develop generally applicable tree-ring measures for study of variability of snowpack parameters. Collaborators on the project are researchers from the Hydrologic Research Center, San Diego, CA (Eylon Shamir, Rochelle Campbell, and Kosta Georgakakos)
+Home | +Vita | +Course | +Toolbox | +Contact | +
+The main objective is to provide information on the variability of water supply to Southern California. Tasks include field collections of tree-ring samples, development of chronologies, statistical reconstruction of annual flows and precipitation, and interpretation of reconstructions. Dr. Erica Bigio is a post-doc with major responsibilities on the project.
+Home | +Vita | +Course | +Toolbox | +Contact | +
+The long version of the title is "Ob River Flood History from West Siberia Tree Rings". A main objective of this study is identifying signatures in tree rings for floods along the Ob. A secondary objective is improvement of accuracy of a previous reconstructions of annual flows with information from a West Siberia network of temperature-sensitive trees. Key individuals on the project are Dr. Irina Panyushkina (senior personnel) and Leonid Agafonov (Russian collaborator). Most of the funding is for a 10-day visit of Meko, Panyushkina and a graduate student (Julie Edwards, a student of Kevin Anchukaitis, has volunteered!).
+Home | +Vita | +Course | +Toolbox | +Contact | +
+The main objective is to provide information on the variability of hydroclimate of the Carson-Truckee River Basin over decades to centuries. Collaboration is with Franco Biondi (University of Nevada, Reno). Tasks include application of modern tree-ring data, including cell anatomical data, in the framework of a water balance model in producing field reconstructions of water-balance parameters over the basin. MS candidate Anabel Winitsky joined the project in Fall Semester, 2020.
+Home | +Vita | +Course | +Toolbox | +Contact | +
+The main objective is to provide information on the variability of freshwater and heat inflow to the Arctic Ocean from the Yenisei River. NSF collaboration is with a team of scientists from the University of New Hampshire (UNH). Tasks include field collections of tree-ring data, application of those data and existing tree-ring data to reconstruction of fluxes of heat and water, and integration of tree-ring data in a water-balance modeling and database framework that will more broadly encourage dendrohydrologic studies of Arctic Basins. MS candidate Richie Thaxton joined the project in Fall Semester, 2020.
+Home | +Vita | +Course | +Toolbox | +Contact | +
Name | +PIs | +Funded By | +
---|---|---|
Where has the Water Gone? | +Meko | +NSF Paleo Perspectives on Climate Change | +
Water and Energy Fluxes to the Arctic Ocean using Tree-Ring data and Hydrological Modeling | +Panyushkina, Meko and Frank | +NSF Arctic Natural Sciences | +
Home | +Vita | +Course | +Toolbox | +Contact | +
Home | +Vita | +Course | +Toolbox | +Contact | +
+
+The "Tree-Ring Toolbox" is not a commercially available Matlab toolbox, but is a collection of Matlab functions I have written to do various tasks in tree-ring analysis. For example, the function crn2vec2 reads an ITRDB-formatted ".crn" file and returns the site chronology, years, and sample size as matlab vectors.
+
+Back to Top of Page
+
+
+
+
+
+To use the Tree-Ring Toolbox, you must its functions in a directory on your Matlab path. My functions usually call on other utility functions I wrote. The best method to be sure you don't call an "unknown" function is to download the whole set of Tree-Ring Toolbox functions. I have zipped these into a file File_pooled.zip, which you should unzip into a directory on your Matlab path. I recommend keeping those functions by themselves in a dedicated folder. Put that folder first on your Matlab path, so that no other functions you might have by the same name, or not obsolete versions of the same function, are used. Alternatively, move your data to the dedicated folder and run programs with that folder as the current working directory.
+
+I distribute these function freely. I require no acknowledgement of the source. Go ahead and modify them as you wish. I welcome any comments on the functions in the function list. But due to time constraints, I cannot promise anything more than grudging cooperation in updating or correcting functions when I'm in the mood.
+Back to Top of Page
+
+
+
+
+
To find out what's in the Tree-Ring Matlab Toolbox, check out the function list, , which give a brief description of what the function does. I suggest you read the comment section at the beginning of any function before using the function. My opening comments are organized as follows:
+(1x1)r real number, scalar +(3x2)r matrix (3 x 2) of real numbers +(3x1)i column vector (3 elements) of integers +(1x8)s character string of length 8 +(1x1)L logical scalar + ++ +Matlab also has data types called "cells" and "structures", which are best found out about by reading the Matlab documentation. My code for cells uses braces. For example, +the code below indicates a 1 x 3 "cell" variable containing a 2x2 integer matrix, a 1x5 character string and a 1x10 row vector of real numbers. + +
+{1x3} + (2 x 2)i + (1 x 5)s + (1 x 10)r ++
Home | +Vita | +Course | +Toolbox | +Contact | +
Home | +Vita | +Course | +Toolbox | +Contact | +
Home | +Vita | +Course | +Toolbox | +Contact | +