Re: [R] non-positive definite matrix remedies?

From: Matthew Keller <mckellercran_at_gmail.com>
Date: Wed, 11 Mar 2009 18:21:19 -0600

Many thanks John. Your suggestion was the type of thing I was looking for and you got me on the right track:apparently there is a newer/more sophisticated function in the matrix package called nearPD which (according to the help page) "implements the algorithm of Higham (2002), and then forces positive definiteness using code from posdefify."

On Wed, Mar 11, 2009 at 5:39 PM, John Fox <jfox_at_mcmaster.ca> wrote:
> Dear Matt,
>
> See the pd argument to the hetcor() function in the polycor package.
> hetcor() makes use of nearcor() in the sfsmisc package to ensure that a
> matrix of pairwise polychoric, polyserial, and Pearson correlations is
> positive-definite.
>
> I hope this helps,
>  John
>
> ------------------------------
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> web: socserv.mcmaster.ca/jfox
>
>> -----Original Message-----
>> From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org]
> On
>> Behalf Of Matthew Keller
>> Sent: March-11-09 6:20 PM
>> To: r-help_at_r-project.org
>> Subject: [R] non-positive definite matrix remedies?
>>
>> Hi all,
>>
>> For computational reasons, I need to estimate an 18x18 polychoric
>> correlation matrix two variables at a time (rather than trying to
>> estimate them all simultaneously using ML). The resulting polychoric
>> correlation matrix I am getting is non-positive definite, which is
>> problematic because I'm using this matrix later on as if it were a
>> legitimately estimated correlation matrix (in order to fit an SEM
>> model). I could add to the diagonal I suppose until it becomes
>> positive definite. Does anyone have any other ideas on how to deal
>> with this problem, and what the strengths and weaknesses of different
>> approaches are?
>>
>> Thanks in advance,
>>
>> Matt
>>
>>
>> --
>> Matthew C Keller
>> Asst. Professor of Psychology
>> University of Colorado at Boulder
>> www.matthewckeller.com
>>
>> ______________________________________________
>> R-help_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>

-- 
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.com

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 11 Mar 2009 - 23:25:06 GMT

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 Wed 11 Mar 2009 - 23:30:27 GMT.

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

list of date sections of archive