Learn R Programming

agricolae (version 1.0-4)

wxyz: Completing missing data of a matrix according to a model

Description

It generates an information matrix z=f(x, y). It uses a linear model to complete the cells without information.

Usage

wxyz(model, x, y, z)

Arguments

model
obtained by 'lm'
x
vector 'x'
y
vector 'y'
z
vector 'z' relation of 'x' e 'y'

Value

  • modelobtained by 'lm'
  • xNumeric
  • yNumeric
  • zNumeric

See Also

gxyz, grid3p

Examples

Run this code
library(agricolae)
x<-c(1,3,5,2,3,1)
y<-c(2,5,4,3,2,3)
z<-c(4,10,NA,6,7,NA)
modelo<-lm(z~x+y)
zz<-wxyz(modelo,x,y,z)
# The response surface
x<-as.numeric(rownames(zz))
y<-as.numeric(colnames(zz))
#startgraph
persp(x,y,zz, cex=0.7,theta = -20, phi = 30,shade= 0.2,nticks = 6, col = 'green' ,
ticktype = 'detailed',xlab = 'X', ylab = 'Y', zlab = 'Response')
#endgraph

Run the code above in your browser using DataLab