Page 1 of 1

[SOLVED] Extract sill and range from a variogram model

PostPosted: Wed Sep 07, 2016 3:49 pm
by M_houd_germ
Dear all,

I have created a model, using
Code: Select all
model.auto()
, which look like this:

Code: Select all
model
Model characteristics
=====================
Space dimension              = 2
Number of variable(s)        = 1
Number of basic structure(s) = 1
Number of drift function(s)  = 1
Number of drift equation(s)  = 1

Covariance Part
---------------
- Exponential
  Range       =   6154.587
  Theo. Range =   2054.452
  Sill        =      0.024
Total Sill    =      0.024

Drift Part
----------
Universality Condition


. I wish to extract from this model the range and the sill for later use. For that I tried
Code: Select all
model@basics$sill
but it returns NULL.
I also tried some things like this model@basics[1], model@basics[[1]] but it does not work.

How could I extract sill and range ?

Best regards,

Re: Extract sill and range from a variogram model

PostPosted: Thu Sep 08, 2016 12:18 am
by Didier Renard
Hi

The solution that we practiced in RGeostats in order to retrieve information from an object (belonging to a certain class)
is to use the assessors.
For a complete description, ask information on the class. For example, if we consider the object called my_model.
First get its class type:
class(my_model)

The answer will be: "model" (of the package RGeostats)

Then you simply have to ask for the generic help of any object belonging to the class "model" by typing:

class?model

Among the methods, you will check that you have the assessors: $, $<-, [, [<-

This allows you to type:

my_model$ncova which returns the number of basic structures (say 3)

And to know the contents of the basic structure rank 'i' (say 2 ... which sould be smaller or equal to than 3), just type:

my_model[i]

Again, if you ask for the class of this new object by typing:

class(my_model[i])

you will discover that it belongs to the class "melem"

In the help of this class, you will see the following syntax:

my_model[1]$range which gives you the range for example.
my_model[1]$sill returns the sill (or the sill matrix in multivariate case).

Hope this will help.

Re: [SOLVED] Extract sill and range from a variogram model

PostPosted: Thu Sep 08, 2016 10:01 am
by M_houd_germ
Hello Didier,

The help you provided helps a lot !

Thank you very much.

Regards,