stepb: Stepwise backward selection

Description Usage Arguments Details Value Author(s) Examples

View source: R/functions.r

Description

A function to perform stepwise backward selection to minimize AIC or BIC.

Usage

1
stepb(G, dataset, fixed.edges = NULL, stat = "BIC")

Arguments

G

A gRapHD object, the initial model.

dataset

A dataframe, whose variables correspond to the nodes of G.

fixed.edges

A boolean vector of length nrow(G@edges). Edges that are TRUE are not removed from the model.

stat

The measure to be minimized, either "BIC" (default) or "AIC".

Details

Performs backward stepwise selection. The initial model must be decomposable. Only edges preserving decomposability are eligible for removal. At each step, the edge resulting in the greatest reduction in BIC (or AIC) is removed. A pure graphical model (i.e. either discrete or continuous) is decomposable iff its graph is triangulated. A mixed graphical models (i.e., with both discrete and continuous variables) is decomposable iff its graph is triangulated and contains no forbidden paths.

Value

A gRapHD object.

Author(s)

David Edwards (David.Edwards@agrsci.dk)

Examples

1
2
3
4
5
data(attitude)
am <- NULL
for (i in 1:6) for (j in (i+1):7) am <- rbind(am, c(i,j))
satG <- new("gRapHD", edges=am, p=7, homog=TRUE, numCat=rep(0,7), vertNames=names(attitude))
G <- stepb(satG, attitude)

Example output

Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colMeans, colSums, colnames,
    dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min


Attaching package: 'gRapHD'

The following object is masked from 'package:graph':

    DFS

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

Related to stepb in gRapHD...