From e36b7500767da4c0a8dbd29f69667aa8fa275e8c Mon Sep 17 00:00:00 2001 From: Ben Green Date: Fri, 21 Aug 2015 13:06:12 -0400 Subject: added age to sim analysis and updated data generation for new model --- R Scripts/generate-dag-dat.R | 94 +++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 40 deletions(-) (limited to 'R Scripts/generate-dag-dat.R') diff --git a/R Scripts/generate-dag-dat.R b/R Scripts/generate-dag-dat.R index a2df165..adef5f6 100755 --- a/R Scripts/generate-dag-dat.R +++ b/R Scripts/generate-dag-dat.R @@ -1,46 +1,60 @@ library(igraph) -setwd("~/Documents/Cascade Project/") -load('Results/hyper-lcc.RData') - -vic_ids = which(V(hyp_lcc)$vic==TRUE) - -edgeWeights = function(eis){return(c(hyp_lcc_edges$weight[eis],Inf,Inf)[1:3])} - -dag_dat_all = data.frame(matrix(nrow=1,ncol=10)) -hyp_lcc2 = remove.edge.attribute(hyp_lcc,'weight') -ei = 1 -ptm=proc.time() -for (u in vic_ids){ - if ((which(vic_ids==u) %% 1000)==0) print(which(vic_ids==u)) - tu = hyp_lcc_verts$vic.day[u] - u_spawn = hyp_lcc_verts$spawn.date[u] - nbhd = unlist(neighborhood(hyp_lcc,nodes=u,order=3)) # get nodes within neighborhood - nbhd = nbhd[-1] # don't want to include u in the neighborhood - tvs = hyp_lcc_verts$vic.day[nbhd] - v_spawn = hyp_lcc_verts$spawn.date[nbhd] - nbhd = nbhd[tu>v_spawn & (is.na(tvs) | tu