Description Usage Arguments Details Value Author(s) Examples
Estimates a p1 model via (exact) maximum likelihood.
1 2 |
y |
An adjacency matrix of size g x g. |
XnS |
Matrix of sender effects of size g x ks. |
XnR |
Matrix of receiver effects of size g x kr. |
XvD |
Density effects, a 3-dim array of size g x g x kd. |
XvC |
Reciprocity effects, a 3-dim array of size g x g x kc. |
trace |
TRUE for tracing information during the estimation. Default is FALSE. |
init |
Optional starting value for model parameters. Default is NULL. |
opt |
Name of the optimising function. Default is nlminb. |
... |
Optional arguments passed to the optimiser. |
The function is included for compatibility with fit_p2
, and
it might also be useful to obtain starting values.
The returned value is an object of class
"p1"
, a list containing the following components:
|
the vector of model estimates. |
|
the log likelihood function at the estimate. |
|
model selection criteria at the estimate. |
|
logical, flagging whether there are no sender or receiver effects, respectively. |
|
the random seed used for estimation (when |
|
Variance matrix of estimates. |
|
Standard errors of estimates. |
|
Optimiser employed for estimation. |
|
Object returned by the optimiser. |
|
Object returned by |
|
List containing all the model data, fed
to |
|
Summary object returned by |
Ruggero Bellio
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Analysis of the kracknets data from the NetData package
library(NetData)
data(kracknets)
# data preparation
g <- 21
Y <- matrix(0, g, g)
ind <-1
for(i in 1:nrow(friendship_data_frame)){
sele <- friendship_data_frame[i, ]
Y[sele$ego, sele$alter] <- sele$friendship_tie
}
Xn <- model.matrix(~ AGE + TENURE, attributes)[, -1]
XvD <- array(1, dim=c(g, g, 4))
for(i in 1:g)
for(j in 1:g){
XvD[i, j, 2] <- as.numeric(attributes$DEPT[i]==attributes$DEPT[j])
XvD[i, j, 3] <- as.numeric(attributes$LEVEL[i]==attributes$LEVEL[j])
XvD[i, j, 4] <- abs(attributes$AGE[i] - attributes$AGE[j])
}
XvC <- array(1, dim=c(g, g, 1))
# Now we are ready to fit the model
mod <- fit_p1(Y, Xn, Xn, XvD, XvC)
summary(mod)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.