Package leiv. R topics documented: February 20, Version Type Package

Similar documents
Package bivariate. December 10, 2018

Package MonoPoly. December 20, 2017

Package msir. R topics documented: April 7, Type Package Version Date Title Model-Based Sliced Inverse Regression

Package depth.plot. December 20, 2015

Package SK. May 16, 2018

Package EMVS. April 24, 2018

Package BayesNI. February 19, 2015

Package sbgcop. May 29, 2018

Package BNN. February 2, 2018

Package SpatPCA. R topics documented: February 20, Type Package

Package idmtpreg. February 27, 2018

Package mpmcorrelogram

Package pearson7. June 22, 2016

Package bpp. December 13, 2016

Package gtheory. October 30, 2016

Package ltsbase. R topics documented: February 20, 2015

Package ForwardSearch

Package RootsExtremaInflections

Package FDRSeg. September 20, 2017

Package bayeslm. R topics documented: June 18, Type Package

Package tspi. August 7, 2017

Package CEC. R topics documented: August 29, Title Cross-Entropy Clustering Version Date

Package clogitboost. R topics documented: December 21, 2015

Package ExtremeBounds

Package invgamma. May 7, 2017

Package sscor. January 28, 2016

Package effectfusion

Package Select. May 11, 2018

Package lomb. February 20, 2015

Package TwoStepCLogit

Package basad. November 20, 2017

Package horseshoe. November 8, 2016

Package rnmf. February 20, 2015

Package CorrMixed. R topics documented: August 4, Type Package

Package beam. May 3, 2018

Package MicroMacroMultilevel

Package monmlp. R topics documented: December 5, Type Package

Package face. January 19, 2018

Package blme. August 29, 2016

Package survidinri. February 20, 2015

Package severity. February 20, 2015

Package bhrcr. November 12, 2018

Package EBMAforecast

Package IUPS. February 19, 2015

Package misctools. November 25, 2016

Package noncompliance

Package pssm. March 1, 2017

Package PolynomF. May 17, 2018

Package esaddle. R topics documented: January 9, 2017

Package elhmc. R topics documented: July 4, Type Package

Package timelines. August 29, 2016

Package covtest. R topics documented:

Package gma. September 19, 2017

Package bigtime. November 9, 2017

