summary.AncReg: Summary of AncReg

View source: R/summary.R

summary.AncRegR Documentation

Summary of AncReg

Description

Summarize the results of AncReg. For models with degree = 0 only the instantaneous graph is returned and for models with degree > 0 the summary graph is returned as well.

Usage

## S3 method for class 'AncReg'
summary(object, alpha = 0.05, verbose = FALSE, corr = TRUE, ...)

Arguments

object

output from AncReg()

alpha

significance level for determin whether a connection is significant

verbose

should information be printed?

corr

should multiplicity correction be applied?

...

Further arguments passed to or from other methods.

Value

A list containing: If degree = 0:

p.val

A numeric matrix of p-values for the instantaneous graph

graph

A boolean matrix indicating whether one variable affects another instantaneously

alpha

The significance level to avoid cycles

If degree > 0:

inst.p.val

A numeric matrix of p-values for the instantaneous graph

inst.graph

A boolean matrix indicating whether one variable affects another instantaneously

inst.alpha

The significance level to avoid cycles

sum.p.val

A numeric matrix of p-values for the summary graph

sum.graph

A boolean matrix indicating whether one variable affects another

See Also

AncReg, instant_graph, summary_graph, instant_p.val, summary_p.val

Examples

# random DAGS for simulation
set.seed(1234)

p <- 5 #number of nodes
DAG <- pcalg::randomDAG(p, prob = 0.5)

B <- matrix(0, p, p) # represent DAG as matrix
for (i in 2:p){
  for(j in 1:(i-1)){
    # store edge weights
    B[i,j] <- max(0, DAG@edgeData@data[[paste(j,"|",i, sep="")]]$weight)
  }
}
colnames(B) <- rownames(B) <- LETTERS[1:p]

# solution in terms of noise
Bprime <- MASS::ginv(diag(p) - B)

n <- 500
N <- matrix(rexp(n * p), ncol = p)
X <- t(Bprime %*% t(N))
colnames(X) <- LETTERS[1:p]

# fit ancestor regression
fit <- AncReg(X)
# collect ancestral p-values and graph
res <- summary(fit, alpha = 1)
res

AncReg documentation built on Aug. 8, 2025, 7:48 p.m.