| Type: | Package | 
| Title: | Optimal Designs for Estimating the Slope Divided by the Intercept | 
| Version: | 1.1.1 | 
| Date: | 2023-07-03 | 
| Maintainer: | Adam Kapelner <kapelner@qc.cuny.edu> | 
| Description: | Aids practitioners to optimally design experiments that measure the slope divided by the intercept and provides confidence intervals for the ratio. | 
| Encoding: | UTF-8 | 
| License: | GPL-3 | 
| Depends: | R (≥ 4.0.0) | 
| Imports: | stats, graphics, MCMCpack | 
| RoxygenNote: | 7.2.3 | 
| NeedsCompilation: | no | 
| Packaged: | 2023-07-06 19:01:25 UTC; kapel | 
| Author: | Adam Kapelner  | 
| Repository: | CRAN | 
| Date/Publication: | 2023-07-07 07:40:05 UTC | 
A visualiation for comparing slope-divided-by-intercept estimates for a number of designs
Description
A visualiation for comparing slope-divided-by-intercept estimates for a number of designs
Usage
design_bakeoff(
  xmin,
  xmax,
  designs,
  gen_resp = function(xs) {
     1 + 2 * xs + rnorm(length(xs), 0, 1)
 },
  Nsim = 1000,
  l_quantile_display = 0.01,
  u_quantile_display = 0.99,
  error_est = function(est) {
     quantile(est, 0.99) - quantile(est, 0.01)
 },
  num_digits_round = 3,
  draw_theta_at = NULL,
  xlab_names = NULL,
  ...
)
Arguments
xmin | 
 The minimum value of the independent variable.  | 
xmax | 
 The maximum value of the independent variable.  | 
designs | 
 A d x n matrix where each of the d rows is a design (the x values used to run the experiment).  | 
gen_resp | 
 A model for the response which takes the design as its parameter.  | 
Nsim | 
 The number of estimates per design. Default is   | 
l_quantile_display | 
 The lowest quantile of the simulation estimates displayed. Default is   | 
u_quantile_display | 
 The highest quantile of the simulation estimates displayed. Default is   | 
