Displaying 20 results from an estimated 9000 matches similar to: "princomp() with missing values in panel data?"
2006 Jul 31
1
How does biplot.princomp scale its axes?
I'm attempting to modify how biplot draws its red vectors (among other
things). This is how I've started:
Biplot <- function(xx, comps = c(1, 2), cex = c(.6, .4))
{
## Purpose: Makes a biplot with princomp() object to not show arrows
## ----------------------------------------------------------------------
## Arguments: xx is an object made using princomp()
##
2003 Aug 08
1
covmat argument in princomp() (PR#3682)
R version: 1.7.1
OS: Red Hat Linux 7.2
When "covmat" is supplied in princomp(), the output value "center" is all
NA's, even though the input matrix was indeed centered. I haven't read
anything about this in the help file for princomp(). See code below for an
example: pc2$center is all NA's.
Jerome Asselin
x <- rnorm(6)
y <- rnorm(6)
X <- cbind(x,y)
2011 Jun 30
2
sdev value returned by princomp function (used for PCA)
Dear all,
I have a question about the 'sdev' value returned by the princomp function (which does principal components analysis).
On the help page for princomp it says 'sdev' is 'the standard deviations of the principal components'.
However, when I calculate the principal components for the USArrests data set, I don't find this to be the case:
Here is how I
2007 Apr 27
1
how to be clever with princomp?
Hi all,
I have been using princomp() recently, its very useful indeed, but I have
a question about how to specify the rows of data you want it to choose.
I have a set of variables relating to bird characteristics and I have been
using princomp to produce PC scores from these.
However since I have multiple duplicate entries per individual (each bird
had a varying number of chicks), I only want
2007 Apr 23
3
Help about princomp
Hello,
I have a problem with the princomp method, it seems stupid but I don't know
how to handle it.
I have a dataset with some regular data and some outliers. I want to
calculate a PCA on the regular data and get the scores for all data,
including the outliers. Is this possible on R?
Thank you for helping!!!
--
View this message in context:
2005 Apr 08
1
Princomp$Scores
Hi all,
I was hoping that someone could verify this for me-
when I run princomp() on a matrix, it is my understanding that the scores
slot of the output is a measure of how well each row correlates (for lack of
a better word) with each principal component.
i.e. say I have a 300x6 log2 scaled matrix, and I run princomp(). I would
get back a $scores slot that is also 300x6, where each value
2012 Dec 12
2
using 'apply' to apply princomp to an array of datasets
Hi everyone,
Suppose I have a 3D array of datasets, where say dimension 1 corresponds to
cases, dimension 2 to datasets, and dimension 3 to observations within a
dataset. As an example, suppose I do the following:
> x <- sample(1:20, 48, replace=TRUE)
> datasets <- array(x, dim=c(4,3,2))
Here, for each j=1,2,3, I'd like to think of datasets[,j,] as a single data
matrix with
2009 Nov 26
1
R help with princomp and pam clustering
Hi all!
I am working with R package cluster and I have a little problem:
let's say I have two datasets...first one ("A") is divided into 4 clusters
by means of Pam algorythm.
Let's say I want to project the second database ("B") onto the Comp.1 X
Comp.2 graph, and see where its elements are placed.
The two datasets are made of different dim (54x19 and 28x19). I tried
2010 Jan 21
1
why scores are different in rda() and princomp()
hello,
I am doing PCA in R using some habitat factors, and I used the function result1=rda() and result2=princomp(),then pick up scores of the result1 and result2 using scores(),but the scores are significantly different,i do not know the meaning of it.
Best wishes!
Cheng
2008 Jan 13
1
What is the 'scale' in princomp() function?
Dear R users,
When I tried to use princomp() from stats packages to do Principal
Components Analysis, I am not very clear what is the "scale".
And the scores are different from "PROC PRINCOMP" procedure from SAS.
Using the example data from this package:
restpc <- princomp(USArrests, cor = TRUE)
> restpc$scale
Murder Assault UrbanPop Rape
4.311735 82.500075
2012 Aug 23
1
Accessing the (first or more) principal component with princomp or prcomp
Hi ,
To my knowledge, there're two functions that can do principal component
analysis, princomp and prcomp.
I don't really know the difference; the only thing I know is that when
the sample size < number of variable, only prcomp will work. Could someone
tell me the difference or where I can find easy-to-read reference?
To access the first PC using princomp:
2007 May 10
1
A simple question about PRINCOMP
Hi,
I just wonder if this is a rounding error by the princomp command in R.
Although this does not make much sense, using a hypothetical dataset, a,
a<-matrix(runif(1000),100,10)
I did PCA with the princomp, and compared it with the results estimated
with the eigen and the prcomp commands. And I found some differences in
the results: opposite signs in the loadings; slight differences in
2002 May 14
1
princomp
Hello experts,
as newcomer in pca, i have a question, concerning the princomp algorithm.
With a dataset "r" containing 18 "input" parameters and 1 "output" parameter
r[19], i got with the following fit
ls <- lsfit(r[1:18],r[19]); lsdiag <- ls.diag(ls); lsdiag$std.dev
a prediction error of:
[1] 8.879561
what is quite reasonable. If i take only two
2003 Jul 15
2
"na.action" parameter in princomp() (PR#3481)
Full_Name: Jerome Asselin
Version: 1.7.1
OS: Red Hat Linux 7.2
Submission from: (NULL) (24.77.125.119)
Setting the parameter na.action=na.omit should remove
incomplete records in princomp. However this does not
seem to work as expected. See example below.
Sincerely,
Jerome Asselin
data(USArrests)
princomp(USArrests, cor = TRUE) #THIS WORKS
USArrests[1,3] <- NA
princomp(USArrests, cor =
2003 Apr 11
2
princomp with not non-negative definite correlation matrix
$ R --version
R 1.6.1 (2002-11-01).
So I would like to perform principal components analysis on a 16X16
correlation matrix, [princomp(cov.mat=x) where x is correlation matrix],
the problem is princomp complains that it is not non-negative definite.
I called eigen() on the correlation matrix and found that one of the
eigenvectors is close to zero & negative (-0.001832311). Is there any
way
2005 Mar 26
5
PCA - princomp can only be used with more units than variables
Hi all:
I am trying to do PCA on the following matrix.
N1 N2 A1 A2 B1 B2
gene_a 90 110 190 210 290 310
gene_b 190 210 390 410 590 610
gene_c 90 110 110 90 120 80
gene_d 200 100 400 90 600 200
>dataf<-read.table("matrix")
>
2004 Sep 14
3
Signs of loadings from princomp on Windows
I start a clean session of R 1.9.1 on Windows and I run the following code:
> library(MASS)
> data(painters)
> pca.painters <- princomp(painters[ ,1:4])
> loadings(pca.painters)
Loadings:
Comp.1 Comp.2 Comp.3 Comp.4
Composition 0.484 -0.376 0.784 -0.101
Drawing 0.424 0.187 -0.280 -0.841
Colour -0.381 -0.845 -0.211 -0.310
Expression 0.664 -0.330 -0.513
2000 Jan 31
1
Feature requests for princomp(.) : Allow cor() specifications
(all in subject).
If I want to do a PC analysis in a situation with missing data,
I may want to have same flexibility as with "cor(.)",
e.g., I may want
princomp(x, ..., use.obs = "pairwise.complete")
Actually, I may want even more flexibility.
Currently,
princomp(.)
has
if (cor)
cv <- get("cor", envir = .GlobalEnv)(z)
else cv <-
2005 May 05
3
body of non-visible function
Hello,
Is there any possibility in R to see the body of the non-visible
function, for
example princomp?
If I do :
> methods(princomp)
so, I get that princomp.default and princomp.formula are non-visible
functions and
body(princomp.default) doesnt show it.
In particular, I guess I have a very nave question
Id like to see how scores calculation is implemented in the function
princomp.
2010 May 06
1
how to get components / factors in factanal / princomp not loadings
Dear all,
i wonder if there?s a command to obtain the actual values of a principal component or a factor (not as.factor, but factanal) .
test=princomp(USArrests, cor = TRUE)
summary(test)
just outputs, standard deviation, Prop of Variance and cumulative proportion of variance.
test$loadings offers yet another proportion of variance scheme. why is that?
Apart from that:
Is there a