You are here

Exctract CI values

4 posts / 0 new
Last post
Julia's picture
Offline
Joined: 03/29/2012 - 09:40
Exctract CI values

Hi.
Is it possible to extract values of upper and lower bounds of CI separately? Let's say I would like to estimate CI's for path estimates for males by introducing the following command:

ciVm = mxCI(c('am','cm','em'))

The only thing I am able to get is:

> QualACEFit@output$confidenceIntervals
               lbound    ubound
MZM.am[1,1]  6.128870 10.699917
MZM.cm[1,1] -7.901978  7.901978
MZM.em[1,1]  3.775610  5.115599

What I am interested in is to get, e.g., a value for the lower boud of CI for am. Is that feasible somehow?

Thank you in advance!

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
index into the result table

Does this work?

QualACEFit@output$confidenceIntervals[1,1]

i.e., just access the cell in that table which you want

QualACEFit@output$confidenceIntervals[,1, drop = F] # column for row 1
mdewey's picture
Offline
Joined: 01/21/2011 - 13:24
An alternative to Tim's reply

An alternative to Tim's reply which is slightly more robust is to specify the element by using the names to index the matrix (assuming it is a matrix). So juliasmatrix[,"lbound"] ought to give you the first column.

More interestingly if you do
grep("am", rownames(juliasmatrix))
you should get the indexes of all rows which contain am in their name. This means that is later you ask for them in a different order you will still get the one you intended. I find this most valuable within a function which might be recycled in a different context.

Michael

Julia's picture
Offline
Joined: 03/29/2012 - 09:40
Great! Thank you so much, Tim

Great! Thank you so much, Tim and Michael! Both approaches give me what I wanted. I agree with you Michael that your way is a bit more robust since one does not have to search manually an index of a parameter one is interested in.

Thank you very much!