lm integration | R Documentation |
Take a bn
object or bn.fit
object encoding a Gaussian network
and refit all the local distributions using lm()
. This makes it
possible to use all the functions provided by R for lm
objects
(summary
, anova
, etc.) to investigate the network.
## S3 method for class 'bn'
as.lm(x, data, ...)
## S3 method for class 'bn.fit'
as.lm(x, data, ...)
## S3 method for class 'bn.fit.gnode'
as.lm(x, data, ...)
x |
an object of class |
data |
a data frame containing the variables in the model. |
... |
additional arguments, currently ignored. |
If x
is an object of class bn
or bn.fit
, as.lm()
returns a list of lm
objects, one for each node in x
. If
x
is an object of class bn
or bn.fit.gnode
,
as.lm()
returns a single lm
object.
Marco
dag = hc(gaussian.test)
fitted = bn.fit(dag, gaussian.test)
as.lm(dag, gaussian.test)
as.lm(fitted, gaussian.test)
as.lm(fitted$F, gaussian.test)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.