W.rec: general month in sample estimates weights for recursive...

Description Usage Arguments Value Examples

View source: R/composite.R

Description

general month in sample estimates weights for recursive linear combinaison of mis estimates

Usage

1
2
3
4
5
6
7
W.rec(
  months,
  groups,
  S = c(2:4, 6:8),
  S_1 = S - 1,
  Coef = c(alpha_1 = 0, alpha0 = 1, beta_1 = 0, beta0 = 0, gamma0 = 0)
)

Arguments

months

an integer, indicating number of months

groups

a vector of character strings or numeric string

S

a vector of integers indicating the indices of the rotation group in the sample that overlap with the previous sample: groups[S] are the overlapping rotation groups

S_1

a vector of integers indicating the indices of the corresponding rotation group of S in the previous month

Coef

a named vector of 5 numeric value

nmonth

an integer, indicating number of months

ngroup

a vector of character strings or numeric string

Value

an array of AK coefficients W[m2,m1,mis1] such that Ak estimate for month m2 is sum(W[y2,,])*Y) where Y[m1,mis1] is direct estimate on mis mis1 for emp stat y1 at month m1.

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
alpha0=runif(1);
alpha_1=1-alpha0;
beta0=runif(1)
beta_1=runif(1)
gamma0=runif(1)
W<-W.rec(months=1:3,
         groups=1:8,
         Coef=c(alpha_1=alpha_1,
                alpha0=alpha0,
                beta0=beta0,
                beta_1=beta_1,
                gamma0=gamma0))
dimnames(W) 
if(all(W[1,1,]==1)){"this part is fine"}else{"there is a problem"}    
m<-sample(2:3,1)
if(all(abs(W[m,m,c(1,5)]-(alpha0+gamma0))<1e-10)){"this part is fine"}else{"there is a problem"}    
if(all(abs(W[m,m,c(2:4,6:8)]-(alpha0+beta0))<1e-10)){"this part is fine"}else{"there is a problem"}    
if(all(abs(W[m,m-1,c(1:3,5:7)]-(alpha_0*W[m-1,m-1,c(1:3,5:7)]+beta_1))<1e-10)){"this part is fine"}else{"there is a problem"}    
if(all(abs(W[m,m-1,c(4,8)]-(alpha_0*W[m-1,m-1,c(4,8)]))<1e-10)){"this part is fine"}else{"there is a problem"}    
W<-W.ak(months=2:4,groups=letters[1:8],a=.2,k=.5);dimnames(W);
Y<-WSrg(list.tables,weight="pwsswgt",list.y="pemlr",rg="hrmis")
dimnames(Y);month="m";group="hrmis";variable="y";
Coef=c(alpha_1=0,alpha0=1,beta_1=0,beta0=0,gamma0=0)
W=W.rec(months = dimnames(Y)[[month]],
        groups = dimnames(Y)[[group]],
        S=c(2:4,6:8),Coef=c(alpha_1=0,alpha0=1,beta_1=0,beta0=0,gamma0=0))
W

DanielBonnery/CompositeRegressionEstimation documentation built on June 17, 2020, 12:16 p.m.