Re: [R] Error : 'start' contains NA values when fitting frank copula

2018-04-21 Thread Soumen Banerjee
Hi Martin, Thanks for the reply. I tried to make a toy example so that I could get the same error. I have attached the data file for which the error occurs in my program. The code after loading this file is - fr_cop = frankCopula(dim=6) fit_fr_cop = fitCopula(fr_cop,pobs(data),method="mpl") This

Re: [R] Removing columns from big.matrix which have only one value

2018-04-21 Thread Bert Gunter
Maybe base R's unique() function might be useful? It uses hashing I believe. Bert On Sat, Apr 21, 2018, 12:17 PM Jack Arnestad wrote: > I have a very large binary matrix, stored as a big.matrix to conserve > memory (it is over 2 gb otherwise - 5 million columns and 100 rows). > > r <- 100 > c

[R] Removing columns from big.matrix which have only one value

2018-04-21 Thread Jack Arnestad
I have a very large binary matrix, stored as a big.matrix to conserve memory (it is over 2 gb otherwise - 5 million columns and 100 rows). r <- 100 c <- 1 m4 <- matrix(sample(0:1,r*c, replace=TRUE),r,c) m4 <- cbind(m4, 1) m4 <- as.big.matrix(m4) I need to remove every column which has only on

[R] Cross-validation : can't get the predicted response on the testing data

2018-04-21 Thread varin sacha via R-help
Dear R-experts, Doing cross-validation for 2 robust regressions (HBR and fast Tau). I can't get the 2 errors rates (RMSE and MAPE). The problem is to predict the response on the testing data. I get 2 error messages. Here below the reproducible (fictional example) R code. #install.packages("MLm

Re: [R] Error : 'start' contains NA values when fitting frank copula

2018-04-21 Thread Martin Maechler
> Soumen Banerjee > on Sat, 21 Apr 2018 17:22:56 +0800 writes: > Hello! I am trying to fit a copula to some data in R and > I get the error mentioned above. This is the code for a > reproducible example - (not really reproducible: You did not set the random seed, so the

[R] Error : 'start' contains NA values when fitting frank copula

2018-04-21 Thread Soumen Banerjee
Hello! I am trying to fit a copula to some data in R and I get the error mentioned above. This is the code for a reproducible example - library(copula) data = matrix(data=runif(600),nrow=200,ncol=3) data[,2] = 2*data[,1] data[,3] = 3*data[,1] fr_cop = frankCopula(dim=3) fit_fr_cop = fitCopula(fr_c

Re: [R] Check if row of dataframe is superset of any row in another dataframe.

2018-04-21 Thread Jim Lemon
Hi Neha, How about this? find_subset<-function(x,y) { yrows<-dim(y)[1] match<-0 for(row in 1:yrows) match<-sum(x&y[row]) >= sum(y[row]) return(match) } apply(B,1,find_subset,A) This is somewhat obscure, as the dataframe B is coerced to a matrix by the apply function. Jim On Sat, Apr 21, 201

Re: [R] Check if row of dataframe is superset of any row in another dataframe.

2018-04-21 Thread Eric Berger
Hi Neha, How about this? A <- as.matrix(A) B <- as.matrix(B) C <- A %*% t(B) SA <- apply(A, MAR=1, sum ) SB <- apply(B, MAR=1, sum ) vapply( 1:nrow(B), function(j) { sum( C[,j]==SA & SA <= SB[j] ) > 0 }, 1 ) HTH, Eric On Sat, Apr 21, 2018 at 10:27 AM, Neha Aggarwal wrote: > Hi, > > I am

[R] Check if row of dataframe is superset of any row in another dataframe.

2018-04-21 Thread Neha Aggarwal
Hi, I am looking for a way in which I can check if rows in 1 dataframe are present in another data frame in a unique way. A row in dataframe should be super set of any row in another dataframe. I can write a for loop for it, however, that will be inefficient. So, I am looking for an efficient way