#RSiena

#start with clean workspace 
rm(list=ls())
#load dataobjects
load("./data/descriptives/RU_net_array_sym.RData")
load("./data/descriptives/RUpub_dfv2.RData")
load("./data/descriptives/RU_dfv2.RData")
load("./data/names_staff_cit_v20221006.RData")

library(RSiena)
library(tidyverse)
names_staff_cit %>% 
  filter(gs_id %in% soc_df$gs_id) -> RU_staff_cit
save(RU_staff_cit, file="./data/descriptives/RU_staff_cit.RData")
#dependent
net <- sienaDependent(net_soc_array)
### Step 1: define data
#diversiteit egonet
div_net <- coCovar(as.numeric(soc_df$div.net))

#diversiteit ego
div_ego <- coCovar(as.numeric(soc_df$div.ego))

#gender
gender <- coCovar(soc_df$gender4)

#leeftijd
pub_first <- coCovar(soc_df$pub_first)

#total cites
soc_df$total_cites_num <- as.numeric(soc_df$total_cites)
total_cites <- coCovar(soc_df$total_cites_num)
#pubs: time-varying
pubsw1 <- pubsw2 <- pubsw3 <- pubsw4 <- NA
for (i in 1:length(soc_df$gs_id)) {
  pubsw1[i] <- nrow(RU_staff_cit[(RU_staff_cit$gs_id == soc_df$gs_id[i]) & RU_staff_cit$year>=2016 & RU_staff_cit$year<=2017,])
  pubsw2[i] <- nrow(RU_staff_cit[(RU_staff_cit$gs_id == soc_df$gs_id[i]) & RU_staff_cit$year>=2018 & RU_staff_cit$year<=2019,])
  pubsw3[i] <- nrow(RU_staff_cit[(RU_staff_cit$gs_id == soc_df$gs_id[i]) & RU_staff_cit$year>=2020 & RU_staff_cit$year<=2022,])
}

pub_df <- as.matrix(data.frame(pubsw1, pubsw2, pubsw3))
pubs <- varCovar(pub_df)

1 Model 1: Diversity of the egonet with structural effects

