search for: rmat

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

Did you mean: mat
2007 Jul 28
8
generating symmetric matrices
Greetings, I have a seemingly simple task which I have not been able to solve today. I want to construct a symmetric matrix of arbtriray size w/o using loops. The following I thought would do it: p <- 6 Rmat <- diag(p) dat.cor <- rnorm(p*(p-1)/2) Rmat[outer(1:p, 1:p, "<")] <- Rmat[outer(1:p, 1:p, ">")] <- dat.cor However, the problem is that the matrix is filled by column and so the resulting matrix is not symmetric. I'd be grateful for any adive and/or solut...
2007 Jul 30
3
Constructing correlation matrices
Greetings, I have a seemingly simple task which I have not been able to solve today and I checked all of the help archives on this and have been unable to find anything useful. I want to construct a symmetric matrix of arbtriray size w/o using loops. The following I thought would do it: p <- 6 Rmat <- diag(p) dat.cor <- rnorm(p*(p-1)/2) Rmat[outer(1:p, 1:p, "<")] <- Rmat[outer(1:p, 1:p, ">")] <- dat.cor However, the problem is that the matrix is filled by column and so the resulting matrix is not symmetric. I'd be grateful for any adive and/or solut...
2017 Dec 29
3
winbuilder warning message wrt function pointers
...tines from the bdsmatrix package.? (It is in fact mentioned as an example of this in the Extensions manual.) The call connections are a blocks like this, one for each of the 9 called C routines. void bdsmatrix_prod4(int nrow,??? int nblock,?? int *bsize, ??????????????????? double *bmat, double *rmat, ??????????????????? int nfrail,?? double *y) { ??? static void (*fun)() = NULL; ??? if (fun==NULL) ??? fun = (void (*)) R_GetCCallable("bdsmatrix", "bdsmatrix_prod4"); ??? fun(nrow, nblock, bsize, bmat, rmat, nfrail, y); ??? } .. The winbuilder run is flagging all of th...
2010 Apr 29
1
image function with date-time on X axis
...trying to plot a image where the x axis has the units of time. When I issue the image(x,y,z) command with x as a POSIXct object, it fails to put a time stamp on the x axis. Instead I get a warning "Incompatible methods" warning and no dates on my x axis. This example shows my problem: Rmat=t(matrix(data=rnorm(1:500),ncol=10,nrow=50)) tax=seq(ISOdate(2010,4,14,12,0,0), ISOdate(2010,4,19,00,0,0), by = "12 hours") ylevs=seq(100,5000,length=50) image(tax,ylevs,Rmat) This givies the warning: In image.default(tax, zlevs, Rmat) : Incompatible methods ("-.POSIXt", &quo...
2002 Feb 27
1
Bug in glm.fit? (PR#1331)
....eta(eta) 68 if (any(is.na(mu.eta.val[good]))) 69 stop("NAs in d(mu)/d(eta)") 70 good <- (weights > 0) & (mu.eta.val != 0) 71 if (all(!good)) { 72 conv <- FALSE 73 warning(paste("No observations informative at iteration", 74 iter)) 75 break 76 } 77 z <- (eta - offset)[good] + (y - mu)[good]/mu.eta.val[good] 78 w <- sqrt((weights[good] * mu.eta.val[good]^2)/variance(mu)[good]) 79 ngoodobs <- as.integer(nobs - sum(...
2001 Oct 06
0
calculating DNA mismatch distributions for large populations
...trying the following approach: 1) I create a 'distance matrix' of mismatches. I have been calculating the mismatches using the following approach (states() creates a list of two vectors: sl$aindex==indices and sl$state==sequences) sl<-states(lnum,Rland); rmat<-matrix(0,nrow=length(sl[[1]]),ncol=length(sl[[1]])); for (i in 1:length(sl[[1]])) for (j in i:length(sl[[1]])) { if (i!=j) { vi<-strsplit(sl$state[[i]],NULL)[[1]] vj&lt...
2017 Dec 29
1
winbuilder warning message wrt function pointers
...remove the cast on the return value of R_GETCCallable. And check that your function is found before using it. #include <R.h> #include <Rinternals.h> #include <R_ext/Rdynload.h> void bdsmatrix_prod4(int nrow, int nblock, int *bsize, double *bmat, double *rmat, int nfrail, double *y) { DL_FUNC fun = NULL; if (fun==NULL) { fun = R_GetCCallable("bdsmatrix", "bdsmatrix_prod4"); } if (fun==NULL) { Rf_error("Cannot find C function 'bdsmatrix_prod4' in library 'bdsmatrix...
2010 Sep 15
1
optim with BFGS--what may lead to this, a strange thing happened
...ydata[,(2*nt+1):(3*nt)]) actr<-as.matrix(mydata[,(3*nt+1):(4*nt)]) acwrk<-as.matrix(mydata[,(4*nt+1):(5*nt)]) lnw<-as.numeric(mydata[,(5*nt+1)]) guess<-rep(0,times=npar) guess[npar]<-1.0 system.time(r1<-optim(guess,mymatrix,data=mydata, hessian=F)) guess<-r1$par system.time(rmat<-optim(guess,mymatrix,data=mydata, method="BFGS",hessian=T, control=list(trace=T, maxit=1000))) rmat$par std.err<-sqrt(diag(solve(rmat$hessian))) result<-cbind(rmat$par,std.err,rmat$par/std.err) colnames(result)<-c("paramters","std,err","t te...
2009 Nov 02
2
a prolem with constrOptim
...i-1)):(4*i)] p = theta[(1+3*(i-1)):(3*i)] P = 1-sum(p) S[(1+3*(i-1)):(3*i)] = n[1:3]/p-n[4]/P } S } #where theta=(p11,p12,p13,p21,p22,p23,...,pK1,pK2,pK3). #The function Rmat calculates the restriction matrix needed for constrained estimation Rmat = function(k) { R = matrix(1,4,3) R[1,2] = R[1,3] = R[2,3] = R[3,2] = 0 RR = cbind(-R,R) RRR = matrix(0,4*(k-1),3*k) for ( i in 1:(k-1) ) RRR[4*(...
2009 Feb 10
3
summary of a list
...I try to get the summary of all the objects of the resultList (there are 35 objects) it doesn't work... I tried: summaryList<-list() > for (i in 1:length(resultList)) + { + summaryList[[i]]<-summary(resultList[[i]]) + } And I got the following error message: Error in chol2inv(object$m$Rmat()) : l'elemento (3, 3) ? zero, quindi l'inversa non pu? essere calcolata Which translated should be: Error in chol2inv(object$m$Rmat()): the element (3, 3) is zero (NULL?), that's why the inverse (inverse function?) can not be computed Does somebody have an idea on how to fix this?...
2017 Dec 29
0
winbuilder warning message wrt function pointers
...R_GETCCallable. And check > that your function is found before using it. > > #include <R.h> > #include <Rinternals.h> > #include <R_ext/Rdynload.h> > > void bdsmatrix_prod4(int nrow, int nblock, int *bsize, > double *bmat, double *rmat, > int nfrail, double *y) { > DL_FUNC fun = NULL; > if (fun==NULL) { > fun = R_GetCCallable("bdsmatrix", "bdsmatrix_prod4"); > } > if (fun==NULL) { > Rf_error("Cannot find C function 'bdsmatrix_p...
2008 May 23
3
nls diagnostics?
Hi, All: What tools exist for diagnosing singular gradient problems with 'nls'? Consider the following toy example: DF1 <- data.frame(y=1:9, one=rep(1,9)) nlsToyProblem <- nls(y~(a+2*b)*one, DF1, start=list(a=1, b=1), control=nls.control(warnOnly=TRUE)) Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial
2008 Feb 19
1
recursive function help
...e somewhere, but I can't suss it out. Any help would be appreciated. I've tried traceback() and various debugging ideas to no avail (most likely due to my inexperience with these tools.) Here's what I have. Nk <- function(m, C) { if (length(m) > 1) { rho <- C[1, -1] Rmat <- C[-1, -1] B <- diag(1/sqrt(1 - rho*rho)) %*% (-rho %*% t(rho) + Rmat) %*% diag(1/sqrt(1 - rho*rho)) integrate( function(x) dnorm(x) * Nk((m[-1] - rho*x)/sqrt(1 - rho*rho), B), -10, m[1] )$value } else { pnorm(m[1]) } } my example is > x2 <- c(0.0781...
2009 Jun 20
1
png() resolution problem {was "Silhouette ..."}
...... The silhouette plot only uses standard R plotting functions, so any problem with it exposes problems in standard R graphics. --> Such a message should really go to R-help. to which I CC now. ---------- library(cluster) nmat <- matrix(rnorm(2500*300), ncol=300, nrow=2500) rmat <- matrix(rchisq(1000, 300, 50), ncol=300, nrow=1000) mat <- rbind(nmat, rmat) pr <- pam(mat, 2) sil <- silhouette(pr) png("sil.png") #postscript("sil.ps") plot(sil) dev.off() ---------- Anyway, I can confirm the "problem&quo...
2010 Feb 18
3
R CMD check: OK in LINUX. Crashes in Windows!
Hi, I have followed the recommended steps for creating a package (rctest). As of now, my goal is simply to understand how various pieces fit together. The package includes: (1) C code with source in sub-directories, compiled to create a static library. (a) There is a single C-struct (dns) a simple 'matrix': {int m; int n; double *d;} (b) C code to create random matrix of a certain size.
2010 Jan 17
2
For loops in R
Hello. I've just started using R and am trying to figure out if the two codes snippets below have the same output gBest<-floor(runif(popsize,min=1,max=top)) velocity[i,j]<<-.4* velocity[i,j] + 1 * runif(1) * (pbestsVar[i,j] - popVar[i,j]) + 1 * runif(1) * (archiveVar[gBest,j] - popVar[i,j]) and for (i in 1:popsize) { for (j in 1:maxvar) { gBest<-sample(top,size=1)
2011 Oct 12
2
Nonlinear regression aborting due to error
...erges successfully and the fit tracks the fit from a smoother (Supersmoother). However, if I attempt to estimate GAMMA using: START <- list(EMAX=INITEMAX, EFFECT=INITEFFECT, C50=INITC50, GAMMA=INITGAMMA) GAMMA increases rapidly to > 500 and nls terminates with: Error in chol2inv(object$m$Rmat()) : element (4, 4) is zero, so the inverse cannot be computed In addition: Warning message: In nls(FORMULA, start = START, control = CONTROL, trace = T) : singular gradient I also tried fixing GAMMA to > 1000 and I get a similar error message: Error in chol2inv(object$m$Rmat()) : e...
2010 Aug 13
2
Unable to retrieve residual sum of squares from nls output
.....$ incr :function () > ..$ setVarying:function (vary = rep(TRUE, length(useParams))) > ..$ setPars :function (newPars) > ..$ getPars :function () > ..$ getAllPars:function () > ..$ getEnv :function () > ..$ trace :function () > ..$ Rmat :function () > ..$ predict :function (newdata = list(), qr = FALSE) > ..- attr(*, "class")= chr "nlsModel" > $ convInfo :List of 5 > ..$ isConv : logi TRUE > ..$ finIter : int 8 > ..$ finTol : num 1.64e-08 > ..$ stopCode...
2017 Dec 29
0
winbuilder warning message wrt function pointers
...ckage. (It is in fact mentioned as an example of this > in the Extensions manual.) > The call connections are a blocks like this, one for each of the 9 called > C routines. > > void bdsmatrix_prod4(int nrow, int nblock, int *bsize, > double *bmat, double *rmat, > int nfrail, double *y) { > static void (*fun)() = NULL; > if (fun==NULL) > fun = (void (*)) R_GetCCallable("bdsmatrix", "bdsmatrix_prod4"); > fun(nrow, nblock, bsize, bmat, rmat, nfrail, y); > } > > .. > &gt...
2005 Jan 26
0
VICI dialer help...
...predictive dialer runnning over IAXs to another asterisk server. It dials fine. I can make phone calls manually with no problem. When VICI dials a new number it rings the other end once and I get the error: Jan 26 13:53:10 NOTICE[10206]: Dropping incompatible voice frame on IAX2/VOIP3/5 of format slin since our native fo rmat has changed to gsm I have set ALLOW=ALL in iax.conf (on both asterisk servers) , sip.conf on the local server. I have tried setting allow=ulaw (Only) and get: Jan 26 13:53:10 NOTICE[10206]: Dropping incompatible voice frame on IAX2/VOIP3/5 of format slin since ou...