testadd: Test addition of edge to graphical model

View source: R/test_single_edges.R

testaddR Documentation

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.

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.

Value

A list

Author(s)

Søren Højsgaard, sorenh@math.aau.dk

See Also

testdelete

Examples


## Discrete models
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 models
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"))

gRim documentation built on Oct. 16, 2024, 1:07 a.m.