This function allows you to create a pim.poset
environment
that can be added to a pim.environment
object. You can
use this function to create a custom poset, but in general it's safer
to use the relevant arguments of the pim
function.
That way more safety checks are carried out.
new.pim.poset(compare, nobs, parent = parent.frame(), ...)# S4 method for character,numeric
new.pim.poset(compare, nobs, parent = parent.frame(), ...)
# S4 method for matrix,numeric
new.pim.poset(compare, nobs, parent = parent.frame(), ...)
# S4 method for list,numeric
new.pim.poset(compare, nobs, parent, comp.value = "custom", ...)
# S4 method for matrix,missing
new.pim.poset(compare, nobs, parent = parent.frame(), ...)
# S4 method for list,missing
new.pim.poset(compare, nobs, parent = parent.frame(), ...)
# S4 method for missing,numeric
new.pim.poset(compare, nobs, parent = parent.frame(), ...)
an pim.poset
object that can be used to
replace the poset in a pim environment.
A character value, matrix or list indicating how the
poset should be constructed. Defaults to the default value of
create.poset
. See Details section for more information.
An integer value determining the number of observations this poset is created for. If compare is not a character value, the number of observations
An optional environment that serves as the parent for the
pim.poset
environment. By default this is the environment
from which the function is called. Note that for a correct functioning,
the parent environment should be set to the pim.environment
this object is part of. This is done automatically by the function
add.poset
.
arguments passed to other methods.
a character value to be used as value for the compare slot of the object. Defaults to 'custom' and should be left at the default without a very good reason to change it.
Changing the value of comp.value
by hand might result in
errors or a wrongly fitted model. The argument exists for internal
purposes and possible extensions later on, but should not be used.
A poset (or pseudo observation set) in the context of probabilistic index models is a set of indices that determines which observations are compared with one another. It is used to construct the pseudo-observations on which the model is fitted. You can think of a poset as a "pseudo-observation set".
The most convenient way to use this function, is by specifying
a character value for the argument compare
. The value "unique"
creates a poset in such a way that only unique combinations of two
observations are used in the model. The value "all" creates all
possible L-R combinations between the observations.
If you want to define the poset yourself, you can pass either a matrix
or a list with 2 elements as value for the argument compare
.
Columns of the matrix or elements of the list should either be named
"L" and "R", or be unnamed. When unnamed, the function takes the first
column/element as the left poset, and the second column/element as
the right poset. If the (col)names are anything else but "L" and "R",
these names are ignored and the first column is seen as "L".
add.poset
for more information on how to
adapt the poset of a pim.environment
object.
mypos <- new.pim.poset('unique',n=10) # creates empty environment
ls(mypos)
# Using the created poset functions L and R
# Note this is purely as illustration, this makes no sense
# in the context of a pim analysis.
mypos$L(1:10)
mypos$R(1:10)
Run the code above in your browser using DataLab