An Application to HB Rao yu Model Under Beta Distribution On sampel dataset

Load package and data

library(saeHB.panel.beta)
data("dataPanelbeta")

Fitting Model

dataPanelbeta <- dataPanelbeta[1:25,] #for the example only use part of the dataset
area <- max(dataPanelbeta[,2])
period <- max(dataPanelbeta[,3])
result<-Panel.beta(ydi~xdi1+xdi2,area=area, period=period ,iter.mcmc = 10000,thin=5,burn.in = 1000,data=dataPanelbeta)
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 25
#>    Unobserved stochastic nodes: 62
#>    Total graph size: 359
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 25
#>    Unobserved stochastic nodes: 62
#>    Total graph size: 359
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 25
#>    Unobserved stochastic nodes: 62
#>    Total graph size: 359
#> 
#> Initializing model

Extract mean estimation

Estimation

result$Est
#>              MEAN         SD      2.5%       25%       50%       75%     97.5%
#> mu[1,1] 0.9745394 0.02032467 0.9196403 0.9678630 0.9799217 0.9872544 0.9962433
#> mu[2,1] 0.9528525 0.03533511 0.8633264 0.9401257 0.9616857 0.9756729 0.9909826
#> mu[3,1] 0.9428583 0.04238940 0.8318842 0.9288568 0.9536615 0.9708565 0.9890756
#> mu[4,1] 0.9708958 0.02290109 0.9099395 0.9634554 0.9771220 0.9859602 0.9951416
#> mu[5,1] 0.9404820 0.05312931 0.7912444 0.9260514 0.9563701 0.9739081 0.9907127
#> mu[1,2] 0.9742505 0.02077650 0.9199186 0.9684438 0.9796287 0.9869608 0.9955201
#> mu[2,2] 0.9654101 0.02693787 0.8997948 0.9552951 0.9729059 0.9834686 0.9935027
#> mu[3,2] 0.9221692 0.05561252 0.7828949 0.9014980 0.9353133 0.9593676 0.9840833
#> mu[4,2] 0.9804308 0.01682637 0.9343907 0.9754242 0.9854750 0.9912102 0.9970460
#> mu[5,2] 0.9415131 0.04386376 0.8247628 0.9251353 0.9532883 0.9702317 0.9892811
#> mu[1,3] 0.9729660 0.02511090 0.9164914 0.9663439 0.9792295 0.9875024 0.9958207
#> mu[2,3] 0.8641312 0.08272071 0.6564128 0.8271181 0.8833103 0.9228243 0.9683622
#> mu[3,3] 0.9541804 0.03351319 0.8655450 0.9415209 0.9630033 0.9775072 0.9917784
#> mu[4,3] 0.9606170 0.02816998 0.8858931 0.9502112 0.9680919 0.9795507 0.9918632
#> mu[5,3] 0.9176149 0.05981962 0.7607663 0.8947708 0.9339211 0.9560658 0.9832303
#> mu[1,4] 0.9587342 0.03283760 0.8736190 0.9491816 0.9672685 0.9788260 0.9919387
#> mu[2,4] 0.9362001 0.04421902 0.8237930 0.9185529 0.9478893 0.9660970 0.9867294
#> mu[3,4] 0.9347808 0.04561452 0.8154320 0.9173874 0.9457589 0.9649022 0.9869820
#> mu[4,4] 0.9778340 0.01807216 0.9263352 0.9719314 0.9831270 0.9896443 0.9963062
#> mu[5,4] 0.8528990 0.09973551 0.5912323 0.8073593 0.8800971 0.9240792 0.9705535
#> mu[1,5] 0.9702248 0.02524495 0.8981021 0.9630498 0.9767606 0.9862209 0.9943411
#> mu[2,5] 0.8894055 0.07231281 0.7073370 0.8551967 0.9089355 0.9388709 0.9743677
#> mu[3,5] 0.9606366 0.03202207 0.8852703 0.9500577 0.9686724 0.9805441 0.9929505
#> mu[4,5] 0.9354250 0.04451364 0.8149769 0.9158322 0.9468882 0.9662250 0.9881979
#> mu[5,5] 0.8664220 0.08486620 0.6453459 0.8301820 0.8883803 0.9255164 0.9660902

Coefficient Estimation

result$coefficient
#>          Mean        SD      2.5%       25%      50%      75%    97.5%
#> b[0] 1.945094 0.3870171 1.1731821 1.6950801 1.949917 2.210908 2.692424
#> b[1] 1.193371 0.5202998 0.2087681 0.8404753 1.193635 1.547449 2.217941
#> b[2] 1.229798 0.4719814 0.2895790 0.9105277 1.221984 1.549474 2.132857

Random effect variance estimation

result$refvar
#> NULL

Extract MSE

MSE_HB<-result$Est$SD^2
summary(MSE_HB)
#>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
#> 0.0002831 0.0006373 0.0012486 0.0023078 0.0028227 0.0099472

Extract RSE

RSE_HB<-sqrt(MSE_HB)/result$Est$MEAN*100
summary(RSE_HB)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>   1.716   2.602   3.708   4.637   5.649  11.694

You can compare with direct estimator

y_dir<-dataPanelbeta[,1]
y_HB<-result$Est$MEAN
y<-as.data.frame(cbind(y_dir,y_HB))
summary(y)
#>      y_dir             y_HB       
#>  Min.   :0.3836   Min.   :0.8529  
#>  1st Qu.:0.9702   1st Qu.:0.9348  
#>  Median :1.0000   Median :0.9529  
#>  Mean   :0.9423   Mean   :0.9407  
#>  3rd Qu.:1.0000   3rd Qu.:0.9702  
#>  Max.   :1.0000   Max.   :0.9804
MSE_dir<-dataPanelbeta[,4]
MSE<-as.data.frame(cbind(MSE_dir, MSE_HB))
summary(MSE)
#>     MSE_dir              MSE_HB         
#>  Min.   :0.0004401   Min.   :0.0002831  
#>  1st Qu.:0.0036464   1st Qu.:0.0006373  
#>  Median :0.0228563   Median :0.0012486  
#>  Mean   :0.0256965   Mean   :0.0023078  
#>  3rd Qu.:0.0428368   3rd Qu.:0.0028227  
#>  Max.   :0.0887137   Max.   :0.0099472
RSE_dir<-sqrt(MSE_dir)/y_dir*100
RSE<-as.data.frame(cbind(RSE_dir, RSE_HB))
summary(RSE)
#>     RSE_dir           RSE_HB      
#>  Min.   : 2.098   Min.   : 1.716  
#>  1st Qu.: 6.039   1st Qu.: 2.602  
#>  Median :15.118   Median : 3.708  
#>  Mean   :16.266   Mean   : 4.637  
#>  3rd Qu.:21.629   3rd Qu.: 5.649  
#>  Max.   :59.741   Max.   :11.694