mydata1 <- sienaDataCreate(net, div_net)
### Step 2: create effects structure
myeff1 <- getEffects(mydata1)
#effectsDocumentation(myeff1)
### Step 3: get initial description
print01Report(mydata1, modelname = "./data/results/RU_init")
### Step4: specify model
myeff1 <- includeEffects(myeff1, degPlus) #popularity
##   effectName     include fix   test  initialValue parm
## 1 degree act+pop TRUE    FALSE FALSE          0   1
myeff1 <- includeEffects(myeff1, transTriads) #number of transitive patterns in i's relationships
##   effectName        include fix   test  initialValue parm
## 1 transitive triads TRUE    FALSE FALSE          0   0
myeff1 <- includeEffects(myeff1, absDiffX,interaction1="div_net")
##   effectName              include fix   test  initialValue parm
## 1 div_net abs. difference TRUE    FALSE FALSE          0   0
### Step5 estimate
myAlgorithm <- sienaAlgorithmCreate(projname = "RU_init")
## If you use this algorithm object, siena07 will create/use an output file RU_init.txt .
(ans1 <- siena07(myAlgorithm, data = mydata1, effects = myeff1))
## Estimates, standard errors and convergence t-ratios
## 
##                                    Estimate   Standard   Convergence 
##                                                 Error      t-ratio   
## 
## Rate parameters: 
##   0.1      Rate parameter period 1  1.2152  ( 0.4125   )             
##   0.2      Rate parameter period 2  2.8213  ( 1.1543   )             
## 
## Other parameters: 
##   1.  eval degree (density)        -2.4204  ( 0.4934   )    0.0451   
##   2.  eval transitive triads        0.8953  ( 0.3366   )   -0.0122   
##   3.  eval degree act+pop           0.1224  ( 0.0588   )    0.0318   
##   4.  eval div_net abs. difference -0.0332  ( 0.0117   )    0.0454   
## 
## Overall maximum convergence ratio:    0.1085 
## 
## 
## Total of 1988 iteration steps.
# (the outer parentheses lead to printing the obtained result on the screen) if necessary, estimate
# further
#(ans <- siena07(myAlgorithm, data = mydata, effects = myeff, prevAns = ans))
summary(ans1)
## Estimates, standard errors and convergence t-ratios
## 
##                                    Estimate   Standard   Convergence 
##                                                 Error      t-ratio   
## 
## Rate parameters: 
##   0.1      Rate parameter period 1  1.2152  ( 0.4125   )             
##   0.2      Rate parameter period 2  2.8213  ( 1.1543   )             
## 
## Other parameters: 
##   1.  eval degree (density)        -2.4204  ( 0.4934   )    0.0451   
##   2.  eval transitive triads        0.8953  ( 0.3366   )   -0.0122   
##   3.  eval degree act+pop           0.1224  ( 0.0588   )    0.0318   
##   4.  eval div_net abs. difference -0.0332  ( 0.0117   )    0.0454   
## 
## Overall maximum convergence ratio:    0.1085 
## 
## 
## Total of 1988 iteration steps.
## 
## Covariance matrix of estimates (correlations below diagonal)
## 
##        0.243        0.037       -0.024       -0.002
##        0.225        0.113       -0.011        0.000
##       -0.822       -0.563        0.003        0.000
##       -0.307        0.008       -0.018        0.000
## 
## Derivative matrix of expected statistics X by parameters:
## 
##       47.254       34.542     1239.830     1433.528
##       33.489       44.645     1071.541      985.930
##      454.795      405.813    13549.849    13697.429
##      629.834      440.607    16290.420    33681.365
## 
## Covariance matrix of X (correlations below diagonal):
## 
##       82.823       75.573     2376.090     2454.300
##        0.839       97.988     2461.779     2159.776
##        0.960        0.914    73985.320    69423.779
##        0.846        0.684        0.801   101624.770

2 Model 2: all covariates with structural effects

