Last data update: 2014.03.03

R: Print the results of a bootstrap model run to screen
print.PTE_bootstrap_resultsR Documentation

Print the results of a bootstrap model run to screen

Description

Prints p-values and confidence intervals to the screen for both the random and best business-as-usual allocation procedures.

Usage

## S3 method for class 'PTE_bootstrap_results'
print(x, ...)

Arguments

x

An object of class “PTE_bootstrap_results”.

...

Parameters that are ignored.

Author(s)

Adam Kapelner and Justin Bleich

References

Kapelner, A, Bleich, J, Cohen, ZD, DeRubeis, RJ and Berk, R (2014) Inference for Treatment Regime Models in Personalized Medicine, arXiv

See Also

bootstrap_inference

Examples

	beta0 = 1
	beta1 = -1
	gamma0 = 0
	gamma1 = sqrt(2 * pi)
	mu_x = 0
	sigsq_x = 1
	sigsq_e = 1
	num_boot = 20 #for speed only
	n = 50 #for speed only
	
	x = sort(rnorm(n, mu_x, sigsq_x))
	noise = rnorm(n, 0, sigsq_e)
	
	treatment = sample(c(rep(1, n / 2), rep(0, n / 2)))
	y = beta0 + beta1 * x + treatment * (gamma0 + gamma1 * x) + noise
	
	X = data.frame(treatment, x)
	
	res = bootstrap_inference(X, y,
			"lm(y ~ . + treatment * ., data = Xyleft)",
			num_cores = 1,
			B = num_boot, 
			plot = FALSE)
	print(res)

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(PTE)
Loading required package: doParallel
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel
Welcome to PTE v1.0 by Adam Kapelner and Justin Bleich

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PTE/print.Rd_%03d_medium.png", width=480, height=480)
> ### Name: print.PTE_bootstrap_results
> ### Title: Print the results of a bootstrap model run to screen
> ### Aliases: print.PTE_bootstrap_results
> 
> ### ** Examples
> 
> 	beta0 = 1
> 	beta1 = -1
> 	gamma0 = 0
> 	gamma1 = sqrt(2 * pi)
> 	mu_x = 0
> 	sigsq_x = 1
> 	sigsq_e = 1
> 	num_boot = 20 #for speed only
> 	n = 50 #for speed only
> 	
> 	x = sort(rnorm(n, mu_x, sigsq_x))
> 	noise = rnorm(n, 0, sigsq_e)
> 	
> 	treatment = sample(c(rep(1, n / 2), rep(0, n / 2)))
> 	y = beta0 + beta1 * x + treatment * (gamma0 + gamma1 * x) + noise
> 	
> 	X = data.frame(treatment, x)
> 	
> 	res = bootstrap_inference(X, y,
+ 			"lm(y ~ . + treatment * ., data = Xyleft)",
+ 			num_cores = 1,
+ 			B = num_boot, 
+ 			plot = FALSE)

> 	print(res)
    I_adversarial observed est = 2.186,  p val = 0, 
      95% CI's: pctile = [1.404, 2.628], BCa = [1.217, 2.575],
    I_random observed_est = 1.268,  p val = 0, 
      95% CI's: pctile = [0.839, 1.675], BCa = [0.747, 1.57],
    I_best observed_est = 1.183,  p val = 0, 
      95% CI's: pctile = [0.601, 1.618], BCa = [0.588, 1.485]
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>