| 12
 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
 
 | <HTML>
<HEAD>
<TITLE>trend2d</TITLE>
</HEAD>
<BODY>
<H1>trend2d</H1>
<HR>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->
       trend2d - Fit a [weighted] [robust] polynomial model for z
       = f(x,y) to xyz[w] data.
</PRE>
<H2>SYNOPSIS</H2><PRE>
       <B>trend2d</B> <B>-F</B><I><xyzmrw></I> <B>-N</B><I>n</I><B>_</B><I>model</I>[<B>r</B>] [ <I>xyz[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>trend2d</B> reads x,y,z [and w] values from  the  first  three
       [four]  columns on standard input [or <I>xyz[w]file</I>] and fits
       a regression model z = f(x,y)  +  e  by  [weighted]  least
       squares. The fit may be made robust by iterative reweight
       ing of the data. The user may also search for  the  number
       of terms in f(x,y) which significantly reduce the variance
       in z. n_model may be in [1,10] to fit a model of the  fol
       lowing form (similar to grdtrend):
       m1  +  m2*x + m3*y + m4*x*y + m5*x*x + m6*y*y + m7*x*x*x +
       m8*x*x*y + m9*x*y*y + m10*y*y*y.
       The user must  specify  <B>-N</B><I>n</I><B>_</B><I>model</I>,  the  number  of  model
       parameters  to use; thus, <B>-N</B><I>4</I> fits a bilinear trend, <B>-N</B><I>6</I> a
       quadratic <A HREF="surface.html">surface</A>, and so on. Optionally, append <B>r</B> to per
       form  a  robust fit. In this case, the program will itera
       tively reweight the data based on a robust scale estimate,
       in  order  to  converge  to a solution insensitive to out
       liers. This may be  handy  when  separating  a  "regional"
       field  from  a "residual" which should have non-zero mean,
       such as a local mountain on a regional surface.
       <B>-F</B>     Specify up to six letters from the set {x y z  m  r
              w}  in  any  order  to  create columns of ASCII [or
              binary] output. x = x, y = y, z  =  z,  m  =  model
              f(x,y), r = residual z - m, w = weight used in fit
              ting.
       <B>-N</B>     Specify the number of terms in the model,  <I>n</I><B>_</B><I>model</I>,
              and  append  <B>r</B>  to  do a robust fit. E.g., a robust
              bilinear model is <B>-N</B><I>4</I><B>r</B>.
</PRE>
<H2>OPTIONS</H2><PRE>
       <I>xyz[w]file</I>
              ASCII [or binary, see <B>-b</B>] file containing x,y,z [w]
              values  in  the  first 3 [4] columns. If no file is
              specified, <B>trend2d</B> will read from standard input.
       <B>-C</B>     Set the maximum allowed condition  number  for  the
              matrix   solution.  <B>trend2d</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
              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
              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.
       <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  4.  Do  a
              weighted  least  squares  fit  [or start with these
              weights  when  doing  the  iterative  robust  fit].
              [Default reads only the first 3 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 3 (or 4
              if <B>-W</B> is set) input columns].
       <B>-bo</B>    Selects  binary  output. Append <B>s</B> for single preci
              sion [Default is double].
</PRE>
<H2>REMARKS</H2><PRE>
       The domain of x and y will be shifted and scaled  to  [-1,
       1]  and the basis functions are built from Chebyshev poly
       nomials. These have a numerical advantage in the  form  of
       the  matrix which must be inverted and allow more accurate
       solutions. In many applications of <B>trend2d</B>  the  user  has
       data  located  approximately along a line in the x,y plane
       which makes an angle with the x axis (such  as  data  col
       lected along a road or ship track). In this case the accu
       racy could be improved by a  rotation  of  the  x,y  axes.
       <B>trend2d</B>  does  not search for such a rotation; instead, it
       may find that the matrix problem has deficient rank.  How
       ever,  the  solution  is  computed  using  the generalized
       inverse and should still work out  OK.   The  user  should
       check  the  results graphically if <B>trend2d</B> shows deficient
       rank. NOTE: The model parameters listed with <B>-V</B> are Cheby
       shev  coefficients; they are not numerically equivalent to
       the m#s in the equation described above.  The  description
       The <B>-N</B><I>n</I><B>_</B><I>model</I><B>r</B> (robust) and <B>-I</B> (iterative) options  evalu
       ate  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  confidence.  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)
       is needed to make the  robust  method  work.  This  method
       iteratively  reweights the data to reduce the influence of
       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 planar trend from data.xyz by  ordinary  least
       squares, try:
       <B>trend2d</B> data.xyz <B>-F</B>xyr <B>-N</B>2 > detrended_data.xyz
       To make the above planar trend robust with respect to out
       liers, try:
       <B>trend2d</B> data.xzy <B>-F</B>xyr <B>-N</B>2<B>r</B> > detrended_data.xyz
       To find out how many terms (up to 10) in a  robust  inter
       polant are significant in fitting data.xyz, try:
       <B>trend2d</B> data.xyz <B>-N</B>10<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="trend1d.html">trend1d</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
</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">
 |