Learn R Programming

gRim (version 0.1.2)

testadd: Test addition of edge to graphical model

Description

Performs a test of addition of an edge to a graphical model (an iModel object).

Usage

testadd(object, edge, k=2, details=1, ...)

Arguments

object
A model; an object of class iModel.
edge
An edge; either as a vector or as a right hand sided formula.
k
Penalty parameter used when calculating change in AIC
details
The amount of details to be printed; 0 surpresses all information
...
Further arguments to be passed on to the underlying functions for testing; that is to CItable and CImvn

Value

  • A list

Details

Let M0 be the model and e={u,v} be an edge and let M1 be the model obtained by adding e to M0. If M1 is decomposable AND e is contained in one clique C only of M1 then the test is carried out in the C-marginal model. In this case, and if the model is a log-linear model then the degrees of freedom is adjusted for sparsity.

See Also

testdelete

Examples

Run this code
## ## ## testadd
## ## ## 

## ## Discrete model
## ## 
data(reinis)
## A decomposable model
##
mf <- ~smoke:phys:mental+smoke:systol:mental
object <- dmod(mf, data=reinis)
testadd(object,c("systol","phys"))


## A non-decomposable model
##
mf <- ~smoke:phys+phys:mental+smoke:systol+systol:mental
object <- dmod(mf, data=reinis)
testadd(object,c("phys","systol"))


## ## Continuous model
## ## 
data(math)
## A decomposable model
##
mf <- ~me:ve:al+al:an
object <- cmod(mf, data=math)
testadd(object,c("me","an"))

## A non-decomposable model
##
mf <- ~me:ve+ve:al+al:an+an:me
object <- cmod(mf, data=math)
testadd(object,c("me","al"))

Run the code above in your browser using DataLab