Miscellaneous Utility Rfuncs
Developing regular Rfuncs sometimes involves creating smaller utility functions. Those that seem useful on their own have been upgraded to Rfuncs. Click on their names to view fuller descriptions and to download.
EasyBetaParms()
Finds a > 1 and b > 1 parameters for unimodal distribution, X ~ beta(a,b), where (a, b) correspond to (shape1, shape2) for pbeta(shape1, shape2) in R's base stats. Comments within this Rfunc's code summarize the theory. The example uses EasyBetaParms() to specify the prior distribution for a beta-binomial Bayesian solution for the one-sample proportion problem.
Finds a > 1 and b > 1 parameters for unimodal distribution, X ~ beta(a,b), where (a, b) correspond to (shape1, shape2) for pbeta(shape1, shape2) in R's base stats. Comments within this Rfunc's code summarize the theory. The example uses EasyBetaParms() to specify the prior distribution for a beta-binomial Bayesian solution for the one-sample proportion problem.
EasyWeibullParms()
An easy way for mere humans to specify the Weibull(a,b) distribution as parameterized in base R/stats by dweibull(), pweibull(), etc. Comments within this Rfunc's code summarize the theory. The final example (#5) deals with a Monte Carlo study to perform a sample-size analysis of a Cox-model survival analysis with right-censoring.
An easy way for mere humans to specify the Weibull(a,b) distribution as parameterized in base R/stats by dweibull(), pweibull(), etc. Comments within this Rfunc's code summarize the theory. The final example (#5) deals with a Monte Carlo study to perform a sample-size analysis of a Cox-model survival analysis with right-censoring.
FitterFormat()
A fitter (better) general formatter. Converts numeric X objects, including matrices, to character objects with elements having the same reasonable number of decimal places. P-values are handled appropriately, too, e.g. 0.0001234 and 0.99912 are by default transformed to <0.001 and >0.999, respectively. Values may also be re-expressed using scientific notation with the form "1.2 x 10^-8" rather than R's customary "1.23456e-08". See the many examples.
A fitter (better) general formatter. Converts numeric X objects, including matrices, to character objects with elements having the same reasonable number of decimal places. P-values are handled appropriately, too, e.g. 0.0001234 and 0.99912 are by default transformed to <0.001 and >0.999, respectively. Values may also be re-expressed using scientific notation with the form "1.2 x 10^-8" rather than R's customary "1.23456e-08". See the many examples.
LogNormal()
Based on the median and the relative spread, generates random values ($y), cumulative probabilities ($p.y), quantiles ($y.q), and densities(f.y), for the logNormal() distribution. Also prints and returns various features of the distribution, including its mean, mode, standard deviation, skewness, kurtosis, and coefficient of variation.
Based on the median and the relative spread, generates random values ($y), cumulative probabilities ($p.y), quantiles ($y.q), and densities(f.y), for the logNormal() distribution. Also prints and returns various features of the distribution, including its mean, mode, standard deviation, skewness, kurtosis, and coefficient of variation.