Note that there are some explanatory texts on larger screens.

plurals
  1. POR: avoiding summary.plm
    primarykey
    data
    text
    <p>I'm using R to run a Monte-Carlo simulation studying the performance of panel data estimators. Because I'll be running a large number of trials, I need to get at least decent performance from my code.</p> <p>Using <code>Rprof</code> on 10 trials of my simulation shows that a significant portion of time is spent in calls to <code>summary.plm</code>. The first few lines of <code>Rprofsummary</code> are provided below:</p> <pre><code>$by.total total.time total.pct self.time self.pct "trial" 54.48 100.0 0.00 0.0 "coefs" 53.90 98.9 0.06 0.1 "model.matrix" 36.72 67.4 0.10 0.2 "model.matrix.pFormula" 35.98 66.0 0.06 0.1 "summary" 33.82 62.1 0.00 0.0 "summary.plm" 33.80 62.0 0.08 0.1 "r.squared" 29.00 53.2 0.02 0.0 "FUN" 24.84 45.6 7.52 13.8 </code></pre> <p>I'm calling <code>summary</code> in my code because I need to get the standard errors of the coefficient estimates as well as the coefficients themselves (which I could get from just the plm object). My call looks like</p> <pre><code>regression &lt;- plm(g ~ y0 + Xit, data=panel_data, model=model, index=c("country","period")) coefficients_estimated &lt;- summary(regression)$coefficients[,"Estimate"] ses_estimated &lt;- summary(regression)$coefficients[,"Std. Error"] </code></pre> <p>I have a nagging feeling that this is a huge waste of cpu time, but I don't know enough about how R does things to avoid calling summary. I'd appreciate any information on what's going on behind the scenes here, or some way of reducing the time it takes for this to excecute.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload