File: trend1d.html

package info (click to toggle)
gmt-doc 3.4-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 4,756 kB
  • ctags: 1,800
  • sloc: makefile: 30
file content (190 lines) | stat: -rw-r--r-- 7,736 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<HTML>
<HEAD>
<TITLE>trend1d</TITLE>
</HEAD>
<BODY>
<H1>trend1d</H1>
<HR>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->
       trend1d   -  Fit  a  [weighted]  [robust]  polynomial  [or
       Fourier] model for y = f(x) to xy[w] data.


</PRE>
<H2>SYNOPSIS</H2><PRE>
       <B>trend1d</B> <B>-F</B><I>&lt;xymrw&gt;</I> <B>-N</B>[<B>f</B>]<I>n</I><B>_</B><I>model</I>[<B>r</B>] [ <I>xy[w]file</I> ] [ <B>-C</B><I>condi</I>
       <I>tion</I><B>_</B><I>#</I> ] [ <B>-H</B>[<I>nrec</I>] ] [ <B>-I</B>[<I>confidence</I><B>_</B><I>level</I>] ] [ <B>-V</B> ] [ <B>-W</B>
       ] [ <B>-:</B> ] [ <B>-bi</B>[<B>s</B>][<I>n</I>] ] [ <B>-bo</B>[<B>s</B>] ]


</PRE>
<H2>DESCRIPTION</H2><PRE>
       <B>trend1d</B> reads x,y  [and  w]  values  from  the  first  two
       [three]  columns on standard input [or <I>xy[w]file</I>] 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.


</PRE>
<H2>REQUIRED ARGUMENTS</H2><PRE>
       <B>-F</B>     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.

       <B>-N</B>     Specify the number of terms in the model,  <I>n</I><B>_</B><I>model</I>,
              whether  to  fit  a  Fourier  (<B>-Nf</B>)  or  polynomial
              [Default] model, and append <B>r</B> to do a  robust  fit.
              E.g., a robust quadratic model is <B>-N</B><I>3</I><B>r</B>.


</PRE>
<H2>OPTIONS</H2><PRE>
       <I>xy[w]file</I>
              ASCII  [or  binary, see <B>-b</B>] file containing x,y [w]
              values in the first 2 [3] columns. If  no  file  is
              specified, <B>trend1d</B> will read from standard input.

       <B>-C</B>     Set  the  maximum  allowed condition number for the
              matrix  solution.  <B>trend1d</B>  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
              <I>condition</I><B>_</B><I>#</I>.  [Default: <I>condition</I><B>_</B><I>#</I> = 1.0e06. ].

       <B>-H</B>     Input  file(s)  has  Header  record(s).  Number  of
              header records can be changed by editing your .gmt
              defaults file. If used, <B><A HREF="GMT.html">GMT</A></B>  default  is  1  header
              record.

       <B>-I</B>     Iteratively  increase  the  number of model parame
              ters, starting at one, until <I>n</I><B>_</B><I>model</I> is reached  or
              the  reduction in variance of the model is not sig
              nificant at the <I>confidence</I><B>_</B><I>level</I> level. You may set
              <B>-I</B>  only,  without an attached number; in this case
              and 1. See remarks section.

       <B>-V</B>     Selects verbose  mode,  which  will  send  progress
              reports to stderr [Default runs "silently"].

       <B>-W</B>     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.]

       <B>-:</B>     Toggles  between  (longitude,latitude)  and  (lati
              tude,longitude)  input/output.  [Default is (longi
              tude,latitude)].  Applies to geographic coordinates
              only.

       <B>-bi</B>    Selects binary input. Append <B>s</B> for single precision
              [Default is double].  Append <I>n</I> for  the  number  of
              columns in the binary file(s).  [Default is 2 (or 3
              if <B>-W</B> is set) columns].

       <B>-bo</B>    Selects binary output. Append <B>s</B> for  single  preci
              sion [Default is double].


</PRE>
<H2>REMARKS</H2><PRE>
       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), <B>cos(2x)</B>, <B>sin(2x)</B>, ... 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 model coefficients are  Chebeshev  coefficients,
       NOT coefficients in a + bx + cxx + ...

       The  <B>-Nr</B>  (robust) and <B>-I</B> (iterative) options evaluate the
       significance of  the  improvement  in  model  misfit  Chi-
       Squared  by an F test. The default confidence limit is set
       at 0.51; it can be changed with the <B>-I</B>  option.  The  user
       may  be surprised to find that in most cases the reduction
       in variance achieved by increasing the number of terms  in
       a model is not significant at a very high degree of confi
       dence. For example, with  120  degrees  of  freedom,  Chi-
       Squared  must decrease by 26% or more to be significant at
       the 95% confidence level. If you want to keep iterating as
       long as Chi-Squared is decreasing, set <I>confidence</I><B>_</B><I>level</I> to
       zero.

       A low confidence limit (such as the default value of 0.51)
       outliers. The weight is based on the Median Absolute Devi
       ation and a formula from Huber [1964], and  is  95%  effi
       cient when the model residuals have an outlier-free normal
       distribution. This means that the influence of outliers is
       reduced  only slightly at each iteration; consequently the
       reduction in Chi-Squared is not very significant.  If  the
       procedure needs a few iterations to successfully attenuate
       their effect, the significance level of the F test must be
       kept low.


</PRE>
<H2>EXAMPLES</H2><PRE>
       To  remove  a  linear trend from data.xy by ordinary least
       squares, try:

       <B>trend1d</B> data.xy <B>-F</B>xr <B>-N</B>2 &gt; detrended_data.xy

       To make the above linear trend robust with respect to out
       liers, try:

       <B>trend1d</B> data.xy <B>-F</B>xr <B>-N</B>2<B>r</B> &gt; detrended_data.xy

       To  find  out  how  many terms (up to 20, say) in a robust
       Fourier interpolant are significant  in  fitting  data.xy,
       try:

       <B>trend1d</B> data.xy <B>-Nf</B>20<B>r</B> <B>-I</B> <B>-V</B>


</PRE>
<H2>SEE ALSO</H2><PRE>
       <I>gmt</I>(l), <I><A HREF="grdtrend.html">grdtrend</A></I>(l), <I><A HREF="trend2d.html">trend2d</A></I>(l)


</PRE>
<H2>REFERENCES</H2><PRE>
       Huber, P. J., 1964, Robust estimation of a location param
       eter, <I>Ann.</I> <I>Math.</I> <I>Stat.,</I> <I>35,</I> 73-101.

       Menke,  W.,  1989,  Geophysical  Data  Analysis:  Discrete
       Inverse  Theory,  Revised  Edition,  Academic  Press,  San
       Diego.















</PRE>
<HR>
<ADDRESS>
Man(1) output converted with
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</ADDRESS>
</BODY>
</HTML>
<body bgcolor="#ffffff">