Locate a named parameter in the short vector representation of a model

PCMParamLocateInShortVector(o, accessExpr, enclos = "?")

Arguments

o

a PCM model object.

accessExpr

a character string used to access the parameter, e.g. "$Theta[,,1]" or "[['Theta']][,,1]".

enclos

a character string containing the symbol '?', e.g. 'diag(?)'. The meaning of this symbol is to be replaced by the matching accessExpr (see examples). Default value : '?'.

Value

an integer vector of length PCMParamCount(o) with NAs everywhere except at the coordinates corresponding to the parameter in question.

Examples

model <- PCM(PCMDefaultModelTypes()["D"], k = 3, regimes = c("a", "b")) # The parameter H is a diagonal 3x3 matrix. If this matrix is considered as # a vector the indices of its diagonal elements are 1, 5 and 9. These indices # are indicated as the non-NA entries in the returned vector. PCMParamLocateInShortVector(model, "$H[,,1]")
#> [1] NA NA NA 1 5 9 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA #> [26] NA NA
PCMParamLocateInShortVector(model, "$H[,,'a']")
#> [1] NA NA NA 1 5 9 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA #> [26] NA NA
PCMParamLocateInShortVector(model, "$H[,,'b']")
#> [1] NA NA NA NA NA NA 1 5 9 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA #> [26] NA NA
PCMParamLocateInShortVector(model, "$Sigma_x[,,'b']", enclos = 'diag(?)')
#> [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 1 NA 2 NA #> [26] NA 3
PCMParamLocateInShortVector(model, "$Sigma_x[,,'b']", enclos = '?[upper.tri(?)]')
#> [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 1 NA 2 #> [26] 3 NA