search for: nx1

Displaying 20 results from an estimated 38 matches for "nx1".

Did you mean: 0x1
2008 Oct 22
3
coalesce columns within a data frame
...d "merge", "cbind" and terms like "coalesce" with no success). There surely is a way to coalesce (like in SQL) columns in a dataframe, right? For example, I would like to go from a dataframe with two columns to one with only one as follows: From Name.x Name.y nx1 ny1 nx2 NA NA ny3 NA NA ... To Name nx1 nx2 ny3 NA ... where column Name.x is taken if there is a value, and if not then column Name.y Any help would be appreciated Kind regards, Ivan
2005 May 01
1
opimization problem
hi, i want to execute the following opimization problem: max r*w s.t.: w*z=1 # sum of w is 1 r, w are [nx1] vectors, z is a [nx1] vector consisting of 1 so far so good, works fine with lp the problem arises with the additional restriction w' * V * w where V is a [nxn] matrix how can i include this restriction since w arises twice? thanks, gg -- ---------------------------------------------------...
2012 Mar 08
3
Calculating length of consecutive sequences within a vector
Hi all, I have a nx1 logical array of zeros and ones and I want to calculate the individual lengths of all 1-consecutive sequences contained in it. Is there an easy quick way to do this in R? So, if I have a vector such as 111001101000011111110 I would like to get (1) 3, (2) 2, (3) 1, (4) 7 Any help would be appreci...
2003 Aug 04
1
Novice question
...g: -- Known y's for known x's1 and x's2 ys <- c(133890, 135000, 135790, 137300, 138130, 139100, 139900, 141120, 141890, 143230, 144000, 145290) xs1 <- c(1:12) xs2 <- c(22, 24.5, 27, 33, 36.8, 40, 44, 57, 59, 62, 74, 77) xm <- cbind(xs1, xs2) -- New x's1 and x's2 nx1 <- c(13:17) nx2 <- c(82, 85, 88.3, 90, 95) -- Generate some predictions samples <- data.frame(xs1=nx1, xs2=nx2) f <- predict(lm(ys ~ xm), samples) data.frame(f) yields: f 1 133949.8 2 134970.2 3 135990.6 4 137008.1 5 138027.5 6 139047.3 7 140066.5 8 141078.3 9 1420...
2009 Jul 07
3
Error due to non-conformable arrays
...for generalized ridge regression: gre <- function (X,y,D){ n <- dim(X)[1] p <- dim(X)[2] intercept <- rep(1, n) X <- cbind(intercept, X) X2D <- crossprod(X,X)+ D Xy <- crossprod(X,y) bth <- qr.solve(X2D, Xy) } # suppose X is an (nxp) design matrix and y is an (nx1) response vector p <- dim(x)[2] D<- diag(rep(1.5,p)) bt <- gre(X,y,D) I am getting following error: Error in crossprod(X, X) + D : non-conformable arrays But when i define D within the function 'gre()' then everything is fine. What wrong i have done? thanks. -- View this mes...
1997 Sep 05
2
R-beta: help with R simulation
...oesn't work. Any help appreciated! (I am using Mac version of R) Bill Simpson # nearest neighbour distance simulation # for dynamic noise dots do.sim<-function(nnoise, nsignal, jump) { ntotal<-nsignal+nnoise x<<-NULL y<<-NULL x.temp<-0 y.temp<-0 #generate noise dots nx1<-runif(nnoise,0,4095) nx2<-runif(nnoise,0,4095) ny1<-runif(nnoise,0,4095) ny2<-runif(nnoise,0,4095) #generate signal dots sx1<-runif(nsignal,0,4095) sx2<-sx1 sy1<-runif(nsignal,0,4095) sy2<-sy1+jump sy2<-ifelse(sy2>4095, sy2-4096,sy2) #wrap around #put noise and sign...
2006 Jul 22
1
Why the contrain does not work for selecting a particular range of data?
Dear: Continuing the issue of 'ifelse'! I selecting the data whose 'x2'=1 for maximizing likelihood. I used two way to do this but the results are different. 1.Way one I use the data for x2=1 and run the program. It works for me. Tthe program is described as below: function (parameters,y1,x11) { p<-parameters[1] alpha1<-parameters[2] beta1<-parameters[3]
2007 Sep 03
2
The quadprog package
...tic optimization program (Portfolio Selection) with the quadprog package I want to minimize (\omega'%*%\Sigma%*%\omega) Subject to (1) \iota' %*% \omega = 1 (full investment) (2) R'%*%\omega = \mu (predefined expectation value) (3) \omega \ge 0 (no short sales). Where \omega is a Nx1 vector of the weights invested in each asset \Sigma is the NxN variance-covariance matrix \iota is a 1xN vector of 1's R' is a Nx1 vector of the expected returns and \mu is a number, the postualted return of the investor I've done the following code but it doesn't make what I...
2024 Feb 28
2
converting MATLAB -> R | element-wise operation
On Tue, 27 Feb 2024 13:51:25 -0800 Jeff Newmiller via R-help <r-help at r-project.org> wrote: > The fundamental data type in Matlab is a matrix... they don't have > vectors, they have Nx1 matrices and 1xM matrices. Also known as column vectors and row vectors. :) > Vectors don't have any concept of "row" vs. "column". They do in (numerical) linear algebra. And MATLAB was written by numerical analysts for numerical analysts. :-) So they distinguish...
2006 Nov 10
0
Wine release 0.9.25
...rpcrt4: More "unsigned long" to "ULONG" changes in preparation of the removal of WINE_NO_LONG_AS_INT. rpcrt4: Win64 printf format warning fixes. Mike McCormack (62): msi: Split ACTION_UpdateInstallStates into two separate functions. comctl32: Remove some more Nx1 assumptions. msi: Mark components with missing or outdated files as incomplete. msi: Fix the ALTER and FREE keywords in the tokenizer. msi: Fix a trace. msi: Remove tokens that aren't valid for MSI SQL. msi: Test the data returned by join queries in one ok()....
2010 Nov 17
1
Multiple Line Plots with xyplot
I'm trying to make multiple line plots, each with a different color, using the xyplot command. Specifically, I have an NxK matrix Y and an Nx1 matrix x. I would like the plot to contain a line for each (x, Y[,i]), i=1:K. I know something like xyplot(Y[,1] + Y[,2] + Y[,3] ~ x, type='l') will work, but if Y is large, this notation can get very awkward. Is there a way to do something simpler, along the lines of xyplot(Y ~ x, typ...
2010 Mar 11
1
how does R compute Std. Error's?
i am trying to duplicate R's computation of standard errors but having some trouble. i loaded some data into R and ran summary(lm(y~x1+x2+x3+0, data=data)), but i am not sure how the "Std. Error" values are computed. let y be the nx1 vector of dependent variables and X be the nx3 matrix of independent variables. let T(.) denote the transpose of a matrix/vector, and let I(.) denote the inverse of a square matrix. then i'm able to correctly compute the coefficients and residual standard error using the following formulas:...
2011 Sep 20
2
Multivariate spline regression and predicted values
Hello, I am trying to estimate a multivariate regression of Y on X with regression splines. Y is (nx1), and X is (nxd), with d>1. I assume the data is generated by some unknown regression function f(X), as in Y = f(X) + u, where u is some well-behaved regression error. I want to estimate f(X) via regression splines (tensor product splines). Then, I want to get the predicted values for some new p...
2003 Sep 05
4
Basic Dummy Variable Creation
Hi There, While looking through the mailing list archive, I did not come across a simple minded example regarding the creation of dummy variables. The Gauss language provides the command "y = dummydn(x,v,p)" for creating dummy variables. Here: x = Nx1 vector of data to be broken up into dummy variables. v = Kx1 vector specifying the K-1 breakpoints p = positive integer in the range [1,K], specifying which column should be dropped in the matrix of dummy variables. y = Nx(K-1) matrix containing the K-1 dummy variables. My recent mailing list arc...
2024 Feb 27
2
converting MATLAB -> R | element-wise operation
Why anything but sweep? The fundamental data type in Matlab is a matrix... they don't have vectors, they have Nx1 matrices and 1xM matrices. Vectors don't have any concept of "row" vs. "column". Straight division is always elementwise with recycling as needed, and matrices are really vectors in row-major order: 1 2 3 4 5 6 is really 1 4 2 5 3 6 and when you do straight division NN...
2012 Oct 26
3
summation sign
Hi all, I have a very quick question on how to use the summation sign in R for the function. Here?s a basic example: the function is sum(i=1 to 5)log(1-xi^2) Id be grateful if someone knows how to do this without writing it out 5 times - I am looking sth along the lines of the following: computeR <- function(x) { return (-sum(log(1-x^2)) }^ thank you vm in advance! -- View this
2019 Jul 22
3
[RFC] A new multidimensional array indexing intrinsic
...y1 != y2`, but the indices do actually alias, since > > according to C semantics, the two indices alias if the _flattened > > representation of the indices alias_. Consider the parameter > > values: > > > > ``` > > n = m = 3 > > x1 = 1, y1 = 0; B[x1][y1] = nx1+y1 = 3*1+0=3 > > x2 = 0, y2 = 3; B[x2][y2] = nx2+y2 = 3*0+3=3 > > ``` > > > > Hence, the array elements `B[x1][y1]` and `B[x2][y2]` _can alias_, and > > so the transformation proposed in `ex1_opt` is unsound in general. > > I'm unsure your example actually sh...
1997 May 11
2
R-alpha: Logarithmic scales
...e another three problems with logarithmic scales: 1) segments() does not work with logarithmic scales. I suggest to change lines 962-973 in "plot.c": for (i = 0; i < n; i++) { if (FINITE(xt(x0[i%nx0])) && FINITE(yt(y0[i%ny0])) && FINITE(xt(x1[i%nx1])) && FINITE(yt(y1[i%ny1]))) { GP->col = INTEGER(col)[i % ncol]; if(GP->col == NA_INTEGER) GP->col = colsave; GP->lty = INTEGER(lty)[i % nlty]; GStartPath(); GMoveTo(XMAP(xt(x0[i % nx0])), YMAP(yt(y0[i % ny0])));...
2009 Jan 25
0
Gallium NV40 Textures
...fter that something screws up. I think the swizzler has some limitations for the dest surface. dest must be aligned to some boundary (64 bytes? 128?) i think, so that means each mip level must be aligned, and we probably aren't obeying that at the moment. probably the hw won't handle 1xN or Nx1 either. Try the progs/tests/mipmap_view, IIRC 8x8 and below is broken.
2008 Jun 16
0
Creating correlated multivariate dataset
Hello list, I am trying to test a model but for the beginning I want to do this by using simulated dataset. The model is Y_t = X_t %*% beta + e Where Y : (Nx1); X: (Nxp); beta: (0.6,0.3,0.1); e-uncorrelated normally distributed variates for each t. and later I want to use to use this dataset in a BUGS model to estimate the betas. Thank you for you consideration. [[alternative HTML version deleted]]