recounter: The recounting function

Description Usage Arguments Value Examples

View source: R/funs.R

Description

The heart of the reinforcinator. This function replicates the rows of the dataframe according to the number of reinforcers in the behaviorstream variable. The function produces the 'recounted dataframe' which contains two new columns, 'Sub-Series', which indicates which reinforcer the observations are recounted by, and 'Sequence' which indicates whether the behavior occurs before or after the given reinforcer corresponding to that sub-series.

If there are 3 reinforcers, then there will be 3 sub-series based on reinforcers with a unique index in the original series. All observations will be classified as occuring before or after the index position of a given reinforcer corresponding to a given sub-series.

Usage

1
2
recounter(data, behaviorstream, "behavior", "consequence",
actor = NULL, missing_data = NULL, contingency = NULL )

Arguments

data

A dataframe or tibble

behaviorstream

A column representing the observation stream. Contains actor behaviors and environmental (or partner) consequences

behavior

A character string indicating the target behavior to be reinforced

consequence

A character string indicating the environmental consequence acting as a reinforcer

actor

An optional argument indicating the column containing the actor ID

missing_data

An optional argument specifying if missing observations have been removed

contingency

An optional argument indicating if reinforcers must be contingent or contiguous to target behaviors

Value

Returns a two item list of lists, containing descriptive statistics and recounted data frame. Descriptive statistics is a list that contains:

n_obs

number of total observations

n_tar

number of target behaviors

n_reinf

number of reinforcers

n_actor

number of unique actor ID

n_cont

number of reinforcers occuring contiguous with target behavior

reinf_index

the observation corresponding to each reinforcer

contingency_index

The observation corresponding to each contiguous reinforcer

na_index

The observations corresponding to missing values

prob_tar_uncorrected

The probability of target behavior across all observations

prob_tar_corrected

The probability of target behavior across all observations

The recounted_data_frame is a dataframe with n*r reclassified observations containing the following variables:

recount_stream

The original observation stream replicated n_obs*n_reinf times

sub_series

The repetition number (corresponding to a reinforcer)

recount_stream_index

The index in the recounted stream (resets for each sub-series)

recount_recode_stream

The DV for a reinforcer analysis (target and non-target observations are recoded as 1 and 0, respectively)

recount_sequence

A factor variable that contains the classification of observations as Before (B) or After (A) the reinforcer j corresponding to the jth sub-series

recount_actor

The actor variable which has been recounted n_reinf*n_obs times

regression_recount_sequence

The recounted sequence where all reinforcers have been recoded as NA (to be removed when performing regression analysis)

Examples

1
2
3
4
5
# descriptive statistics
recounted_elevator_descriptives<-recounter(elevator, BEH,"o","A")$descriptive_statistics

# recounted data frame
recounted_elevator_recounted_df<-recounter(elevator, BEH,"o","A")$recounted_data_frame

delaneyj1786/REINFORCINATOR documentation built on Jan. 14, 2022, 3:47 a.m.