table of contents
other versions
- wheezy 3.4.4-1
- wheezy 4.5.7-2
- jessie 3.4.4-1
- jessie 4.5.12-1
- jessie-backports 5.3.1+dfsg-1~bpo8+1
- testing 5.3.1+dfsg-2
- unstable 5.3.1+dfsg-2
- experimental 5.4.1+dfsg-1~exp1
conflicting packages
TREND1D(1gmt) | Generic Mapping Tools | TREND1D(1gmt) |
NAME¶
trend1d - Fit a [weighted] [robust] polynomial [or Fourier] model for y = f(x) to xy[w] data.SYNOPSIS¶
trend1d -Fxymrw -N[f]n_model[r] [ xy[w]file ] [ -Ccondition_number ] [ -H[i][ nrec] ] [ -I[confidence_level] ] [ -V ] [ -W ] [ -:[i|o] ] [ -b[i| o][s|S|d|D[ncol]| c[var1 /...]] ] [ -f[i|o]colinfo ]DESCRIPTION¶
trend1d reads x,y [and w] values from the first two [three] columns on standard input [or xy[w]file] and fits a regression model y = f(x) + e by [weighted] least squares. The functional form of f(x) may be chosen as polynomial or Fourier, and the fit may be made robust by iterative reweighting of the data. The user may also search for the number of terms in f(x) which significantly reduce the variance in y.REQUIRED ARGUMENTS¶
- -F
- Specify up to five letters from the set {x y m r w} in any order to create columns of ASCII [or binary] output. x = x, y = y, m = model f(x), r = residual y - m, w = weight used in fitting.
- -N
- Specify the number of terms in the model, n_model, whether to fit a Fourier ( -Nf) or polynomial [Default] model, and append r to do a robust fit. E.g., a robust quadratic model is -N 3r.
OPTIONS¶
- xy[w]file
- ASCII [or binary, see -b] file containing x,y [w] values in the first 2 [3] columns. If no file is specified, trend1d will read from standard input.
- -C
- Set the maximum allowed condition number for the matrix solution. trend1d fits a damped least squares model, retaining only that part of the eigenvalue spectrum such that the ratio of the largest eigenvalue to the smallest eigenvalue is condition_#. [Default: condition_# = 1.0e06. ].
- -H
- Input file(s) has header record(s). If used, the default number of header records is N_HEADER_RECS. Use -Hi if only input data should have header records [Default will write out header records if the input data have them]. Blank lines and lines starting with # are always skipped.
- -I
- Iteratively increase the number of model parameters, starting at one, until n_model is reached or the reduction in variance of the model is not significant at the confidence_level level. You may set -I only, without an attached number; in this case the fit will be iterative with a default confidence level of 0.51. Or choose your own level between 0 and 1. See remarks section.
- -V
- Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].
- -W
- Weights are supplied in input column 3. Do a weighted least squares fit [or start with these weights when doing the iterative robust fit]. [Default reads only the first 2 columns.]
- -:
- Toggles between (longitude,latitude) and (latitude,longitude) input and/or output. [Default is (longitude,latitude)]. Append i to select input only or o to select output only. [Default affects both].
- -bi
- Selects binary input. Append s for single precision [Default is d (double)]. Uppercase S or D will force byte-swapping. Optionally, append ncol, the number of columns in your binary input file if it exceeds the columns needed by the program. Or append c if the input file is netCDF. Optionally, append var1 /var2/... to specify the variables to be read. [Default is 2 (or 3 if -W is set) columns].
- -bo
- Selects binary output. Append s for single precision [Default is d (double)]. Uppercase S or D will force byte-swapping. Optionally, append ncol, the number of desired columns in your binary output file. [Default is 1-5 columns as given by -F].
- -f
- Special formatting of input and/or output columns (time or geographical data). Specify i or o to make this apply only to input or output [Default applies to both]. Give one or more columns (or column ranges) separated by commas. Append T (absolute calendar time), t (relative time in chosen TIME_UNIT since TIME_EPOCH), x (longitude), y (latitude), or f (floating point) to each column or column range item. Shorthand -f[i|o]g means -f[i|o]0x,1y (geographic coordinates).
ASCII FORMAT PRECISION¶
The ASCII output formats of numerical data are controlled by parameters in your .gmtdefaults4 file. Longitude and latitude are formatted according to OUTPUT_DEGREE_FORMAT, whereas other values are formatted according to D_FORMAT. Be aware that the format in effect can lead to loss of precision in the output, which can lead to various problems downstream. If you find the output is not written with enough precision, consider switching to binary output ( -bo if available) or specify more decimals using the D_FORMAT setting.REMARKS¶
If a Fourier model is selected, the domain of x will be shifted and scaled to [-pi, pi] and the basis functions used will be 1, cos(x), sin(x), cos(2x), sin(2x), ... If a polynomial model is selected, the domain of x will be shifted and scaled to [-1, 1] and the basis functions will be Chebyshev polynomials. These have a numerical advantage in the form of the matrix which must be inverted and allow more accurate solutions. The Chebyshev polynomial of degree n has n+1 extrema in [-1, 1], at all of which its value is either -1 or +1. Therefore the magnitude of the polynomial model coefficients can be directly compared. NOTE: The stable model coefficients are Chebyshev coefficients. The corresponding polynomial coefficients in a + bx + cxx + ... are also given in Verbose mode but users must realize that they are NOT stable beyond degree 7 or 8. See Numerical Recipes for more discussion. For evaluating Chebyshev polynomials, see gmtmath.EXAMPLES¶
To remove a linear trend from data.xy by ordinary least squares, use:SEE ALSO¶
GMT(1), gmtmath(1), grdtrend(1), trend2d(1)REFERENCES¶
Huber, P. J., 1964, Robust estimation of a location parameter, Ann. Math. Stat., 35, 73-101.15 Jul 2011 | GMT 4.5.7 |