error_est | 
 The error metric for the estimates. The sample standard deviation (i.e.   | 
num_digits_round | 
 The number of digits to round the error results. Default is 2.  | 
draw_theta_at | 
 If the user wishes to draw a horizontal line marking theta (to checked biasedness)
it is specified here. The default is   | 
xlab_names | 
 Text for the x-grid labels. This vector's size should equal   | 
... | 
 Additional arguments passed to the   | 
Value
A list with the simulated estimates and error estimates for each design.
Author(s)
Adam Kapelner
Examples
xmin = 5 / 15
xmax = 19 / 1
n = 10 #must be even for this demo
designs = rbind(
  c(rep(xmin, n / 2), rep(xmax, n / 2)),       #design A
  seq(from = xmin, to = xmax, length.out = n)  #design B
)
design_bakeoff_info = design_bakeoff(xmin, xmax, designs) #design A wins
Plots a standard error estimate of thetahat (slope over intercept) over a range of possible theta0 values in order to investigate robustness of the the initial theta0 guess.
Description
Plots a standard error estimate of thetahat (slope over intercept) over a range of possible theta0 values in order to investigate robustness of the the initial theta0 guess.
Usage
err_vs_theta0_plot_for_homo_design(
  n,
  xmin,
  xmax,
  theta,
  theta0_min,
  theta0_max,
  theta0 = NULL,
  beta0 = 1,
  sigma = 1,
  RES = 500,
  Nsim = 5000,
  error_est = function(est) {
     quantile(est, 0.99) - quantile(est, 0.01)
 },
  theta_logged = TRUE,
  error_pct = TRUE,
  plot_rhos = FALSE,
  ...
)
Arguments
n | 
 The number of experimental runs.  | 
xmin | 
 The minimum value of the independent variable.  | 
xmax | 
 The maximum value of the independent variable.  | 
theta | 
 The putative true value. This is used to see how much efficiency given up by designing it for   | 
theta0_min | 
 Simulating over different guesses of theta0, this is the minimum guess.  | 
theta0_max | 
 Simulating over different guesses of theta0, this is the maximum guess.  | 
theta0 | 
 The guess used to construct the experimental design. Specify only if you wish to see this 
value plotted. Default is   | 
beta0 | 
 A guess to be used for the intercept. Defaults to   | 
sigma | 
 A guess to be used for the homoskedastic variance of the measurement errors. If known accurately,
then the standard errors (i.e. the y-axis on the plot) will be accurate. Otherwise, the standard
errors are useful only when compared to each other in a relative sense. Defaults to   | 
RES | 
 The number of points on the x-axis to simulate. Higher numbers will give smoother results. Default is   | 
Nsim | 
 The number of models to be simulated for estimating the standard error at each value on the x-axis. Default is   | 
error_est | 
 The error metric for the estimates. The sample standard deviation (i.e.   | 
theta_logged | 
 Should the values of theta be logged? Default is   | 
error_pct | 
 Plot error as a percentage increase from minimum. Default is   | 
plot_rhos | 
 Plot an additional graph of rho by theta0. Default is   | 
... | 
 Additional arguments passed to the   | 
Value
A list with original parameters as well as data from the simulation
Author(s)
Adam Kapelner
Examples
xmin = 5 / 15
xmax = 19 / 1
n = 10
theta0 = 0.053
plot_info = err_vs_theta0_plot_for_homo_design(
  n, xmin, xmax, theta0, theta0_min = 0.001, theta0_max = 1
)
Report the results of the experiment as well as confidence intervals.
Description
Report the results of the experiment as well as confidence intervals.
Usage
experimental_results(xs, ys, alpha = 0.05, B = 1000)
Arguments
xs | 
 The design  | 
ys | 
 The measurements of the response  | 
alpha | 
 
  | 
B | 
 For the confidence interval methods with an embedded bootstrap (or resampling), the number
of resamples (defaults to   | 
Value
A list object containing the estimate as well as confidence intervals and parameters.
Author(s)
Adam Kapelner
Examples
n = 10 
xmin = 5 / 15
xmax = 19 / 1
xs = runif(n, xmin, xmax)
ys = 2 + 3 * xs + rnorm(n)
experimental_results_info = experimental_results(xs, ys)
This is data for the PRV measurement of the k_H of Napthalene in water. See Section 3 of our paper below for more information.
Description
This is data for the PRV measurement of the k_H of Napthalene in water. See Section 3 of our paper below for more information.
Usage
data(napth)
Format
A data frame with 100 rows and 2 variables
Author(s)
Adam Kapelner kapelner@qc.cuny.edu
References
https://arxiv.org/abs/1604.03480
Create an optimal design for measuring the slope divided by the intercept
Description
Create an optimal design for measuring the slope divided by the intercept
Usage
oed_for_slope_over_intercept(
  n,
  xmin,
  xmax,
  theta0,
  f_hetero = NULL,
  MaxIter = 6000,
  MaxFunEvals = 6000,
  TolFun = 1e-06,
  NUM_RAND_STARTS = 50
)
Arguments
n | 
 The number of experimental runs.  | 
xmin | 
 The minimum value of the independent variable.  | 
xmax | 
 The maximum value of the independent variable.  | 
theta0 | 
 The guess of the true value of the slope / intercept.  | 
f_hetero | 
 Specification of heteroskedasticity: the h(x) which relates the value of the 
independent variable to the variance in the response around the line at that place
or the proportional variance at that point. If   | 
MaxIter | 
 For the heteroskedastic design, a Nelder-Mead search is used (via the function   | 
MaxFunEvals | 
 For the heteroskedastic design, a Nelder-Mead search is used (via the function   | 
TolFun | 
 For the heteroskedastic design, a Nelder-Mead search is used (via the function   | 
NUM_RAND_STARTS | 
 For the heteroskedastic design, a Nelder-Mead search is used (via the function   | 
Value
An n-vector of x-values which specifies the optimal design
Author(s)
Adam Kapelner
Examples
xmin = 5 / 15
xmax = 19 / 1
n = 10
theta0 = 0.053
opt_homo_design = oed_for_slope_over_intercept(n, xmin, xmax, theta0)
table(opt_homo_design)
Optimal Designs for Estimating the Slope Divided by the Intercept
Description
Software which helps practitioners optimally design experiments that measure the slope divided by the intercept.
Author(s)
Adam Kapelner kapelner@qc.cuny.edu