# NOT RUN {
##load dataset
data(datamsaeDB)
#Compute Fitted model for Y1, Y2, and Y3
#Y1 ~ X1 + X2
#Y2 ~ X2
#Y3 ~ X1
##Using parameter 'data'
formula = list(f1 = Y1~X1+X2,
f2 = Y2~X2,
f3 = Y3~X1)
vardir = c("v1","v12","v13","v2","v23","v3")
#Note : in real data for univariate SAE, if you does not have the values of covariances,
# set covariancse as zero in the dataframe
weight = c("w1","w2","w3")
saeDB <- saedb(formula, vardir, weight, data=datamsaeDB)
#to calculate only one response variable
saeDB1 <- saedb(formula=list(f1=Y1~X1+X2),vardir ="v1", weight="w1",data=datamsaeDB )
##Do not use parameter 'data'
formula = list(f1 = datamsaeDB$Y1~datamsaeDB$X1+datamsaeDB$X2,
f2 = datamsaeDB$Y2~datamsaeDB$X2,
f3 = datamsaeDB$Y3~datamsaeDB$X1)
vardir = datamsaeDB[,c("v1","v12","v13","v2","v23","v3")]
#Note : in real data for univariate SAE, if you does not have the values of covariances,
# set covariancse as zero in the dataframe
weight = datamsaeDB[,c("w1","w2","w3")]
saeDB_d <- saedb(formula, vardir, weight = weight)
saeDB$SAE_Eblup #to see EBLUP Estimators
saeDB$MSE_Eblup #to see estimated MSE of EBLUP estimators
saeDB$difference_benchmarking$Estimation #to see Benchmarked EBLUP Estimators
saeDB$difference_benchmarking$MSE_DB #to see estimated MSE of Benchmarked EBLUP Estimators
saeDB$difference_benchmarking$Aggregation #to see the aggregation of, benchmarking
# }
Run the code above in your browser using DataLab