Package AID. R topics documented: November 10, Type Package Title Box-Cox Power Transformation Version 2.3 Date Depends R (>= 2.15.

Package robustrao. August 14, 2017

The sbgcop Package. March 9, 2007

Package MultisiteMediation

Package goftest. R topics documented: April 3, Type Package

Package drgee. November 8, 2016

Package investr. August 29, 2016

Package shrink. August 29, 2013

Package RTransferEntropy

Package LIStest. February 19, 2015

Package ebal. R topics documented: February 19, Type Package

Package CoxRidge. February 27, 2015

Package SimCorMultRes

Package clr. December 3, 2018

Package chemcal. July 17, 2018

Package generalhoslem

Package CBPS. March 10, 2018

Package sindyr. September 10, 2018

Package gk. R topics documented: February 4, Type Package Title g-and-k and g-and-h Distribution Functions Version 0.5.

M. H. Gonçalves 1 M. S. Cabral 2 A. Azzalini 3

Package plspolychaos

Package locfdr. July 15, Index 5

Package sklarsomega. May 24, 2018

Package supernova. February 23, 2018

Package neuralnet. August 16, 2016

Metric Predicted Variable on Two Groups

Package scio. February 20, 2015

Package matrixnormal

Package varband. November 7, 2016

Package reinforcedpred

Package G2Sd. R topics documented: December 7, Type Package

Package convospat. November 3, 2017

Package epr. November 16, 2017

Package BGGE. August 10, 2018

Package scpdsi. November 18, 2018

Package rgabriel. February 20, 2015

Package ForecastCombinations

Package ShrinkCovMat

Package IsingFit. September 7, 2016

Package diffeq. February 19, 2015

Package NlinTS. September 10, 2018

Package milineage. October 20, 2017

Package nardl. R topics documented: May 7, Type Package

Package polypoly. R topics documented: May 27, 2017

Package FDRreg. August 29, 2016

Package ensemblepp. R topics documented: September 20, Title Ensemble Postprocessing Data Sets. Version

Transcription:

Version 2.0-7 Type Package Package leiv February 20, 2015 Title Bivariate Linear Errors-In-Variables Estimation Date 2015-01-11 Maintainer David Leonard <davidsleonard@outlook.com> Depends R (>= 2.9.0) Imports methods, stats, graphics Suggests grdevices Description Estimate the slope and intercept of a bivariate linear relationship by calculating a posterior density that is invariant to interchange and scaling of the coordinates. License GPL (>= 2) URL http://www.r-project.org Author David Leonard [aut, cre] NeedsCompilation no Repository CRAN Date/Publication 2015-01-11 16:53:08 R topics documented: leiv............................................. 2 leiv-internal......................................... 5 Index 6 1

2 leiv leiv Bivariate Linear Errors-In-Variables Estimation Description Usage Generates a linear errors-in-variables object. leiv(formula, data, subset, prior = NULL, n = NULL, cor = NULL, sdratio = NULL, xmean = 0, ymean = 0, probintcalc = FALSE, level = 0.95, subdivisions = 100, rel.tol =.Machine$double.eps^0.25, abs.tol = 0.1*rel.tol,...) ## S4 method for signature leiv print(x, digits = max(3, getoption("digits") - 3),...) ## S4 method for signature leiv,missing plot(x, plottype = "density", xlim = NULL, ylim = NULL, xlab = NULL, ylab = NULL, col = NULL, lwd = NULL,...) Arguments formula data subset prior n cor, sdratio xmean, ymean probintcalc level subdivisions an optional object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given in the Details section of the documentation for lm. An intercept is always included and integrated out as a nuisance parameter: y ~ x, y ~ 0 + x, and y ~ x - 1 are equivalent. If not provided, the sufficient statistics n, cor, and sdratio must be provided. an optional data frame (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which leiv is called. an optional vector specifying a subset of observations to be used in the fitting process. an optional object of class leiv to use as the prior density of the scale invariant slope; otherwise the rotationally invariant Cauchy density is used. an optional sample size (if formula is missing). optional sample correlation cor(x,y) and ratio sd(y)/sd(x) (if formula is missing). optional sample means mean(x) and mean(y) (if formula is missing). logical; if TRUE returns the shortest (100*level)% probability intervals; if FALSE (the default) no probability intervals are returned. the probability level requested (if probintcalc = TRUE). the maximum number of subintervals (see integrate).

leiv 3 rel.tol abs.tol x digits the relative accuracy requested (see integrate). the absolute accuracy requested (see integrate). a leiv object. controls formating of numeric objects. plottype specifies the type of plot; if plottype = "density" (the default) then the posterior density of the slope is plotted; if plottype = "scatter" then a scatter plot with the fitted line. xlim, ylim xlab, ylab col, lwd x limits c(x1,x2) and y limits c(y1,y2) of the plot. labels for the x and y axes of the plot. color and width of plotted lines.... additional argument(s) for generic methods. Details Use leiv to estimate the slope and intercept of a bivariate linear relationship when both variables are observed with error. The method is exact when the true values and the errors are normally distributed. The posterior density depends on the data only through the correlation coefficient and ratio of standard deviations; it is invariant to interchange and scaling of the coordinates. Value leiv returns an object of class "leiv" with the following components: slope intercept slopeint interceptint density n cor sdratio xmean ymean call probintcalc level x y the (posterior median) slope estimate. the (maximum likelihood) intercept estimate. the shortest (100*level)% probability interval of the slope. the shortest (100*level)% probability interval of the intercept. the posterior probability density function. the number of (x,y) pairs. the sample correlation cor(x,y). the ratio sd(y)/sd(x). the sample mean mean(x). the sample mean mean(y). the matched call. the logical probability interval request. the probability level of the probability interval. the x data. the y data.

4 leiv Note Numerical integration is used to normalize the posterior density. When the data is nearly linear, normalization using the default tolerance parameters may fail. Specifying abs.tol = 1e-6 (or smaller) may help, but expect a longer run time. In general, rel.tol cannot be less than max(50*.machine$double.eps, 0.5e-28) if abs.tol <= 0. In addition, when using a sharply peaked leiv object as a prior density, normalization may fail. In this case, an alternative is to first fit using the default Cauchy prior, then multiply by the appropriate ratio of prior densities and tackle the normalization outside of the leiv environment. Author(s) David Leonard References Leonard, David. (2011). Estimating a Bivariate Linear Relationship. Bayesian Analysis, 6:727-754. DOI:10.1214/11-BA627. Zellner, Arnold. (1971). An Introduction to Bayesian Inference in Econometrics, Chapter 5. John Wiley & Sons. See Also lm for formula syntax; integrate for control parameters. Examples ## generate artificial data set.seed(1123) n <- 20 X <- rnorm(n, mean=5, sd=4) # true x x <- X + rnorm(n, mean=0, sd=5) # observed x Y <- 2 + X # true y y <- Y + rnorm(n, mean=0, sd=3) # observed y ## fit with default options fit <- leiv(y ~ x) print(fit) plot(fit) # density plot dev.new() plot(fit,plottype="scatter") ## calculate a density to use as an informative prior density of ## the scale invariant slope in a subsequent fit fit0 <- leiv(n=10, cor=0.5, sdratio=1.0) print(fit0) ## refit the data using the informative prior density fit1 <- leiv(y ~ x, prior=fit0, abs.tol=1e-6) print(fit1)

leiv-internal 5 leiv-internal Probability Density Utilities Description Usage p50 calculates the median of the leiv posterior probability density. probint calculates the shortest probability interval of the leiv posterior probability density for a given probability level. p50(p, interval, subdivisions = 100, rel.tol =.Machine$double.eps^0.25, abs.tol = rel.tol) probint(p, interval, level, subdivisions = 100, rel.tol =.Machine$double.eps^0.25, abs.tol = rel.tol) Arguments p interval level subdivisions rel.tol abs.tol a normalized probability density function. a vector containing the endpoints of the interval to be searched. the probability level requested. the maximum number of subintervals (see integrate). the relative accuracy requested (see integrate). the absolute accuracy requested (see integrate, optimize and uniroot). Details Value Note Internal functions for integrating the posterior density returned by the function leiv. These functions are not meant to be called by the user. p50 returns a numeric scalar. probint returns a 2-dimensional numeric vector of interval endpoints. p must accept a vector of inputs and produce a vector of function evaluations at those points. rel.tol cannot be less than max(50*.machine$double.eps, 0.5e-28) if abs.tol <= 0. See Also leiv for general information; integrate for control parameters.

Index Topic models leiv, 2 Topic regression leiv, 2 as.data.frame, 2 formula, 2 integrate, 2 5 leiv, 2, 5 leiv-class (leiv), 2 leiv-internal, 5 leiv-package (leiv), 2 lm, 2, 4 numeric, 3 optimize, 5 p50 (leiv-internal), 5 plot,any,any-method (leiv), 2 plot,leiv,missing-method (leiv), 2 plot-methods (leiv), 2 print,any-method (leiv), 2 print,leiv-method (leiv), 2 print-methods (leiv), 2 probint (leiv-internal), 5 uniroot, 5 6