search for: gregory_gentlemen

Displaying 20 results from an estimated 22 matches for "gregory_gentlemen".

2010 Sep 10
3
Is there a bisection method in R?
Dear fellow R-users, Is there a function that does the bisection method? I was unable to find one. Thanks in advance. Gregory [[alternative HTML version deleted]]
2005 Jun 25
2
optimization problem in R ... can this be done?
...or this value of x. my issue is writing some code to systematically obtain this value. Is R capable of handling such a problem? (i.e. through some sort of optimization fucntion, or some sort of grid search with the relevant constraints) Any suggestions would be appreciated. Gregory Gentlemen gregory_gentlemen@yahoo.ca The following is a sketch of an optimization problem I need to solve. __________________________________________________ [[alternative HTML version deleted]]
2008 Jan 14
3
Listing the data contents of a package
Hi R users, Simply question: On the command line, how do I list the datasets contained within a package, e.g. MASS? I scanned the mailing list history but was unable to find the answer. Thanks in advance. Gregory --------------------------------- [[alternative HTML version deleted]]
2008 May 21
2
how to do pairwise sums in a matrix
I am looking for an efficient way to solve the following problem. I have a large matrix of continuous values with a small proportion of missing values. Columns correspond to variables where each variable has two measurements, call them A and B. The matrix is such that the columns are in sequence with respect to the variables. I would like to sum up the two measurements for each variable and each
2009 Oct 06
4
Text editors for Sweave (rnw) files
Hi fellow R-users, Are there any text editors that recognize sweave (.rnw) files? I am running Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) doesn't recognize rnw files and does not do any syntax highlighting for them. Thanks in advance, Greg __________________________________________________________________ Make your browsing faster, safer, and
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, "<")] <-
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
2008 Jan 07
1
evaluating a vector of characters
Dear R users, I'd like to evaluate a vector of characters. For example, say I have a data frame called Data including the field names x1, x2, x3, and I'd like to a list out of paste("Data$x", 1:3, sep=""). How can I get list to evaluate paste("Data$x", 1:3, sep="") as an R object rather than a string? Thanks in advance for you assistance. Gregory
2010 Jul 02
1
Producing residual plots by time for lme object
Fellow R-users, I have a longitudinal data set with missing values in it. I would like to produce a residual plot for each time using panel.xyplot function but I get an error message. Here's a simple example, library(nlme) set.seed(1544) longdata <- data.frame(ID=gl(10,1,50), y=rnorm(50), time = as.numeric(gl(5,10,50)), x = rnorm(50)) longdata$y[5] <- NA longdata$x[35] <- NA
2008 Mar 14
2
using nrow to identify one row
Hi fellow R-users, I have run into a problem when trying to identify the number of rows in a matrix. Say we have an arbitrary 5 by 5 matrix called temp: temp <- matrix(norm(25), nrow=5) The problem is that nrow(temp[1,]) returns NULL. I would like it to return 1 because in my larger program I am indexing the rows of large matrices according to another variable and I need to test when the
2007 Nov 21
2
matrix elementwise average with NA's
Hello fellow R users, I have a matrix computation that I imagine should be relatively easy to do, however I cannot figure out a nice way to do it. I have two matrices, for example mat1 <- matrix(c(1:5,rep(NA,5), 6:10), nrow=3, byrow=T) mat2 <- matrix(c(2:6, 6:10, rep(NA,5)), nrow=3, byrow=T) I'd like to compute the element-wise average for non-NA entries. Of course (mat1+mat2)/2
2008 Mar 10
1
How can I sample from a two-dimensional grid of points
Hi everyone, My goal is to sample from a two-dimensional grid. Consider the following example of code: n.grid <- 500 muA.grid <- seq(-4,4, length=n.grid) muB.grid <- seq(-4,4, length=n.grid) mu.p <- matrix(NA, nrow=n.grid, ncol=n.grid) for(i in 1:n.grid){ for(j in 1:n.grid){ mu.p[i,j] <- dnorm(muA.grid[i], 0, 1)*dnorm(muB.grid[j], 0, 0.5) } } mu.p <-
2010 Jan 27
3
Function for describing segements in sequential data
Dear R-users, Say that I have a sequence of zeroes and ones: x <- c(1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0) The sequences of ones represent segments and I want to report the starting and endpoints of these segments. For example, in 'x', the first segment starts at location 1 and ends at 3, and the second segment starts at location 8 and ends at location 10. Is there an efficient
2006 Jun 24
3
getting the smoother matrix from smooth.spline
Can anyone tell me the trick for obtaining the smoother matrix from smooth.spline when there are non-unique values for x. I have the following code but, of course, it only works when all values of x are unique. ## get the smoother matrix (x having unique values smooth.matrix = function(x, df){ n = length(x); A = matrix(0, n, n); for(i in 1:n){ y = rep(0, n); y[i]=1; yi =
2005 Jul 28
3
using integrate with optimize nested in the integration
Hi guys im having a problem getting R to numerically integrate for some function, say f(bhat)*optimize(G(bhat)), over bhat. Where id like to integrate this over some finite range, so that here as we integrate over bhat optimize would return a different optimum. For instance consider this simple example for which I cannot get R to return the desired result: f <- function(bhat) exp(bhat) g
2007 Nov 23
0
R users in Cyprus
...ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 57 Date: Wed, 21 Nov 2007 14:30:41 -0500 (EST) From: Gregory Gentlemen <gregory_gentlemen at yahoo.ca> Subject: [R] matrix elementwise average with NA's To: r-help at r-project.org Message-ID: <465850.116.qm at web63505.mail.re1.yahoo.com> Content-Type: text/plain Hello fellow R users, I have a matrix computation that I imagine should be relatively easy to do, however I c...
2005 Dec 02
0
multiple operations on indexed columns
Hi guys, Im struggling with this: I have a dataset in which I have 9 measures and for each measure id like to compute the kendall tau correlation using cor.test with each of 20 covariates. Is there any systematic way to do this without writing a for loop? Thanks in advance, Gregory Gentlemen --------------------------------- [[alternative HTML version deleted]]
2007 Nov 18
1
many zeroes in rgamma ... what's going on?
Hello fellow R users, I wanted to view the density on the standard deviation scale of a gamma(0.001, 0.001) prior for the precision. I did this as seen in the code below and found that for some reason rgamma is giving many values equal to zero, which is strange since a gamma distribution is continuous. What is going on here? Thanks for any help in advance. Greg > x1 <- rgamma(10000,
2009 Sep 01
1
matrix manipulation problem
Dear fellow R-users, Say we have a matrix x, defined as follows set.seed(50) x <- matrix(rbinom(100*5,1, p=0.75),nrow=100, ncol=5) Now the interpretation of x is that each for of x is actually a sequence of length 5, and i would like to transform x in such a way that I can describe the frequencies of sequences observed among the 100. How can I do this efficiently? Thanks for any assistance!
2010 Jul 05
2
Function to compute the multinomial beta function?
Dear R-users, Is there an R function to compute the multinomial beta function? That is, the normalizing constant that arises in a Dirichlet distribution. For example, with three parameters the beta function is Beta(n1,n2,n2) = Gamma(n1)*Gamma(n2)*Gamma(n3)/Gamma(n1+n2+n3) Thanks in advance for any assisstance. Regards, Greg [[alternative HTML version deleted]]