Disposition of functions that use OpenMx

1 reply [Last post]
neale's picture
Offline
Joined: 07/31/2009

So I put together this function to estimate polychoric correlations by ML. It may improve on the polychor() by i) accepting a dataframe with more than two variables; ii) avoiding the threshold-estimates-in-the-wrong-order problem (see http://r.789695.n4.nabble.com/polychor-error-td806416.html).

Question is, how should I dispose of this function? Obviously it needs a bit more tidying up - error checking on input, testing, documentation etc. but it could be quite handy. Comments welcome.

> polychoricMatrix(data[1:2])
Running model
$polychorics
t1neur1 t1mddd4l
t1neur1 1.0000000 0.2766488
t1mddd4l 0.2766488 1.0000000

$thresholds
t1neur1 t1mddd4l
Threshold1 -1.90078018 0.5352623
Threshold2 -0.60288738 0.5352623
Threshold3 -0.05787172 0.5352623
Threshold4 0.35325948 0.5352623
Threshold5 0.76300674 0.5352623
Threshold6 0.97337736 0.5352623
Threshold7 1.25752996 0.5352623
Threshold8 1.52144325 0.5352623
Threshold9 1.63884649 0.5352623
Threshold10 1.85627069 0.5352623
Threshold11 2.08894746 0.5352623
Threshold12 2.41675886 0.5352623

$polychoricStandardErrors
[,1] [,2]
[1,] NA 0.06604162
[2,] 0.06604162 NA

$Minus2LogLikelihood
[1] 2015.439

AttachmentSize
polychoricFunction.R4.05 KB
tbates's picture
Offline
Joined: 07/31/2009
home for polycor

hi Mike,
Nice function.

As polycor is a john fox package, I'd suggest asking if he might use your innovations in his package?

It might be too, that calling openmx can be made optional, i.e., if it is present then use it, if not, then use what ever ML optimizer is being called inside the existing polycor? Not sure what the efficiencies are here.

That way all the polychoric innovations can be kept in one place?