mydata2 <- sienaDataCreate(net, div_net, div_ego, gender, pub_first, pubs, total_cites)
### Step 2: create effects structure
myeff2 <- getEffects(mydata2)
#effectsDocumentation(myeff2)
### Step 3: get initial description
print01Report(mydata2, modelname = "./data/results/soc_init2")
### Step4: specify model
myeff2 <- includeEffects(myeff2, degPlus) #popularity
##   effectName     include fix   test  initialValue parm
## 1 degree act+pop TRUE    FALSE FALSE          0   1
myeff2 <- includeEffects(myeff2, transTriads) #number of transitive patterns in i's relationships
##   effectName        include fix   test  initialValue parm
## 1 transitive triads TRUE    FALSE FALSE          0   0
myeff2 <- includeEffects(myeff2, absDiffX,interaction1="div_net")
##   effectName              include fix   test  initialValue parm
## 1 div_net abs. difference TRUE    FALSE FALSE          0   0
myeff2 <- includeEffects(myeff2, sameX,interaction1="div_ego")
##   effectName   include fix   test  initialValue parm
## 1 same div_ego TRUE    FALSE FALSE          0   0
myeff2 <- includeEffects(myeff2, sameX,interaction1="gender")
##   effectName  include fix   test  initialValue parm
## 1 same gender TRUE    FALSE FALSE          0   0
myeff2 <- includeEffects(myeff2, egoPlusAltX,interaction1="pub_first") #if you are older, you will get more collaboration within department 
##   effectName            include fix   test  initialValue parm
## 1 pub_first ego and alt TRUE    FALSE FALSE          0   0
myeff2 <- includeEffects(myeff2, egoPlusAltX,interaction1="total_cites") 
##   effectName              include fix   test  initialValue parm
## 1 total_cites ego and alt TRUE    FALSE FALSE          0   0
myeff2 <- includeEffects(myeff2, egoPlusAltX, interaction1 = "pubs") #if you have many pubs, you will probably publish more per year?
##   effectName       include fix   test  initialValue parm
## 1 pubs ego and alt TRUE    FALSE FALSE          0   0
### Step5 estimate
myAlgorithm <- sienaAlgorithmCreate(projname = "RU_init2")
## If you use this algorithm object, siena07 will create/use an output file RU_init2.txt .
(ans2 <- siena07(myAlgorithm, data = mydata2, effects = myeff2))
## Estimates, standard errors and convergence t-ratios
## 
##                                    Estimate   Standard   Convergence 
##                                                 Error      t-ratio   
## 
## Rate parameters: 
##   0.1      Rate parameter period 1  1.1693  ( 0.3894   )             
##   0.2      Rate parameter period 2  2.6544  ( 0.8457   )             
## 
## Other parameters: 
##   1.  eval degree (density)        -1.8804  ( 0.6790   )    0.0645   
##   2.  eval transitive triads        1.2680  ( 0.3694   )   -0.0006   
##   3.  eval degree act+pop           0.0173  ( 0.0731   )    0.0394   
##   4.  eval div_net abs. difference -0.0356  ( 0.0129   )    0.0160   
##   5.  eval same div_ego             0.0627  ( 0.5084   )    0.0555   
##   6.  eval same gender             -0.3148  ( 0.3261   )    0.0319   
##   7.  eval pub_first ego and alt    0.0458  ( 0.0232   )   -0.0415   
##   8.  eval total_cites ego and alt  0.0002  ( 0.0001   )    0.0302   
##   9.  eval pubs ego and alt         0.0881  ( 0.2364   )    0.0250   
## 
## Overall maximum convergence ratio:    0.1431 
## 
## 
## Total of 2551 iteration steps.
# (the outer parentheses lead to printing the obtained result on the screen) if necessary, estimate
# further
#(ans <- siena07(myAlgorithm, data = mydata, effects = myeff, prevAns = ans))
summary(ans2)
## Estimates, standard errors and convergence t-ratios
## 
##                                    Estimate   Standard   Convergence 
##                                                 Error      t-ratio   
## 
## Rate parameters: 
##   0.1      Rate parameter period 1  1.1693  ( 0.3894   )             
##   0.2      Rate parameter period 2  2.6544  ( 0.8457   )             
## 
## Other parameters: 
##   1.  eval degree (density)        -1.8804  ( 0.6790   )    0.0645   
##   2.  eval transitive triads        1.2680  ( 0.3694   )   -0.0006   
##   3.  eval degree act+pop           0.0173  ( 0.0731   )    0.0394   
##   4.  eval div_net abs. difference -0.0356  ( 0.0129   )    0.0160   
##   5.  eval same div_ego             0.0627  ( 0.5084   )    0.0555   
##   6.  eval same gender             -0.3148  ( 0.3261   )    0.0319   
##   7.  eval pub_first ego and alt    0.0458  ( 0.0232   )   -0.0415   
##   8.  eval total_cites ego and alt  0.0002  ( 0.0001   )    0.0302   
##   9.  eval pubs ego and alt         0.0881  ( 0.2364   )    0.0250   
## 
## Overall maximum convergence ratio:    0.1431 
## 
## 
## Total of 2551 iteration steps.
## 
## Covariance matrix of estimates (correlations below diagonal)
## 
##        0.461        0.041       -0.028       -0.002       -0.200       -0.043       -0.002        0.000        0.016
##        0.163        0.136       -0.014        0.000        0.004       -0.011        0.002        0.000       -0.009
##       -0.566       -0.532        0.005        0.000       -0.003       -0.001        0.000        0.000        0.000
##       -0.236       -0.084       -0.082        0.000        0.000        0.001        0.000        0.000        0.000
##       -0.580        0.021       -0.078        0.016        0.258       -0.003        0.001        0.000       -0.037
##       -0.194       -0.093       -0.031        0.147       -0.018        0.106        0.000        0.000        0.005
##       -0.153        0.268       -0.030       -0.072        0.078        0.006        0.001        0.000        0.001
##       -0.009        0.404       -0.315       -0.045        0.091       -0.034        0.880        0.000        0.000
##        0.101       -0.107       -0.016        0.022       -0.307        0.070        0.200        0.078        0.056
## 
## Derivative matrix of expected statistics X by parameters:
## 
##  3.711400e+01  3.012500e+01  9.992880e+02  1.150768e+03  7.012500e+01  4.295200e+01 -1.040120e+03  3.456842e+05  4.636300e+01
##  2.854300e+01  4.360700e+01  9.382000e+02  8.761210e+02  5.604200e+01  3.575700e+01 -9.868200e+02  2.864013e+05  4.637200e+01
##  3.599660e+02  3.647970e+02  1.130031e+04  1.109270e+04  6.935560e+02  4.267900e+02 -1.281498e+04  4.211029e+06  5.113830e+02
##  5.666130e+02  4.821870e+02  1.537632e+04  3.046056e+04  1.069621e+03  6.081380e+02 -1.466305e+04  5.032479e+06  7.196310e+02
##  3.462300e+01  3.042700e+01  9.682070e+02  1.053388e+03  7.431700e+01  4.027200e+01 -1.087904e+03  3.488846e+05  5.049600e+01
##  1.895600e+01  1.759000e+01  5.347580e+02  5.491670e+02  3.610900e+01  4.046800e+01 -6.739220e+02  2.138217e+05  2.473400e+01
## -5.486200e+02 -6.007710e+02 -1.998699e+04 -1.572373e+04 -1.097891e+03 -7.289460e+02  4.313638e+04 -1.298326e+07 -1.113650e+03
##  1.874617e+05  1.808152e+05  6.769213e+06  5.501203e+06  3.680817e+05  2.399755e+05 -1.307648e+07  4.490909e+09  3.379523e+05
##  2.331800e+01  2.693600e+01  7.663290e+02  6.916660e+02  5.123400e+01  2.679900e+01 -1.109857e+03  3.321675e+05  8.015400e+01
## 
## Covariance matrix of X (correlations below diagonal):
## 
##  5.218300e+01  5.552400e+01  1.556838e+03  1.589762e+03  9.964700e+01  6.298200e+01 -1.788948e+03  5.702100e+05  7.645900e+01
##  8.060000e-01  9.101700e+01  1.965728e+03  1.608637e+03  1.108120e+02  7.058300e+01 -2.214449e+03  6.698391e+05  9.924000e+01
##  9.390000e-01  8.970000e-01  5.271305e+04  4.591793e+04  3.042447e+03  1.894536e+03 -6.296173e+04  2.044606e+07  2.560198e+03
##  8.010000e-01  6.140000e-01  7.280000e-01  7.552933e+04  3.002693e+03  1.879496e+03 -5.049698e+04  1.632909e+07  2.302030e+03
##  9.570000e-01  8.060000e-01  9.190000e-01  7.580000e-01  2.079280e+02  1.204240e+02 -3.602269e+03  1.138700e+06  1.597300e+02
##  8.280000e-01  7.030000e-01  7.840000e-01  6.500000e-01  7.930000e-01  1.108620e+02 -2.430367e+03  7.479646e+05  9.334300e+01
## -7.290000e-01 -6.830000e-01 -8.070000e-01 -5.410000e-01 -7.350000e-01 -6.790000e-01  1.154094e+05 -3.474406e+07 -3.468782e+03
##  7.270000e-01  6.470000e-01  8.210000e-01  5.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