R: Moment estimator for prevalence and incidence, with bootstrap...
PIR_MOM
R Documentation
Moment estimator for prevalence and incidence, with bootstrap confidence intervals
Description
Estimates prevalance and incidence for two samples,
along with the ratios of each parameter, assuming that the behavior follows
an '. Also provides boostrap confidence intervals.
factor or vector indicating levels of the PIR measurements.
base_level
a character string or value indicating the name of the baseline level.
intervals
the number of intervals in the sample of observations
interval_length
the total length of each interval
rest_length
length of the portion of the interval devoted to recording. Default is 0
Bootstraps
desired number of bootstrap replicates. Default is 2000
conf_level
Desired coverage rate of the calculated confidence interval. Default is .95.
exponentiate
a logical indicating whether the row corresponding to the ratio of treatment to baseline should be exponentiated, with the default as FALSE.
seed
seed value set in order to make bootstrap results reproducible. Default is null
Details
The moment estimators are based on the assumption that the
underlying behavior stream follows an Alternating Poisson Process, in which both the
event durations and interim times are exponentially distributed.
Value
A dataframe with six columns and three rows corresponding to baseline, treatment,
and the log ratio or ratio (depending upon the value of exponentiate) of treatment to baseline
Author(s)
Daniel Swan <dswan@utexas.edu>
Examples
# Estimate prevalence and incidence ratios for Carl from the Moes dataset
data(Moes)
with(subset(Moes, Case == "Carl"),
PIR_MOM(PIR = outcome, phase = Phase, intervals = intervals,
interval_length = (active_length + rest_length), rest_length = rest_length,
base_level = "No Choice", seed = 149568373))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(ARPobservation)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ARPobservation/PIR_MOM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: PIR_MOM
> ### Title: Moment estimator for prevalence and incidence, with bootstrap
> ### confidence intervals
> ### Aliases: PIR_MOM
>
> ### ** Examples
>
> # Estimate prevalence and incidence ratios for Carl from the Moes dataset
> data(Moes)
> with(subset(Moes, Case == "Carl"),
+ PIR_MOM(PIR = outcome, phase = Phase, intervals = intervals,
+ interval_length = (active_length + rest_length), rest_length = rest_length,
+ base_level = "No Choice", seed = 149568373))
phi phi_lower_CI phi_upper_CI zeta
No Choice 0.01989908 0.0170937254 0.08279824 0.0123857478
Choice 0.03855950 0.0006846493 0.12589398 0.0001441582
log(Choice/No Choice) 0.66152880 -4.4288275175 1.73056722 -4.4533901025
zeta_lower_CI zeta_upper_CI
No Choice 5.504780e-03 0.0145001301
Choice 5.655107e-05 0.0005555887
log(Choice/No Choice) -5.456705e+00 -2.8237196726
>
>
>
>
>
> dev.off()
null device
1
>