Add Covariates to a Statslist Array
Combines scalars and vectors to statslist arrays using a wrapper for
abind() in the abind package.
A list of lists containing the covariates, see details
A statslist object, possibly passed from
Indicates where the combining is going to occur in statslist. 1 for global, 2 for local.
Additional methods passed to
The length AND actor-order of the covar list must equal that of the statslist. Currently, no check is made to ensure that the actor-order is maintained, though an object length error will be returned in many faulty cases. Also, note that the number of covariates in each element of covar (i.e., for each actor) should be the same for proper model identification (also not currently checked).
Actor-level covariates are passed as single values and event-level covariates are passed as vectors. That is, each sub-element (covariate) of the covar list must either be a scalar or a vector with length equal to
names(covar$actor) (for any and each actor) is NULL, then
slbind.cov() will generate names using the
make.names=TRUE parameter, as discussed in the
slbind.cov can accept
Christopher Steven Marcum
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
rawevents<-sample(rep(c("ran","eat","stay","eat","ran","play"),50)) actors<-rep(c("Jim","Bill","Pete"),100) evmat<-cbind(rawevents,actors) eventlist<-gen.evl(evmat) beta.ints<-gen.intercepts(eventlist) ##Make up some covariates covar<-list() covar$Bill$rate<-sort(rexp(length(eventlist$eventlist$Bill))) covar$Bill$smokes<-1 covar$Jim$rate<-sort(rexp(length(eventlist$eventlist$Jim))) covar$Jim$smokes<-0 covar$Pete$rate<-sort(rexp(length(eventlist$eventlist$Pete))) covar$Pete$smokes<-0 statslist.new<-slbind.cov(covar,beta.ints) statslist.new[][][,1,]
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.