Description Usage Arguments Details Value Note Examples
Returns a data.table of a time varying behavior variable
1 |
pSIDs |
A numeric vector of SIDs of the individuals in this Analysis Set (i.e. for example, created by 'getNetworkSet'). Ensures the table created is consistent with such a set. |
pVar |
A string giving the name of the variable to create. These are defined in 'getNQTVCs'. Options are listed below. |
pCut |
A numeric vector of cut points for classifying values of the requested variable (see Base R function 'cut'). Intervals are closed on the left, open on the right. |
pMaxNA |
The maximum number of NAs among the variable's items before the returned value for the particular subject-wave is set to NA |
pCCTbl |
A dataframe or data.table of all the time-varying covariates in long-form (1 row per subject per wave) produced by the function 'getNQTVCs'. It is an image of the database table PInf1.dbo.SWave. |
May be used to create tables that can be easily converted to SAOM dependent behavior or time-varying covariate (predictor) variables by just selecting the last w columns (see example below). Generally such variables will be consistent with a network Analysis Set (of individuals) produced by 'getNetworkSet', in which case 'pSIDs' can simply be taken from the last list element of the output of the latter function. Of course, if you wanted to create variables for any longitudinal analysis (i.e. score them, select the individuals and waves you wanted), you could use this function as well, but you would need to generate the pSIDs by directly executing 'getSIDSet'.
The output table format is w+1 columns (w=#waves present in pCCTbl); first column is an ordered set of SIDs, columns 2:(w+1) are the scored (mean of items) value of the requested behaivor variable for the w waves.
Choices for pVar are defined in 'getTVCCols'. They are: AB (Antisocial behavior), OV (Others victimization of you), YV (You victimizing others), T3 (Tobacco, freq of use in last 30 days), E3 (E-tobacco, freq of use in last 30 days), C3 (Chewing Tobacco, freq of use in last 30 days), A3 (Alcohol, freq of use in last 30 days), B3 (Binge drinking, freq in last 30 days), M3 (Marijuana use, freq in last 30 days), AL (Alcohol, freq of use, lifetime up to now). BL (Binge drinking, freq of use, lifetime up to now). ML (Marijuana use, freq of use, lifetime up to now).
1 2 3 4 5 6 7 8 9 10 11 12 | # When the network part of an analysis set is created by 'getNetworkSet',
# the last element of the output is a vector of participating SIDs. We
# use that as part of the input to the present function.
netList <- getNetworkSet(pWavVec = c(1,3,4), pSchVec = c(3,4,5,6,30),
pElig = 2, pDid = 2, pTyp = "BF", pOut = "SP", pS0 = "S0")
# Create the time varying behavior table
ccTbl <- getNQTVCs(pWavVec = c(1,3,4), pSchVec = c(3,4,5,6,30))
# Creates a data.table of antisocial behavior variables x subject & wave,
# for the 3 waves & other criteria used above, grouped into 4 categories,
# and with no more than 3 NAs out of the 6 items.
abTbl <- makeTVTbl(ccTbl, netList[[4]], pVar = "AB",
pCut = c(0, .5, 1, 5, 20), pMaxNA = 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.