#start with clean workspace 
rm(list=ls())
getwd()
#> [1] "C:/Users/ninab/OneDrive/Documenten/GitHub/labjournal"

1 packages

library(data.table) 
library(tidyverse) 
require(stringi)
require(Rsiena)
require(igraph)
#load dataobjects
load("./data/descriptives/RU_dfv2.RData")

2 Model 1: ethnicity ego

divego.divnet.lm<-lm(soc_df$div.net ~ soc_df$div.ego)
summary(divego.divnet.lm)
#> 
#> Call:
#> lm(formula = soc_df$div.net ~ soc_df$div.ego)
#> 
#> Residuals:
#>     Min      1Q  Median      3Q     Max 
#> -34.525 -21.930  -7.890   8.006  78.070 
#> 
#> Coefficients:
#>                Estimate Std. Error t value Pr(>|t|)  
#> (Intercept)       34.53      13.94   2.476   0.0196 *
#> soc_df$div.ego   -12.59      14.98  -0.841   0.4075  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 27.89 on 28 degrees of freedom
#>   (2 observations deleted due to missingness)
#> Multiple R-squared:  0.02463,    Adjusted R-squared:  -0.0102 
#> F-statistic: 0.7071 on 1 and 28 DF,  p-value: 0.4075

3 Model 2: year first publication

pubfirst.divnet.lm<-lm(soc_df$div.net ~ soc_df$pub_first)
summary(pubfirst.divnet.lm)
#> 
#> Call:
#> lm(formula = soc_df$div.net ~ soc_df$pub_first)
#> 
#> Residuals:
#>     Min      1Q  Median      3Q     Max 
#> -31.349 -20.353  -2.288  10.293  70.664 
#> 
#> Coefficients:
#>                   Estimate Std. Error t value Pr(>|t|)  
#> (Intercept)      -1322.809    710.280  -1.862   0.0731 .
#> soc_df$pub_first     0.671      0.354   1.896   0.0684 .
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 26.58 on 28 degrees of freedom
#>   (2 observations deleted due to missingness)
#> Multiple R-squared:  0.1137, Adjusted R-squared:  0.08209 
#> F-statistic: 3.594 on 1 and 28 DF,  p-value: 0.06837

4 Model 3: gender

gender.divnet.lm<-lm(soc_df$div.net ~ soc_df$gender4)
summary(gender.divnet.lm)
#> 
#> Call:
#> lm(formula = soc_df$div.net ~ soc_df$gender4)
#> 
#> Residuals:
#>    Min     1Q Median     3Q    Max 
#> -23.81 -23.41  -8.13  13.53  76.59 
#> 
#> Coefficients:
#>                Estimate Std. Error t value Pr(>|t|)   
#> (Intercept)      23.813      7.291   3.266  0.00288 **
#> soc_df$gender4   -0.406     10.311  -0.039  0.96887   
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 28.24 on 28 degrees of freedom
#>   (2 observations deleted due to missingness)
#> Multiple R-squared:  5.537e-05,  Adjusted R-squared:  -0.03566 
#> F-statistic: 0.001551 on 1 and 28 DF,  p-value: 0.9689

5 Model 4: ethnicity ego + year first publication + gender

final.divnet.lm<-lm(soc_df$div.net ~ soc_df$div.ego + soc_df$pub_first + soc_df$gender4)
summary(final.divnet.lm)
#> 
#> Call:
#> lm(formula = soc_df$div.net ~ soc_df$div.ego + soc_df$pub_first + 
#>     soc_df$gender4)
#> 
#> Residuals:
#>     Min      1Q  Median      3Q     Max 
#> -33.338 -20.712  -4.512  12.534  63.126 
#> 
#> Coefficients:
#>                    Estimate Std. Error t value Pr(>|t|)  
#> (Intercept)      -1750.5010   863.7535  -2.027   0.0531 .
#> soc_df$div.ego      -7.5129    14.9225  -0.503   0.6189  
#> soc_df$pub_first     0.8841     0.4278   2.066   0.0489 *
#> soc_df$gender4      13.4445    11.5801   1.161   0.2562  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 26.81 on 26 degrees of freedom
#>   (2 observations deleted due to missingness)
#> Multiple R-squared:  0.1627, Adjusted R-squared:  0.0661 
#> F-statistic: 1.684 on 3 and 26 DF,  p-value: 0.1948
LS0tDQp0aXRsZTogIlJVIHJlZ3Jlc3Npb24gYW5hbHlz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