Learn R Programming

informR (version 1.0-5)

slbind.cond: Add ActorXEvent Conditional or Interaction Variables to a Statslist Array

Description

Combines a single actor-level attribute with sufficient statistics from a statslist array using a wrapper for abind() in the abind package.

Usage

slbind.cond(intvar, statslist, var.suffix, sl.ind=NULL,who.evs=NULL,type = 1,...)

Arguments

intvar
An actor-level numeric variable. See Details.
statslist
A statslist object, possibly passed from gen.intercepts.
var.suffix
A character string naming the new variable(s).
sl.ind
A numeric vector containing the statslist column indices to be interacted with intvar. Defaults to all columns. See Details.
who.evs
If type=2, a numeric vector indexing where to apply the interaction. Optional.
type
Indicates where the combining is going to occur in statslist. 1 for global, 2 for local.
...
Additional methods passed to abind().

Details

For global statistics, length(intvar)==length(statslist) must be true. Because current functionality allows for only single vectors, the user must iterate over all levels of factors with more than two levels. Thus, this is truly a _single variable_ function and care must be taken.

The sl.ind parameter should be carefully specified as improper interactions can result in over-identified or unidentifiable models.

See Also

slbind, abind,slbind.cov

Examples

Run this code
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)


statslist.new<-slbind.cond(intvar=c(1,0,0),beta.ints,var.suffix="Jim")
statslist.new[[1]][[1]][1,,]
statslist.new[[2]][[1]][1,,]
statslist.new[[3]][[1]][1,,]

Run the code above in your browser using DataLab