Description Usage Arguments Value See Also Examples
Take input data, create a network matrix (when input network matrix not provided) and evaluate the summary measures
previously defined with functions def.sW
and def.sA
.
This function is called internally by tmlenet
for the evaluation of the summary measures.
The R6 class object named DatNet.ObsP0
that is returned by this function can be supplied as an input to the
tmlenet
function.
When DatNet.ObsP0
is used as an input to tmlenet
, the rest of the input arguments already provided to
this function can be omitted from the tmlenet
function call.
1 2 |
data |
Same as |
Kmax |
Same as |
sW |
Same as |
sA |
Same as |
IDnode |
(Optional) Same as |
NETIDnode |
(Optional) Same as |
sep |
Optional friend ID character separator for friends listed in |
NETIDmat |
(Optional) Same as |
verbose |
Set to |
A named list that contains:
sW.matrix
- Matrix of evaluated summary measures for sW
.
sA.matrix
- Matrix of evaluated summary measures for sA
.
NETIDmat
- Network ID matrix that can be used for NETIDmat
input argument to tmlenet
.
DatNet.ObsP0
- R6 object of class DatNet.sWsA
that stores all the summary measures and the network information.
This object be passed to tmlenet
as an argument, in which case the arguments already provided to eval.summaries
no
longer need to be specified to tmlenet
.
tmlenet
for estimation of network effects and def.sW
for defining the summary measures.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #***************************************************************************************
# Define some summary measures for sW
#***************************************************************************************
def_sW <- def.sW(W1, W2, W3) +
def.sW(netW1 = W1[[1:Kmax]]) +
def.sW(netW2 = W2[[1:Kmax]]) +
def.sW(mean.netW2 = mean(W2[[1:Kmax]]), replaceNAw0 = TRUE) +
def.sW(sum.netW3 = sum(W3[[1:Kmax]]), replaceNAw0 = TRUE)
#***************************************************************************************
# Define some summary measures for sA
#***************************************************************************************
def_sA <- def.sA(netA = A[[0:Kmax]]) +
def.sA(sum.netAW2 = sum((1-A[[1:Kmax]])*W2[[1:Kmax]]), replaceNAw0 = TRUE)
#***************************************************************************************
# Evaluate the summary measures applied to the (O)bserved data (data.frame) and network
#***************************************************************************************
# load observed data:
data(df_netKmax6)
# load the network ID matrix:
data(NetInd_mat_Kmax6)
res <- eval.summaries(sW = def_sW, sA = def_sA, Kmax = 6, data = df_netKmax6,
NETIDmat = NetInd_mat_Kmax6, verbose = TRUE)
#***************************************************************************************
# Contents of the list returned by eval.summaries():
#***************************************************************************************
names(res)
# matrix of sW summary measures:
head(res$sW.matrix)
# matrix of sA summary measures:
head(res$sA.matrix)
# matrix of network IDs:
head(res$NETIDmat)
# Observed data summary measures (sW,sA) and network
# stored as "DatNet.sWsA" R6 class object:
res$DatNet.ObsP0
class(res$DatNet.ObsP0)
#***************************************************************************************
# Using DatNet.ObsP0 as input to tmlenet():
#***************************************************************************************
options(tmlenet.verbose = FALSE) # set to TRUE to print status messages
res_K6 <- tmlenet(DatNet.ObsP0 = res$DatNet.ObsP0,
Qform = "Y ~ sum.netW3 + sum.netAW2",
hform.g0 = "netA ~ netW2 + sum.netW3 + nF",
hform.gstar = "netA ~ sum.netW3",
Anode = "A", Ynode = "Y", f_gstar1 = 0L)
res_K6$EY_gstar1$estimates
res_K6$EY_gstar1$vars
res_K6$EY_gstar1$CIs
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.