REGRM: REGRM: Robust estimator for a generalized ratio model by...

Description Usage Arguments Details Value Examples

View source: R/REGRM.r

Description

REGRAM function integrates 12 functions below included in RrT.r and RrH.r for easy use for users. Please note that the values for the tuning parameter c2 allowed in this function is standardized and limited. If you prefer to use other values, please use the functions contained in RrT.r and/or RrH.r directly. The turning parameters of those functions are not standardized.

Usage

1
2
REGRM(x1, y1, gm = "b", wf = "T", scale = "AAD", c2 = 8,
  rp.max = 100, cg.rt = 0.01)

Arguments

x1

single explanatory variable

y1

objective variable to be imputed

gm

indication of gamma value as follows:
gm="a": gamma=1
gm="b": gamma=1/2 (conventional ratio model)
gm="c"; gamma=0 (regression model without intercept)

wf

weight function (wf=T : Tukey, wf=H : Huber)

scale

scale parameter (scale=AAD; scale=MAD)

c2

tuning parameter (c2=4, 6, 8) for weight function. Smaller figure is more robust.

rp.max

maximum number of iteration

cg.rt

convergence condition to stop iteration (default: cg1=0.001)

Details

Child functions included RrT.r using Tukey's biweight function and RrH.r of Huber weight function. AAD stands for Average Absolute Deviation and MAD, Median Absolute Deviation.

Value

a list with the following elements

par

robustly estimated ratio of y1 to x1 (beta)

res

homoscedastic quasi-residuals

wt

robust weights

rp

total number of iteration

s1

changes of the scale (AAD or MAD)

efg

error flag. 1: acalculia (all weights become zero) 0: successful termination

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
require(REGRM)

x <- seq(1, 10, by=0.1)
#e <- rnorm(length(x))
e <- rt(length(x), df=3)   # error term following t distribution

b <- 2		# true value of slope

y1 <- b*x + x*e			# example 1: gamma=1
y2 <- b*x + sqrt(x)*e   # example 2: gamma=1/2

o1 <- REGRM(x, y1, gm="a")
o2 <- REGRM(x, y2, gm="b")

o1$par;  o2$par     # estimated slope

require(RColorBrewer)
cols = brewer.pal(11, "PiYG")
cl1 <- round((o1$wt)*10+1)
cl2 <- round((o2$wt)*10+1)

par(mfrow=c(1,2))
plot(x, y1, col=cols[cl1], pch=20)
plot(x, y2, col=cols[cl2], pch=20)

## End(Not run)

kazwd2008/REGRM documentation built on Nov. 20, 2019, 9:46 a.m.