[R] Dealing with missing values in princomp (package "psych")

William Dunlap wdunlap at tibco.com
Thu Mar 21 00:35:35 CET 2013


You can build the variance matrix you want "manually" with cov(x, use="pairwise").
You can supply a variance matrix to princomp with princomp(covmat=outputOfCov).
See their manual pages for details.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
> Of Dimitri Liakhovitski
> Sent: Wednesday, March 20, 2013 4:17 PM
> To: Bert Gunter
> Cc: r-help
> Subject: Re: [R] Dealing with missing values in princomp (package "psych")
> 
> Yes, Bert, you are right and I do know I might run into a non-positive
> definite intercorrelation matrix.
> But if I do, then I can go back to those for whom I am doing the analysis
> and tell them that. Not before.
> This sad truth being said - can I do it directly in the function, without
> building a intercorrelation matrix manually?
> Thank you!
> Dimitri
> 
> On Wed, Mar 20, 2013 at 7:04 PM, Bert Gunter <gunter.berton at gene.com> wrote:
> 
> > Well, you can do this, but there's no guarantee that the resulting
> > correlation matrix will be positive definite. And what would principle
> > components based on this mean even if it is positive definite?
> >
> > -- Bert
> >
> >  On Wed, Mar 20, 2013 at 3:14 PM, Dimitri Liakhovitski <
> > dimitri.liakhovitski at gmail.com> wrote:
> >
> >>  Hello!
> >> I am running principle components analysis using princomp function in
> >> pacakge psych.
> >>
> >> mypc <- princomp(mydataforpc, cor=TRUE)
> >>
> >> Question: I'd like to use pairwise deletion of missing cases when
> >> correlations are calculated. I.e., I'd like to have a correlation between
> >> any 2 variables to be based on all cases that have valid values on both
> >> variables.
> >>
> >> What should my na.action be in this case?
> >>
> >> Thank you very much!
> >> --
> >> Dimitri Liakhovitski
> >>
> >>         [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> 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<http://www.r-project.org/posting-
> guide.html>
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
> >
> > --
> >
> > Bert Gunter
> > Genentech Nonclinical Biostatistics
> >
> > Internal Contact Info:
> > Phone: 467-7374
> > Website:
> >
> > http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-
> biostatistics/pdb-ncb-home.htm
> >
> >
> 
> 
> 
> --
> Dimitri Liakhovitski
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.



More information about the R-help mailing list