Displaying 8 results from an estimated 8 matches for "2xn".
Did you mean:
2x
2008 Oct 14
2
list syntax question: which subscript is which
Hi,
Sorry to bother with something that should be simple, but I can't find it.
Suppose I have a list, each element of which is a 2xN dataframe, where N
could be different for each element.
Is there some simple structure to let me examine all the elements of
each element's first column? For example:
>foo
$first
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
$second
[,1] [,2]
[1,] 1 6
[2,]...
2005 May 06
4
Choices from a matrix
Could someone please suggest a more clever solution to the following problem than my loop below?
Given X a 2xN matrix X, and I a k-subset of N,
Generate the (2^k)xN matrix Y with columns not in I all zero and the other columns with all choices of an entry from the first or second row of X.
For example, with
X <- matrix(1:8, nrow=2)
I <- c(1,3)
X is
1 3 5 7
2 4 6 8
and Y should be
1 0 5 0
2 0 5 0
1...
2004 Sep 25
2
making custom function compute/return multiple items
Hello, I'm relatively new to R. I've read the intro guide, but I
can't quite figure out how to:
I have a function:
Jcost <- function (theta, in, out) {
a <- output - input %*% theta
1/2 * t(a) %*% a
}
where
"theta" is a 2x1 matrix
"in" is a 20x2 matrix
"out" is a 20x1 matrix
return value is a scaler
This works well when I only want to
2013 Mar 26
0
Converting 2D matrix to 3D array
...e each path is of length N. I use mvrnorm to create all the increments,
i.e.
h <- 1.0;
COV <- matrix(c(1,0,0,1),nrow=2);
dW <- h * t(mvrnorm(n=N*M,mu=c(0,0),Sigma=COV));
The next step is that I'd like to wrap dW (2D matrix of size 2x(NM) into a
3D array where each slice is 2xN matrix and the entire array consists of M
slices. Just wondering if there is any way to do that? Or is there a better
way than the way I am describing? Thank you.
Roebert
[[alternative HTML version deleted]]
2005 Aug 17
1
resampling Question
hi,
sorry for a possibly naive question but I am a bit of a beginner in R programming...
I wrote a function which simulates some data and performs two different kinds of analyses on it. as an output I get the statistics for the two analyses (t-values). Now I would like to have an other function which reruns my first function say a 1000 times and attaches the resulting statistics in a data.frame
2009 May 29
0
possible bug in "sspir" package?
...ot;glm", the response variable can take one of
3 forms: (1) a vector with 2 levels (eg, 0 and 1) if the data are from
individuals; (2) a vector of the proportions in which case the
additional function call "weights" would be needed with a vector of the
number of trials; or (3) a 2xN matrix where the columns are successes
and failures, respectively.
When I try to fit a basic random-walk model using the "ssm" function,
however, I can only get option (3) above to work. That in itself is OK,
but it seems as though ssm and subsequent functions (eg, "kfs") w...
2014 May 11
2
questions about process_limit
Hello all!
# dovecot --version
2.1.17
Sometimes I have this in the logfile:
May 11 16:55:52 master: Warning: service(imap-login): process_limit (100) reached, client connections are being dropped
May 11 17:35:03 master: Warning: service(imap-login): process_limit (100) reached, client connections are being dropped
May 11 17:36:27 master: Warning: service(imap-login): process_limit (100)
2008 Aug 25
8
Two envelopes problem
...oney
# r: constant, so that x is the amount of money in one envelop and r*x
is the
# amount of money in the second envelope
# rdist: a random distribution for the amount x
# n: number of envelope pairs to generate
# ...: additional parameters for the random distribution
# The function returns a 2xn matrix containing the (randomized) pairs
# of envelopes
generateenv <- function (r, rdist, n, ...)
{
env <- matrix(0, ncol=2, nrow=n)
env[,1] <- rdist(n, ...) # first envelope has `x'
env[,2] <- r*env[,1] # second envelope has `r*x'
# randomize de envelopes, so we...