grid3p               package:agricolae               R Documentation

_I_n_t_e_r_p_o_l_a_t_i_o_n _f_o_r _n_o_n_e_q_u_i_d_i_s_t_a_n_t _p_o_i_n_t_s _i_n _m_a_t_r_i_x

_D_e_s_c_r_i_p_t_i_o_n:

     Z=f(x,y) generates an information matrix by a process of
     interpolation for nonequidistant points. It uses function interpp
     of library akima.

_U_s_a_g_e:

     grid3p(x, y, z, m, n)

_A_r_g_u_m_e_n_t_s:

       x: Vector independent

       y: Vector independent 

       z: Vector dependent 

       m: number of rows of the new matrix 

       n: number of columns of the new matrix 

_D_e_t_a_i_l_s:

     The function fxyz obtains a new data set.  A new vector "x" of "m"
     elements and a new vector "y" of "n" elements and the matrix "z"
     of mxn elements, those that will be obtained by interpolation.

_V_a_l_u_e:

      x : Numeric

      y : Numeric

      z : Numeric

      m : Numeric

      n : Numeric

_A_u_t_h_o_r(_s):

     Felipe de Mendiburu

_S_e_e _A_l_s_o:

     'wxyz'

_E_x_a_m_p_l_e_s:

     library(akima)
     library(agricolae)
     data(clay)
     x<-clay$per.clay
     y<-clay$days
     z<-clay$ralstonia
     model<- lm(z ~ x + y)
     zo<-wxyz(model,x,y,z)
     # it completes and it finds the average of points with equal coordinate.
     b<-colnames(zo)
     a<-rownames(zo)
     x<-as.numeric(rep(a,length(b)))
     y<-NULL
     for(i in 1:length(b)) y<-c(y,rep(b[i],length(a)))
     y<-as.numeric(y)
     z<-as.numeric(zo)
     m<-40
     n<-20
     # It generates a new matrix mxn with but points by interpolation.
     z2<-grid3p(x,y,z,m,n)
     # plot
     x2<-as.numeric(dimnames(z2)[[1]])
     y2<-as.numeric(dimnames(z2)[[2]])
     res<-contour(x2,y2,z2, cex=0.7, col="blue",xlab="clay",ylab="days")
     mtext("Ralstonia solanacearum population",side=3,cex=0.9,font=4)
     #====================
     # Using the function of interpolacion of irregular points. see interp() de "akima"

     data(clay)
     x<-clay$per.clay
     y<-clay$days
     z<-clay$ralstonia
     zz <- interp(x,y,z,xo=seq(4,32,length=100),yo=seq(2,79,length=100),duplicate="mean")
     #startgraph
     image(zz$x,zz$y,zz$z,xlab = "clay", ylab = "day",frame=FALSE, col=topo.colors(8))
     contour(zz$x,zz$y,zz$z, cex=0.7, col = "blue",add=TRUE,frame=FALSE)
     mtext("Ralstonia solanacearum population\n",side=3,cex=0.9,font=4)
     #endgraph

