[R] Principal Component Analysis

2012-02-29 Thread Blaz Simcic
Dear R buddies, I’m trying to run Principal Component Analysis, package princomp: http://stat.ethz.ch/R-manual/R-patched/library/stats/html/princomp.html. My question is: why do I get different results with pca = princomp (x, cor = TRUE) and pca = princomp (x, cor = FALSE) even when I standardi

[R] generate matrices

2012-02-09 Thread Blaz Simcic
Dear all, I would like to generate 500 matrices of 20 numbers from standard normal distribution with names x1,x2,x3,….x500.   I tried with loop for, but I don’t know how to name matices : for (i in 1:500)  {    x[[i]] <- matrix(rnorm(20), 4)     } Any suggestion? Thanks,  Blaž

[R] Not missing at random

2011-06-06 Thread Blaz Simcic
Hello!   I would like to sample 30 % of cases (with at least 1 value lower than 3 - in the row) and among them I want to set all values lower than 3 (within selected cases) as NA (NMAR- Not missing at random). I managed to sample cases, but I don’t know how to set values (lower than 3) as N

[R] Not missing at random

2011-06-03 Thread Blaz Simcic
Hello!   I would like to sample 30 % of cases (with at least 1 value lower than 3) and among them I want to set all values lower than 3 (within selected cases) as NA (NMAR- Not missing at random). I managed to sample cases, but I don’t know how to set values (lower than 3) as NA.   R code:

[R] Missing completely at random

2011-06-01 Thread Blaz Simcic
Hello! I would like to sample 5 % of cases and from 1 to 3 variables within selected cases and set them as NA (MCAR-Missing completely at random). I managed to sample cases and variables, but I don’t know how to set them as NA. R code: N <- 1000      number of cases n <- 12     Â