Display more digits after decimal point

1,151 views
Skip to first unread message

Yunlong Gong

unread,
Oct 25, 2013, 10:42:41 AM10/25/13
to lav...@googlegroups.com
Deal all,
 
I am really new to R and now using the lavaan package to fit the path analysis. It worked very well except for only showing 3 digits after

decimal point. I have tried to add the number of digits through modifying the function lav_print, but it does not work for the parameter estimates. How to display more digits (for example 5) for parameter estimates?

 

Thanks!

Yunlong Gong

Edward Rigdon

unread,
Oct 25, 2013, 11:34:21 AM10/25/13
to lav...@googlegroups.com
     I don't have an answer, but I would like to offer a caution. Yes, differences in variable scale (a problem in itself) could lead to the first significant digit in a parameter estimate falling at the third or fourth decimal place, but researchers should be wary of assigning too much meaning to third and fourth significant digits of statistics.  Bedian et al.:


tested the reproducibility of the digits in simple correlations and found that even the third decimal place of estimates was not reproducible unless sample size was 100,000 or larger.
--Ed Rigdon


--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/groups/opt_out.

yrosseel

unread,
Oct 25, 2013, 1:03:40 PM10/25/13
to lav...@googlegroups.com
On 10/25/2013 04:42 PM, Yunlong Gong wrote:

> parameter estimates. How to display more digits (for example 5)
> for parameter estimates?

Internally, lavaan stores all numbers in double precision. Only when
printing to the screen, only 3 digits after the decimal point are shown.
For the 'summary()' function, there is currently no way to change this.
However, for the parameterEstimates() function, you can use this:

as.data.frame( unclass( parameterEstimates(fit) ) )

or extract the parameters as a column ('est'):

parameterEstimates(fit)$est

Or, you can use coef(), together with unclass:

unclass( coef(fit) )

This gives you the parameter labels too. (The 'unclass()' function
removes the 'lavaan.*' class that determines the printing style)

Yves.

Yunlong Gong

unread,
Oct 25, 2013, 2:54:47 PM10/25/13
to lav...@googlegroups.com
Yves and Edward,
 
Thanks so much for your help, for the useful command and kind caution. 
 
Yunlong
Reply all
Reply to author
Forward
0 new messages