eive.cga.formula: Performs CGA based errors-in-variables correction for given...

View source: R/eive.R

eive.cga.formulaR Documentation

Performs CGA based errors-in-variables correction for given formula and data. A single independent variable is supposed to be measured subject to error.

Description

Performs CGA based errors-in-variables correction for given formula and data. A single independent variable is supposed to be measured subject to error.

Usage

eive.cga.formula(formula, data, dirtyx.varname, numdummies = 10, popsize = 20)

Arguments

formula

Formula object.

data

data.frame that holds the regression data.

dirtyx.varname

String key value of the erroneous independent variable.

numdummies

Number of dummy variables used in auxiliary regression.

popsize

Population size parameter for compact genetic algorithm. 1/popsize is the mutation rate.

Value

A list() of regression equations.

Slots

ols

lm object calculated using original values

eive

lm object calculated using the predicted variable by eive

proxy

lm object of proxy regression obtained by genetic search.

cleanedx

Error-free estimate of the x variable (dirtyx) that is measured with error.

measurementerror

Estimate of the measurement error.

See Also

eive.cga

Examples

set.seed(12345)
n <- 30
clean_x <- rnorm(n, mean = 10, sd = sqrt(7))
delta_x <- rnorm(n, mean = 0, sd = sqrt(3))

e <- rnorm(n, mean = 0, sd = sqrt(5))
y <- 20 + 10 * clean_x + e

dirty_x <- clean_x + delta_x

mydata <- data.frame(y = y, dirtyx = dirty_x)

result <- eive.cga.formula(
     formula = y ~ dirtyx,
     dirtyx.varname = "dirtyx",
     data = mydata,
     numdummies = 10
)

eive documentation built on Aug. 21, 2023, 5:11 p.m.