setParams: Sets edge parameters

View source: R/gr_setters.R

setParamsR Documentation

Sets edge parameters

Description

It assigns values to the vector of edge weights in the slot $depParams of object of class HRMnetwork and its subclasses.

Usage

setParams(obj, value, ...)

## S3 method for class 'HRMnetwork'
setParams(obj, value, ...)

## S3 method for class 'HRMtree'
setParams(obj, value, ...)

Arguments

obj

An object of class HRMnetwork or its subclasses HRMtree, MME, MLE1, MLE2, EKS, EKS_part, EngHitz, HRMBG, MMEave, MLEave

value

A named vector with names corresponding to the names of the edges. The vector represents the edge weights: thetas in case of models on trees and deltas in case of models on block graphs. See Vignette "Introduction" also. If an unnamed vector is passed the first element in the vector is assigned to the first edge, the second element to the second edge and so on.

...

additional arguments

Value

It return an object of the same class as obj but where the slot $depParams are set to the vector in the argument value.

Examples

# model on a block graph with three edge parameters
g<- graph(c(1,2,2,3, 3,1), directed=FALSE)
g<- set.vertex.attribute(g, "name", V(g), c("a", "b", "c")) # name the nodes
obj<- HRMBG(g)
obj<- setParams(obj, c(0.2,0.3, 0.1))
obj
# model on a tree with two edge parameters
g<- graph(c(1,2,2,3), directed=FALSE)
g<- set.vertex.attribute(g, "name", V(g), c("a" ,"b" ,"c")) # name the nodes
obj<- HRMtree(g)
obj<- setParams(obj, c(0.2,0.3))
obj
x<- c(0.2, 0.3)
names(x)<- names(obj$depParams)
obj<- setParams(obj, x)
obj

gremes documentation built on Feb. 16, 2023, 8:06 p.m.