Movatterモバイル変換


[0]ホーム

URL:


socialSimGitHub

Simulate and Analyse Social Interaction Models

R-CMD-check

ThesocialSim R package provides tools to simulateand analyse datasets of social interactions between individuals usinghierarchical Bayesian models implemented in Stan.

It enables users to generate realistic social interaction data, whereindividual phenotypes influence and respond to those of their partners.You can simulate a sampling design by adjusting thenumber ofindividuals, partners, and repeated dyads. The simulationframework allows control over variation inmean trait values,social responsiveness, and social impact and correlation,making it suitable for research ondirect and indirect geneticeffects (DGEs and IGEs) andinteractingphenotypes. See?simulate_data for a full list ofadjustable parameters.

The package also provides analysis functions to evaluate modelperformance in terms of bias and dispersion, using both established andnovel approaches to modelling social effects, includingimpact–responsiveness, variance–partitioning, and trait-basedmodels.


🧭 Installation

You can install the development version from GitHub using:

# install.packages("remotes")remotes::install_github("RoriWijnhorst/socialSim")# Then load the package:library(socialSim)

⚙️ Example workflow:

library(socialSim)# 1. Simulate data. See ?simulate_data for all adjustable parameterssim<-simulate_data(ind =1200,# number of unique focal individualspartners =4,# number of social partners per individualrepeats =1,# number of repeats of dyadsiterations =10,# number of datasets createdB_0 =1,# population interceptpsi =0.3,# population-level responseValpha =0.2,# variance in direct effectsVepsilon =0.1# variance in residual partner effects)# 2. Fit a Stan model. For the analyses, cmdstanr or rstan needs to be installed.# using cmdstanr will be faster, since it runs model in parallel on different cores of your PC.res<-run_model(sim,model ="Trait.stan",iter=2000,cores =6)# 3. Summarise resultssummary<-summarise_results(res)print(summary)

🧪 Available IGE models

Model nameDescription
I&R.stanFull impact–responsiveness model
VP.stanVariance-partitioning model
Trait.stanTrait-based model with residual partner effects
Trait_only.stanSimple trait-based model without residual partner effects
Trait_RS.stanRandom-slope trait model with residual partner effects
Trait_EIV.stanErrors-in-variable trait model with residual partner effects

[8]ページ先頭

©2009-2025 Movatter.jp