How to use gstat 'variogram' function for nonlinear formulae?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use gstat 'variogram' function for nonlinear formulae?

Joelle k. Akram
Dear all,


For a linear model I use the 'variogram' function in gstat as follows:


coordinates(data) <- c('x','y')
myvario <- variogram(dep~var1+var2+var3, data)

Now, I have the following Nonlinear formula that I want to use in variogram.

dep~ var1*var2^3


My 2 questions are:

i) Can the variogram function in gstat handle nonlinear models as this formula?

ii) What is the syntax to use this nonlinear formulae within the variogram function? is it simply :

myvario <- variogram(dep~ var1*var2^3, data)

Any advice is appeciated.


cheers

Chris Akram



        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: How to use gstat 'variogram' function for nonlinear formulae?

edzer


On 07/04/2018 06:14 PM, Joelle k. Akram wrote:

> Dear all,
>
>
> For a linear model I use the 'variogram' function in gstat as follows:
>
>
> coordinates(data) <- c('x','y')
> myvario <- variogram(dep~var1+var2+var3, data)
>
> Now, I have the following Nonlinear formula that I want to use in variogram.
>
> dep~ var1*var2^3

This is still a linear model.

>
>
> My 2 questions are:
>
> i) Can the variogram function in gstat handle nonlinear models as this formula?
>
> ii) What is the syntax to use this nonlinear formulae within the variogram function? is it simply :
>
> myvario <- variogram(dep~ var1*var2^3, data)

I think that like in other areas of R you'll have to use

myvario <- variogram(dep~ var1*I(var2)^3, data)

Note that the * will be interpreted as indicating you want main effects
and an interaction, not simply the product of var1*var3^3; see ?formula

>
> Any advice is appeciated.
>
>
> cheers
>
> Chris Akram
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo