s.medp(1)	       Grass User's Manual		s.medp(1)



NNAAMMEE
       ss..mmeeddpp  - Median polish for a GRASS sites list.
       _(_G_R_A_S_S _S_i_t_e_s _P_r_o_g_r_a_m_)

SSYYNNOOPPSSIISS
       ss..mmeeddpp
       ss..mmeeddpp hheellpp
       ss..mmeeddpp	 [--aaeeqqss]    ssiitteess==_n_a_m_e	  vveecctt==_n_a_m_e   oouuttppuutt==_n_a_m_e
       [rreeppoorrtt==_n_a_m_e] [tthhrreesshh==_n]

DDEESSCCRRIIPPTTIIOONN
       _s_._m_e_d_p performs median polish on an existing  sites  list.
       The  sites  are overlayed onto a grid (vveecctt==_n_a_m_e) and each
       site is associated  with  the  closest  node.   Therefore,
       sites  do  not  necessarily have to be oriented on a grid.
       Each node may be associated with zero, one, or more  sites
       and the grid may be rotated.  Also, the length of each box
       does not have to be equal to width of  each  box  defining
       the grid.


       Once  sites  are  associated  with nodes on a _p by _q grid,
       _p_+_q_+_1 extra storage locations are created (initialized  to
       zero)  to  store _a_l_l, _r_o_w, and _c_o_l_u_m_n effects.  The median
       of each row is removed from the	data  and  added  to  the
       extra  _p cells. Then, medians are removed from the data as
       well as from the _p  cells  containing  _r_o_w  effects.   The
       medians	of  data   in this pass are stored in the extra _q
       cells (_c_o_l_u_m_n effects) and the median of the  row  effects
       is  stored in the extra (_p_+_1_, _q_+_1) cell (_a_l_l effect). This
       is repeated until each successive  iteration  leaves  each
       site   unchanged   (within   a	tolerance,  described  by
       [tthhrreesshh==_n]).

OOPPTTIIOONNSS
   FFllaaggss::
       --aa     Use all sites found in the named _s_i_t_e_s file, rather
	      than  limiting  output  to sites falling within the
	      current geographic region.

       --ee     Store row, column, and all effects in output  file.

       --ss     Write  results  to a sites list file (default is to
	      write points in a binary vector file).

       --qq     Quiet. Cut out the chatter.


   PPaarraammeetteerrss::
       ssiitteess==_n_a_m_e
	      Name of an existing sites file.

       vveecctt==_n_a_m_e
	      Name of the grid file (binary vector file).

       oouuttppuutt==_n_a_m_e
	      Name of the output  file	(binary  vector  file  or
	      sites list).

       rreeppoorrtt==_n_a_m_e
	      Name  of	an  ASCII  file  which shows original and
	      residual data in tabular form.

       tthhrreesshh==_n
	      Threshold to determine when convergence  of  median
	      polish is obtained.  (default = 1).



       _s_._m_e_d_p  can  be	run  either non-interactively or interac-
       tively.	The program will be run non-interactively if  the
       user  specifies	the  name of an existing _s_i_t_e_s list file,
       name for a _v_e_c_t file, and name of an _o_u_t_p_u_t file using the
       form   ss..mmeeddpp  [--aaeeqqss]  ssiitteess==_n_a_m_e  vveecctt==_n_a_m_e  oouuttppuutt==_n_a_m_e
       [rreeppoorrtt==_n_a_m_e] [tthhrreesshh==_n]

       Alternately, the user can simply type ss..mmeeddpp on	the  com-
       mand  line,  without program arguments.	In this case, the
       user will be prompted for parameter values using the stan-
       dard GRASS _p_a_r_s_e_r interface.

NNOOTTEESS
       When  using  the  rreeppoorrtt option, the tabular report may be
       more than 128 columns wide. Therefore, it may be useful to
       add  a  _T_e_X  or	_P_o_s_t_S_c_r_i_p_t wrapper before printing (e.g.,
       eennssccrriipptt --hh --rr --ffCCoouurriieerr--BBoolldd55  --pp  rreeppoorrtt..ppss  rreeppoorrtt)  so
       that the page is in landscape orientation and a very small
       font is used.


       The input vector file defining the grid	should	be  large
       enough so that the extreme east-west and north-south nodes
       (for non-rotated grids) can be used to store row and  col-
       umn  effects.  Otherwise,  when	residuals _a_n_d effects are
       written to the output file, residuals may share	the  same
       spatial	location as effects when written to a vector out-
       put file.


       Currently, nothing is done with the residuals, but I would
       like  implement	some  sort  of	analysis  of these in the
       future (suggestions?).  Kriging using these  residuals  as
       new data set is being planned.

SSEEEE AALLSSOO
       _v_._m_k_g_r_i_d

       _v_._t_r_a_n_s_f_o_r_m

       _p_a_r_s_e_r

       Cressie,  Noel A. C. (1991).  _S_t_a_t_i_s_t_i_c_s _f_o_r _S_p_a_t_i_a_l _D_a_t_a,
       New York, NY: John Wiley & Sons.  pp. 186-187.

BBUUGGSS
       This  should  still  be	consider  beta-release	software.
       Although  I have repeated results shown in Cressie (1991),
       I would greatly appreciate someone testing this further.


       The --ss flag is yet to be implemented.


       This should probably be re-written to use points in a vec-
       tor file as input (thus creating _v_._m_e_d_p).


       Ideally,  I would also like to output three data files for
       plotting by a graphing  program	(e.g.,	_g_n_u_p_l_o_t),  but	I
       never  got  around  to  doing this. The classic plot is to
       show three surfaces:  data = trend + residuals.	The trend
       can be obtained by extrapolation and/or interpolation.


       Extrapolating and interpolating using the row, column, and
       all effects to create a raster file would be a  nice  fea-
       ture  to  include in the future. Instead, I am considering
       retrieving the effects from the output file  and  creating
       the surface with separate program.


       Please send all bug fixes and comments to the author.

AAUUTTHHOORR
       James  Darrell  McCauley,  Agricultural Engineering Purdue
       University

       _L_a_s_t _c_h_a_n_g_e_d_: _$_D_a_t_e_: _2_0_0_2_/_0_1_/_2_5 _0_5_:_4_5_:_3_5 _$



GRASS 5.0						s.medp(1)
