Search code examples
rmodelsubsetr-s4

Get the values of a model (Type S4)? (prodest package)


I am using this prodest package and I want to access each of the parameters, for example the coefficients and sd.

library(prodest)
data(chilean)
OP.fit = prodestOP(chilean$Y,
                   fX = cbind(chilean$fX1, chilean$fX2), 
                   chilean$sX, 
                   chilean$inv, 
                   chilean$idvar, 
                   chilean$timevar)

summary(OP.fit)

# -------------------------------------------------------------
#   -               Production Function Estimation              -
#   -------------------------------------------------------------
#                         Method :    OP              
# -------------------------------------------------------------
#                               fX1       fX2       sX1 
# Estimated Parameters      :   0.314     0.256     0.168 
#                              (0.038)   (0.034)   (0.032)
# -------------------------------------------------------------
#   N                         :  2544
# -------------------------------------------------------------
#   Bootstrap repetitions     :  20
# 1st Stage Parameters      :  0.314     0.256     -0.95 
# Optimizer                 :  optim
# -------------------------------------------------------------
#   Elapsed Time              :  0.02 mins
# -------------------------------------------------------------


# OP.fit$
OP.fit[1]

Error in OP.fit[1] : object type 'S4' is not a subset

Solution

  • The package does not seem to provide a method for extracting the bootstrapped SE. You can grab it directly from the slot Estimates of the S4 object:

    OP.fit@Estimates
    

    which gives

    $pars
          fX1       fX2       sX1 
    0.3143463 0.2555818 0.1675415 
    
    $std.errors
           fX1        fX2        sX1 
    0.03765673 0.03056369 0.02699638