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: 42
#>    Total graph size: 339
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 25
#>    Unobserved stochastic nodes: 42
#>    Total graph size: 339
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 25
#>    Unobserved stochastic nodes: 42
#>    Total graph size: 339
#> 
#> Initializing model

Extract mean estimation

Estimation

result$Est
#>              MEAN         SD      2.5%       25%       50%       75%     97.5%
#> mu[1,1] 0.9713731 0.02328292 0.9079123 0.9625973 0.9777934 0.9868270 0.9960250
#> mu[2,1] 0.9569757 0.03324846 0.8755690 0.9460993 0.9657183 0.9787156 0.9926591
#> mu[3,1] 0.9393633 0.04957912 0.7970808 0.9236493 0.9520683 0.9707649 0.9901039
#> mu[4,1] 0.9658961 0.02798058 0.8913413 0.9560956 0.9737534 0.9846068 0.9950255
#> mu[5,1] 0.9385088 0.05338035 0.7846902 0.9230321 0.9543239 0.9729578 0.9901186
#> mu[1,2] 0.9701842 0.02503484 0.9044870 0.9614728 0.9766194 0.9862512 0.9955072
#> mu[2,2] 0.9652112 0.02802308 0.8904712 0.9554232 0.9725827 0.9833270 0.9942910
#> mu[3,2] 0.9181959 0.06386394 0.7433878 0.8940435 0.9361087 0.9601812 0.9858488
#> mu[4,2] 0.9763548 0.02105958 0.9189624 0.9700028 0.9827027 0.9903026 0.9969880
#> mu[5,2] 0.9424182 0.04372767 0.8352181 0.9278862 0.9531731 0.9697931 0.9897842
#> mu[1,3] 0.9687955 0.02724247 0.8923014 0.9611683 0.9762906 0.9867519 0.9958210
#> mu[2,3] 0.8727048 0.08015318 0.6633978 0.8365484 0.8907476 0.9288464 0.9713757
#> mu[3,3] 0.9589801 0.03034478 0.8803231 0.9463271 0.9666111 0.9799933 0.9936224
#> mu[4,3] 0.9557647 0.03383615 0.8688497 0.9429073 0.9652019 0.9791047 0.9935937
#> mu[5,3] 0.9257019 0.04910279 0.7971302 0.9066043 0.9372174 0.9590961 0.9849859
#> mu[1,4] 0.9538652 0.03615603 0.8566988 0.9403275 0.9632428 0.9784399 0.9931700
#> mu[2,4] 0.9392213 0.04329936 0.8217429 0.9241023 0.9499753 0.9683103 0.9885660
#> mu[3,4] 0.9344597 0.04617361 0.8124747 0.9169184 0.9454070 0.9661673 0.9876194
#> mu[4,4] 0.9724688 0.02626781 0.8988352 0.9651721 0.9801582 0.9885622 0.9965840
#> mu[5,4] 0.8539960 0.10516566 0.5752763 0.8125300 0.8838448 0.9258455 0.9687237
#> mu[1,5] 0.9656977 0.02847380 0.8953434 0.9565754 0.9734931 0.9845512 0.9953143
#> mu[2,5] 0.8897345 0.07813767 0.6765461 0.8600749 0.9112217 0.9437139 0.9776705
#> mu[3,5] 0.9598528 0.03131756 0.8717586 0.9484348 0.9682738 0.9808066 0.9937804
#> mu[4,5] 0.9330710 0.04980811 0.7949374 0.9141878 0.9453854 0.9670004 0.9890399
#> mu[5,5] 0.8682562 0.08506625 0.6421667 0.8302648 0.8900370 0.9289515 0.9685002

Coefficient Estimation

result$coefficient
#>          Mean        SD      2.5%       25%      50%      75%    97.5%
#> b[0] 2.005972 0.4063064 1.2091470 1.7307123 1.998160 2.277578 2.814624
#> b[1] 1.112682 0.5038805 0.1361614 0.7630400 1.110898 1.461489 2.102108
#> b[2] 1.120562 0.4591467 0.2195766 0.8216082 1.109322 1.440124 2.019678

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.0004435 0.0007853 0.0013073 0.0024762 0.0024808 0.0110598

Extract RSE

RSE_HB<-sqrt(MSE_HB)/result$Est$MEAN*100
summary(RSE_HB)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>   2.157   2.903   3.790   4.858   5.338  12.315

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.8540  
#>  1st Qu.:0.9702   1st Qu.:0.9331  
#>  Median :1.0000   Median :0.9539  
#>  Mean   :0.9423   Mean   :0.9399  
#>  3rd Qu.:1.0000   3rd Qu.:0.9657  
#>  Max.   :1.0000   Max.   :0.9764
MSE_dir<-dataPanelbeta[,4]
MSE<-as.data.frame(cbind(MSE_dir, MSE_HB))
summary(MSE)
#>     MSE_dir              MSE_HB         
#>  Min.   :0.0004401   Min.   :0.0004435  
#>  1st Qu.:0.0036464   1st Qu.:0.0007853  
#>  Median :0.0228563   Median :0.0013073  
#>  Mean   :0.0256965   Mean   :0.0024762  
#>  3rd Qu.:0.0428368   3rd Qu.:0.0024808  
#>  Max.   :0.0887137   Max.   :0.0110598
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.   : 2.157  
#>  1st Qu.: 6.039   1st Qu.: 2.903  
#>  Median :15.118   Median : 3.790  
#>  Mean   :16.266   Mean   : 4.858  
#>  3rd Qu.:21.629   3rd Qu.: 5.338  
#>  Max.   :59.741   Max.   :12.315