chStat: Internal use

Description Usage Arguments Details Value Author(s) Examples

View source: R/functions.r

Description

Calculates the deviance associated with the addition of each add-eligible edge. Called from stepw.

Usage

1
chStat(model,dataset,previous=NULL,forbEdges=NULL)

Arguments

model

a gRapHD object.

dataset

matrix (nrow(dataset) observations and ncol(dataset) variables).

previous

result of a previous run of chStat.

forbEdges

list with edges that should not be considered. Matrix with 2 columns, each row representing an edge, and each column a vertex. Default is NULL.

Details

The deviance and degrees of freedom associated with each add-eligible edge is returned. If previous results are specified these are reused as appropriate, and a concatenated result list is returned. This function is used by stepw.

Value

A list with:

edges.to.test

matrix (k by 5), with columns:
1 - first vertex of the tested edge
2 - second vertex (the two values are ordered)
3 - index for the separator in S
4 - deviance statistic associated with adding this edge
5 - degrees of freedom associated with the deviance

S

list of separators.

Author(s)

Gabriel Coelho Goncalves de Abreu (abreu_ga@yahoo.com.br)
Rodrigo Labouriau (Rodrigo.Labouriau@agrsci.dk)
David Edwards (David.Edwards@agrsci.dk)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
data(dsCont)
m1 <- minForest(dsCont,homog=TRUE,forbEdges=NULL,stat="LR")
ch <- findEd(m1@edges,m1@p,NULL,0)
ch <- chStat(m1,dsCont,ch,forbEdges=0)
str(ch)
# List of 2
#  $ edges.to.test: num [1:53, 1:5] 1 11 19 11 17 2 2 10 10 2 ...
#  $ S            :List of 53
#   ..$ : int 11
#   ..$ : int 21
#   ..$ : int 21
#   ..$ : int 21
#   ..$ : int 27
#   ..$ : int 17
#    ...
head(ch$edges.to.test)
#      [,1] [,2] [,3]         [,4] [,5]
# [1,]    1   21    1  -0.61733689    1
# [2,]   11   19    2  -0.24637623    1
# [3,]   19   27    3  -0.47194908    1
# [4,]   11   27    4  -7.00259895    1
# [5,]   17   21    5 -11.09310305    1
# [6,]    2   27    6  -0.04690911    1

# the columns in ch$edges.to.test
#    1: first vertex in the edge
#    2: second vertex in the edge
#    3: index os the separator in ch$S
#    4: change in the LR for the edge
#    5: number of parameters for the edge

gRapHD documentation built on Feb. 9, 2018, 6:05 a.m.

Related to chStat in gRapHD...