Whats the difference between z~1 and z~LON+LAT in plotting variogram in R?

时间:2015-07-28 16:11:53

标签: r spatial sp gstat

library(sp)
data(meuse)
coordinates(meuse)<-~x+y
v<-variogram(log(zinc)~1,meuse)
v
         np       dist     gamma dir.hor dir.ver   id
    1   57   79.29244 0.1234479       0       0 var1
    2  299  163.97367 0.2162185       0       0 var1
    3  419  267.36483 0.3027859       0       0 var1
    4  457  372.73542 0.4121448       0       0 var1
    .
    .

v1<-variogram(log(zinc)~x+y,meuse)
v1
            np       dist     gamma dir.hor dir.ver   id
        1   57   79.29244 0.1060834       0       0 var1
        2  299  163.97367 0.1829983       0       0 var1
        3  419  267.36483 0.2264256       0       0 var1
        4  457  372.73542 0.2847192       0       0 var1
        .
        .

From above following code and output I can found that log(zinc)~1 and log(zinc)~x+y returns the different gamma value for v and v1. What's the basic difference between these two operation?

help(variogram) told me that "formula defining the response vector and (possible) regressors, in case of absence of regressors, use e.g. z~1;".But,I didn't understand clearly these sentence! could anyone please tell me in details that when should I use z~1 or when should I use z~LON+LAT?

1 个答案:

答案 0 :(得分:1)

variogram的第一个参数定义了平均结构的模型。在均值均值的情况下,模型仅包含截距,因此log(zinc)~1。如果在xy中将均值建模为线性回归模型,则使用log(zinc)~x+y。在这种情况下,普通最小二乘残差被计算为半变异函数值的基础,而不是被测量的log(zinc)值。