From: Ken Kelley <xpxixpy_at_gmail.com>

Date: Tue, 20 Sep 2011 10:28:48 -0400

R-devel_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 20 Sep 2011 - 14:40:09 GMT

Date: Tue, 20 Sep 2011 10:28:48 -0400

Hi everyone,

I use the boot package within the MBESS package to automate much of the hard part for folks interested in performing a (simple) mediation model. The function mediation() works well, except for a (probably) unrealistic artificial data set.

When I apply the bootstrap I sometimes get:
Error in t.star[r, ] <- res[[r]]

which is (I think) due to Inf and -Inf and NaN values produced for
some of the estimates in the bootstrap resamples. Here are my warnings

> warnings()

Warning messages:

1: In sqrt((1 - R2.Y_XM) * ((N - 1) * Cov.Matrix[3, 3]/(N - ... : NaNs produced 2: In max(abs(b.contained)) : no non-missing arguments to max; returning -Inf 3: In max(abs(From.b)) : no non-missing arguments to max; returning -Inf 4: In max(abs(From.a)) : no non-missing arguments to max; returning -Inf 5: In sqrt((1 - R2.Y_XM) * ((N - 1) * Cov.Matrix[3, 3]/(N - ... : NaNs produced 6: In max(abs(b.contained)) : no non-missing arguments to max; returning -Inf 7: In max(abs(From.b)) : no non-missing arguments to max; returning -Inf 8: In max(abs(From.a)) : no non-missing arguments to max; returning -Inf 9: In max(abs(b.contained)) : no non-missing arguments to max; returning -Inf10: In max(abs(From.b)) : no non-missing arguments to max; returning -Inf 11: In max(abs(From.a)) : no non-missing arguments to max; returning -Inf

and here is what boot.out looks like:

Bootstrap Statistics :

original bias std. error t1* 0 0.01784141 0.030664717 t2* 0 0.00522446 0.009407206 t3* 0 0.01530606 0.026118581 t4* 0 0.10293090 0.132874564 t5* 0 Inf NaN t6* 0 Inf NaN t7* 0 0.06200062 0.069837762 t8* NaN NaN 0.165104486 t9* 0 0.01550669 0.026480612 t10* 0 0.01653285 0.029406830 t11* Inf -Inf 10.806967364 t12* 0 0.05329459 0.074168364 t13* 0 0.06153211 0.081591660 t14* 0 0.10558389 0.136462038

The original estimates of 0, NaN or Inf are correct for this particular set of data (which is artificial for testing purposes).

I'm wondering if there is an easy workaround (e.g., to tell boot to ignore NaN, etc.). Alternatively, I could make modifications to the mediation() function in the MBESS package. The idea of the function is to automate much of the hard part for folks interested in a simple mediation model (i.e., so that non R users can easily use the function). However, I'm not sure exactly what I should have mediation() do so that an extreme data set does not produce the problem when coupled with boot. I thought about removing the rows from boot.out$t with NaN and then changing boot.out$R to reflect the reduced number of rows, but I wasn't sure that was such a good idea. The NaNs, by the way, come from dividing 0 by 0.

I didn't provide example code because the mediation() function I'm using is not the released version. However, I can send the updated mediation() function to whomever if interested (email me off list for the updated function).

Any thoughts on this would be most welcomed!

Thanks,

Ken

R-devel_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 20 Sep 2011 - 14:40:09 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

*
Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.
Archive generated by hypermail 2.2.0, at Tue 20 Sep 2011 - 17:50:33 GMT.
*

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel.
Please read the posting
guide before posting to the list.
*