similar to: creating conditional list of elements

Displaying 20 results from an estimated 200 matches similar to: "creating conditional list of elements"

2007 Sep 19
3
Row-by-row regression on matrix
Folks, I have a 3000 x 4 matrix (y), which I need to regress row-by-row against a 4-vector (x) to create a matrix lm.y of intercepts and slopes. To illustrate: y <- matrix(rnorm(12000), ncol = 4) x <- c(1/12, 3/12, 6/12, 1) system.time(lm.y <- t(apply(y, 1, function(z) lm(z ~ x)$coefficient))) [1] 44.72 18.00 69.52 NA NA Takes more than a minute to do (and I need to do many
2003 May 02
6
[Bug 379] difficult to find the openssh code signing key on openssh.org.
http://bugzilla.mindrot.org/show_bug.cgi?id=379 papadopo at shfj.cea.fr changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|WORKSFORME | ------- Additional Comments From papadopo at shfj.cea.fr 2003-05-02 20:15
2008 Jul 02
5
multiplication question
folks, is there a clever way to compute the sum of the product of two vectors such that the common indices are not multiplied together? i.e. if i have vectors X, Y, how can i compute Sum (X[i] * Y[j]) i != j where i != j also, what if i wanted Sum (X[i] * Y[j] * R[i, j]) i != j where R is a matrix? thanks, murali
2007 Feb 13
2
Computing stats on common parts of multiple dataframes
Folks, I have three dataframes storing some information about two currency pairs, as follows: R> a EUR-USD NOK-SEK 1.23 1.33 1.22 1.43 1.26 1.42 1.24 1.50 1.21 1.36 1.26 1.60 1.29 1.44 1.25 1.36 1.27 1.39 1.23 1.48 1.22 1.26 1.24 1.29 1.27 1.57 1.21 1.55 1.23 1.35 1.25 1.41 1.25 1.30 1.23 1.11 1.28 1.37 1.27 1.23 R> b EUR-USD NOK-SEK 1.23 1.22 1.21 1.36 1.28 1.61 1.23 1.34 1.21 1.22
2011 Jun 07
2
CyberPower usbhid-ups continuously disconnects/reconnects
Hello, I've had this same model CyberPower connected to a linux server and a freebsd server. [root at sensor003 menon]# lsusb Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 004: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus
2002 Apr 24
1
hostbased authentication and the root account
We have a problem using hostbased authentication in combination with the root account. We use hostbased authentication to hop from a 'management server' where we use strong authentication to several systems in a cluster. The management server is defined in shosts.equiv and the public key of this server is defined in ssh_known_hosts. This setup works for all users except for the root user
2012 Feb 20
2
stats on transitions from one state to another
Folks, I'm trying to get stats from a matrix for each transition from one state to another. I have a matrix x as below. structure(c(0, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 2, 1, 1, 1, 0, 0, 2, 2, 0.21, -0.57, -0.59, 0.16, -1.62, 0.18, -0.81, -0.19, -0.76, 0.74, -1.51, 2.79, 0.41, 1.63, -0.86, -0.81, 0.39, -1.38, 0.06, 0.84, 0.51, -1, -1.29, 2.15, 0.39, 0.78, 0.85, 1.18, 1.66, 0.9, -0.94,
2010 Oct 04
1
Help on reading multipe files in R
Hi, How can I read multiple files(in a loop like manner) within a single code of R ? For example, I need to run the same code for different datasets (here list of companies) and since individual files are quite large, appending the files into one file is not a desirable option. Can this be done through a macro or sql kind of command? Thanks and Regards, Rahul S Menon Research Associate ISB,
2009 Jun 18
3
Replace zeroes in vector with nearest non-zero value
Folks, If I have a vector such as the following: x <- c(0, -1, -1, -1, 0, 0, 1, -1, 1, 0) and I want to replace the zeroes by the nearest non-zero number to the left, is there a more elegant way to do this than the following loop? y <- x for (i in 2 : length(x)) { if (y[i] == 0) { y[i] <- y[i - 1] } } > y [1] 0 -1 -1 -1 -1 -1 1 -1 1 1 You can see the
2002 Jul 18
4
rsync anti-FUD
I'm working on a commercial project that would benefit immensely from the use of rsync. However, I cannot convince management that rsync is a worthy tool due to the rote "it's shareware, it's not supported" FUD. Are there any documented, corportate users of rsync? Testimonials? In short, how do I drag this risk-averse group out of the FTP age into the rsync present? /p
2010 Aug 31
2
simultaneous estimation
Hi folks, Not sure what this sort of estimation is called. I have a 2-column time-series x(i,t) [with (i=1,2; t=1,...T)], and I want to do the following 'simultaneous' regressions: x(1,t) = (d - 1)(x(1, t-1) - mu(1)) x(2,t) = (d - 1)(x(2, t-1) - mu(2)) And I want to determine the coefficients d, mu(1), mu(2). Note that the d should be the same for both estimations, whereas the
2007 Apr 27
2
Jarque-Bera and rnorm()
Folks, I'm a bit puzzled by the fact that if I generate 100,000 standard normal variates using rnorm() and perform the Jarque-Bera on the resulting vector, I get p-values that vary drastically from run to run. Is this expected? Surely the p-val should be close to 1 for each test? Are 100,000 variates sufficient for this test? Or is it that rnorm() is not a robust random number generator?
2008 Nov 05
2
matrix indexing and update
Folks, I have a matrix: set.seed(123) a <- matrix(rnorm(100), 10) And a vector: b <- rnorm(10) Now, I want to switch the signs of those rows of a corresponding to indices in b whose values exceed the 75 %-ile of b which(b > quantile(b)[4]) [1] 2 6 10 so I want, in effect: a[2, ] <- -a[2, ] a[6, ] <- -a[6, ] a[10, ] <- -a[10, ] I thought I could do a[which(b >
2009 Apr 27
2
series at low freq expanded into high freq
Folks, If I have a series mm of, say, monthly observations, and a series dd of daily dates, what's a good way of expanding mm such that corresponding to each day in dd within the corresponding month in mm, the values of mm are repeated? So e.g., if I have mm: mm <- c(15, 10, 12, 13, 11) names(mm)<-c("Nov 2008", "Dec 2008", "Jan 2009", "Feb
2011 Mar 31
3
choosing best 'match' for given factor
Folks, I have a 'matching' matrix between variables A, X, L, O: > a <- structure(c(1, 0.41, 0.58, 0.75, 0.41, 1, 0.6, 0.86, 0.58, 0.6, 1, 0.83, 0.75, 0.86, 0.83, 1), .Dim = c(4L, 4L), .Dimnames = list( c("A", "X", "L", "O"), c("A", "X", "L", "O"))) > a A X L O A 1.00 0.41
2009 Mar 27
2
adding matrices with common column names
folks, if i have three matrices, a, b, cc with some colnames in common, and i want to create a matrix which consists of the common columns added up, and the other columns tacked on, what's a good way to do it? i've got the following roundabout code for two matrices, but if the number of matrices increases, then i'm a bit stymied. > a <- matrix(1:20,ncol=4); colnames(a) <-
2010 Aug 11
2
Samba/Winbind issue
Hi, I have an issue with Samba using winbind. We have Active Directory groups with underscores (for example sambagroup_underscore). But an underscore in Samba (Unix) is a space in Active Directory. So my question is what character is used in Samba (Unix) for an underscore in Active Directory? Or are there other solutions to solve this? I would be very happy if you can help me! Met
2005 Apr 13
1
S4 extends a class, but .Data slot has different class
When I define an S4 class ("B" in the example below) that directly extends another ("A" in the example below) , which in turn directly extends another ("character" in the example below), I find that the slot does not have the class I specified in setClass(), it has the underlying class. Is this an intended feature? Briefly, the reason for using this type of
2007 Jul 19
10
gateway failover with linux
Hi. I''m wondering if there''s a good way to configure a Linux firewall box to failover to a single backup server, while preserving connection state. This question has been asked before, but the latest reference I can find is from 2004, at which time Linux had no equivalent of OpenBSD''s pfsync, though Harald was said to be working on one. Did anything come of those
2007 Feb 28
3
matrix manipulations
Dear friends, I have a basic question with R. I'm generating a set of random variables and then combining them using the cbind statement. The code for that is given below. for (i in 1:100) { y <- rpois(i,lambda=10) X0 <- seq(1,1,length=i) X1 <- rnorm(i,mean=5,sd=10) X2 <- rnorm(i,mean=17,sd=12) X3 <- rnorm(i,mean=3, sd=24) ind <- rep(1:5,20) }