Re: [R] integrate

2007-08-22 Thread Ravi Varadhan
You can divide your domain of integration into smaller intervals and then add up the individual contributions. This could improve the speed of adaptive Gauss-Kronrod quadrature used in integrate(). Ravi. --- Ravi

Re: [R] Linear models over large datasets

2007-08-17 Thread Ravi Varadhan
> ans1 <- solve(t(X)%*%X,t(X)%*%y) > ans2 <- qr.solve(X,y) > all.equal(ans1,ans2) [1] TRUE Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medici

Re: [R] Help wit matrices

2007-08-10 Thread Ravi Varadhan
An even simpler solution is: mat2 <- 1 * (mat1 > 0.25) Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins Univ

Re: [R] Mixture of Normals with Large Data

2007-08-05 Thread RAVI VARADHAN
Another possibility is to use "data squashing" methods. Relevant papers are: (1) DuMouchel et al. (1999), (2) Madigan et al. (2002), and (3) Owen (1999). Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of

Re: [R] Computing the rank of a matrix.

2007-07-24 Thread Ravi Varadhan
there can be no "correct" solution to an ill-posed problem. Furthermore, I haven't come across a real application where the numerical estimate of a rank is directly useful. Best, Ravi. ---- --- Ravi

Re: [R] Linear programming question

2007-07-18 Thread Ravi Varadhan
Tobias, Just a clarification/correction to my solution: it makes no difference whether A and B are positive or negative. The minimum of S1+S2-S3-S4 is always -2(A+B). Ravi. --- Ravi Varadhan, Ph.D. Assistant

Re: [R] Linear programming question

2007-07-18 Thread Ravi Varadhan
B). Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Em

Re: [R] Optimization

2007-07-17 Thread Ravi Varadhan
. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

Re: [R] nearest correlation to polychoric

2007-07-13 Thread Ravi Varadhan
. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED

Re: [R] Stepwise GLM selection by LRT?

2007-07-11 Thread Ravi Varadhan
.84. Is this whhant you'd like to do? Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-

Re: [R] integration over a simplex

2007-07-10 Thread RAVI VARADHAN
Hi Robin, A Monte-Carlo approach could be attempted, if one could generate samples that are either uniformly distributed over the simplex. There is a small section in Luc Devroye's book (Generation of Non-uniform random deviates) on random uniform sampling from a simplex, if I remeber correctl

Re: [R] No convergence using ADAPT

2007-07-09 Thread Ravi Varadhan
^2 > new.ans [1] 0.8264463 Hope this is helpful, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (

Re: [R] unexpected result in function valuation

2007-07-05 Thread Ravi Varadhan
urn( (sin(N*th)/tan(th/2)) + cos(N*th)) } This function works well, as you had expected. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontol

Re: [R] Incidence estimated from Kaplan-Meier

2007-07-05 Thread Ravi Varadhan
larger the over-estimation. This is a well-known phenomenon in the competing risks literature. See, for example, Gooley et al. (Stats in Med 1999). Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on

Re: [R] how to solve a min problem

2007-07-04 Thread RAVI VARADHAN
If the constraints on S are linear inequalities, then linear programming methods would work. See function solveLP in package "linprog" or simplex in "boot" or package "lpSolve". Ravi. - Original Message - From: domenico pestalozzi <[EMAIL PROTECTED]> Date: Wednesday, July 4, 2007 11:26

Re: [R] how to solve a min problem

2007-07-04 Thread RAVI VARADHAN
Whether you can use "optim" or not depends on the nature of the constraints on S. If you have simple box constraints, you can use the "L-BFGS-B" method in optim. If not, optim may not be directly applicable, unless you can somehow transform your problem into an unconstrained minimization probl

Re: [R] Fine tunning rgenoud

2007-07-03 Thread RAVI VARADHAN
: Paul Smith <[EMAIL PROTECTED]> Date: Tuesday, July 3, 2007 7:32 pm Subject: Re: [R] Fine tunning rgenoud To: R-help > On 7/4/07, Ravi Varadhan <[EMAIL PROTECTED]> wrote: > > It should be easy enough to check that your solution is valid (i.e. > a local > > minimum

Re: [R] Fine tunning rgenoud

2007-07-03 Thread Ravi Varadhan
interior point, check to see whether the gradient there is close to zero. Note that if the solution is one of the vertices of the polyhedron, then the gradient may not be zero. Ravi. --- Ravi Varadhan, Ph.D. Assistant

Re: [R] Fine tunning rgenoud

2007-07-03 Thread Ravi Varadhan
-tuples that satisfy linear inequality constraints, but AFAIK those are not available in R. Best, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and

Re: [R] Question about PCA with prcomp

2007-07-02 Thread Ravi Varadhan
The PCs that are associated with the smaller eigenvalues. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph

Re: [R] Question about PCA with prcomp

2007-07-02 Thread Ravi Varadhan
ers". Hope this is helpful, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www

Re: [R] Dominant eigenvector displayed as third (Marco Visser)

2007-06-30 Thread RAVI VARADHAN
Yes, Spencer, your observation is correct, because the characeristic equation det(A - \lambda*I) is a sixth degree polynomial: \lambda^6 - 5 = 0. So the eigenvalues are the complex numbers (generally) that are located at equal angles on the circle of radius 5^(1/6), at angles 2*pi*k/6, where k

[R] Solving a system of nonlinear equations

2007-06-27 Thread Ravi Varadhan
Freudenstein-Roth function, shows the usefulness of the multiple random starts. Hope this is useful, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric

Re: [R] Creatiing an R package for solving nonlinear system ofequations was: RE: finding roots of multivariate equation

2007-06-26 Thread Ravi Varadhan
to a local optimum takes place, you simply restart the procedure with another initial value. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and

Re: [R] fisher information matrix

2007-06-26 Thread Ravi Varadhan
Hi, You can use the function hessian() in the package "numDeriv". This will yield a very accurate estimate of the "observed" Fisher information matrix. library(numDeriv) ?hessian Ravi. ---- ---

Re: [R] fft and the derivative

2007-06-25 Thread Ravi Varadhan
rm of the derivative of f(t)? Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619

Re: [R] Creatiing an R package for solving nonlinear system of equations was: RE: finding roots of multivariate equation

2007-06-21 Thread Ravi Varadhan
useful. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625

[R] Creatiing an R package for solving nonlinear system of equations was: RE: finding roots of multivariate equation

2007-06-20 Thread Ravi Varadhan
one interested? Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625

Re: [R] finding roots of multivariate equation

2007-06-20 Thread Ravi Varadhan
sometimes yield local minima which are not the zeros of the original system. However, this can be easily remedied by using different starting values. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center

Re: [R] Normal and Poisson tail area expectations in R

2007-06-14 Thread Ravi Varadhan
760326e-13 7.550262e-17 1.224779e-20 7.474560e-25 > Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph:

Re: [R] Normal and Poisson tail area expectations in R

2007-06-14 Thread Ravi Varadhan
Perfect, Chuck. I got a closed-form solution after some algebraic labor, but your solution is simple and elegant. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of

Re: [R] Normal and Poisson tail area expectations in R

2007-06-13 Thread Ravi Varadhan
ow the answer? Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTEC

Re: [R] how to find how many modes in 2 dimensions case

2007-06-12 Thread Ravi Varadhan
0.992 y: 35.9 function: 2.17e-19 x: 2.07 y: 82.4 function: 0.00795 x: 4.08 y: 77.2 function: 0.00722 x: 4.35 y: 54.9 function: 0.00778 Of these, you can ignore the first 3, which have zero density. Ravi. ---- ---

Re: [R] how to find how many modes in 2 dimensions case

2007-06-12 Thread Ravi Varadhan
nction: 0.214 Of course, this brute-force grid search is highly inefficient for dimensions greater than 2. Hope this is helpful, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health D

Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Ravi Varadhan
you also have to think about whether the resulting system of equations are valid, when there are no A people. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric

Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Ravi Varadhan
l solution is accurate, then you need to go back to your system of equations and analyze them carefully. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Me

Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Ravi Varadhan
realistic. In short, if you are sure that the numerical solution is accurate, then you need to go back to your system of equations and analyze them carefully. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor,

Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Ravi Varadhan
ow. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webp

[R] An extension of Gabriel's biplot

2007-06-01 Thread Ravi Varadhan
appreciated. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614

Re: [R] Comparing multiple distributions

2007-05-31 Thread Ravi Varadhan
Your data is "compositional data". The R package "compositions" might be useful. You might also want to consult the book by J. Aitchison: statistical analysis of compositional data. Ravi. ---- ---

Re: [R] ratio distribution - missing attachment

2007-05-29 Thread Ravi Varadhan
Dear Martin and Vitto, Please find attached the R function to compute the density of the ratio of 2 dependent normal variates. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and

Re: [R] Calculation of ratio distribution properties

2007-05-25 Thread Ravi Varadhan
Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Fa

Re: [R] Problem with numerical integration and optimization with BFGS

2007-05-25 Thread Ravi Varadhan
You could try that. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [

Re: [R] Time series\optimization question not R question

2007-05-22 Thread Ravi Varadhan
Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingand

Re: [R] Time series\optimization question not R question

2007-05-22 Thread Ravi Varadhan
atanh(A + beta) Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTE

Re: [R] Optim

2007-05-10 Thread Ravi Varadhan
"significantly" different but the corresponding parameter estimates differ widely, then you may have identifiability issues. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health D

Re: [R] Nonlinear constrains with optim

2007-05-10 Thread Ravi Varadhan
sequential unconstrained minimization techniques. Another good book is that by Roger Fletcher (1987): Practical methods of optimization. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health

Re: [R] A function for raising a matrix to a power?

2007-05-09 Thread Ravi Varadhan
avi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/Peo

Re: [R] Bad optimization solution

2007-05-08 Thread RAVI VARADHAN
e solution provided by R is correct or not. In the > case that I reported, it is fairly simple to see that the solution > provided by R (without any warning!) is incorrect, but, in general, > that is not so simple and one may take a wrong solution as a correct > one. > > Pau

Re: [R] Bad optimization solution

2007-05-07 Thread Ravi Varadhan
point). However, I do not why optim converges to the boundary maximum, when analytic gradient is supplied (as shown by Sundar). Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health

Re: [R] A function for raising a matrix to a power?

2007-05-07 Thread Ravi Varadhan
re made to be orthonormal. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www

Re: [R] [SPAM] - Re: R package development in windows - BayesianFilter detected spam

2007-05-03 Thread Ravi Varadhan
Harold, I totally echo your sentiments on the difficulty of creating an R package in Windows. I really wish that this process could be made a bit less painful. Ravi. --- Ravi Varadhan, Ph.D. Assistant

Re: [R] Simple plot question

2007-04-26 Thread Ravi Varadhan
Check out the function "mvrnorm" in package MASS. library(MASS) ?mvrnorm Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontolo

Re: [R] Estimates at each iteration of optim()?

2007-04-23 Thread Ravi Varadhan
r constraints. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/a

Re: [R] Estimates at each iteration of optim()?

2007-04-23 Thread Ravi Varadhan
Why do you want to look at parameter estimates for each step, anyway? Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopk

Re: [R] Suggestions for statistical computing course

2007-04-20 Thread Ravi Varadhan
tly. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www

Re: [R] Problems in programming a simple likelihood

2007-04-19 Thread Ravi Varadhan
, method = "CG", y = women$J, X = cbind(1, women$M, women$S)) > out $par [1] -3.0612277 -1.4567141 0.3659251 $value [1] 13.32251 $counts function gradient 357 101 $convergence [1] 1 $message NULL Hope this helps, Ravi. --

Re: [R] convergence

2007-04-19 Thread Ravi Varadhan
No. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL

Re: [R] Computing the rank of a matrix.

2007-04-07 Thread RAVI VARADHAN
t;- -(7:16) > tol <- 10^exp > sapply(tol, A=hilbert(20), function(x,A)qr(A, tol=x, LAPACK=FALSE)$rank) [1] 10 12 14 14 15 16 16 17 18 19 > sapply(tol, A=hilbert(20), function(x,A)qr(A, tol=x, LAPACK=TRUE)$rank) [1] 20 20 20 20 20 20 20 20 20 20 Looking forward to comments. Best, Ravi.

Re: [R] Computing the rank of a matrix.

2007-04-06 Thread Ravi Varadhan
Hi, qr(A)$rank will work, but just be wary of the tolerance parameter (default is 1.e-07), since the rank computation could be sensitive to the tolerance chosen. Ravi. --- Ravi Varadhan, Ph.D. Assistant

Re: [R] Likelihood returning inf values to optim(L-BFGS-B) other options?

2007-04-05 Thread Ravi Varadhan
gy for picking a starting value) and different optimization methods (e.g. conjugate gradient with "Polak-Ribiere" steplength option, Nelder-Mead, etc.). Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Profes

Re: [R] Large matrix into a vector

2007-03-28 Thread Ravi Varadhan
c(HR) will do it. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614

Re: [R] Gaussian Adaptive Quadrature

2007-03-21 Thread Ravi Varadhan
abscissa are chosen from Legendre, Laguerre polynomials. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins Unive

Re: [R] MCMC logit

2007-03-09 Thread Ravi Varadhan
. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED

[R] Questions regarding biplot

2007-03-02 Thread Ravi Varadhan
ons. Best, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTEC

Re: [R] Help with faster optimization for large parameter problem

2007-03-02 Thread Ravi Varadhan
ain caveat here is that the CG methods generally have slower convergence than QN type methods, unless you can precondition the problem. Hope this is helpful, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center

Re: [R] returns from dnorm and dmvnorm

2007-02-26 Thread Ravi Varadhan
be made to become arbitrarily large by letting the variance gets close to zero, and in the limit you will obtain Dirac's delta function. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on

Re: [R] using "integrate" in a function definition

2007-02-23 Thread Ravi Varadhan
Your function "jjj" is not vectorized. Try this: jjj <- function(www) sapply(www, function(x)2*integrate(dnorm,0,x)$value) plot(jjj, 0, 5) It should work. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant P

Re: [R] nls: "missing value or an infinity" (Error in numericDeriv) and"singular gradient matrix"Error in nlsModel

2007-02-13 Thread Ravi Varadhan
sonable idea of what they should be. If you don't, then you could try selfStart, as the error message tells you to do. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division o

Re: [R] Multidimensional Integration over arbitrary sets

2007-02-13 Thread Ravi Varadhan
minpts lenwrk ifail 0.1250612 0.00999505459071123 0 Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine a

Re: [R] simulating from Langevin distributions

2007-02-13 Thread Ravi Varadhan
- runif(7) > mu <- mu / sqrt(crossprod(mu)) > K <- 1.2 > ylang <- rlangevin(n=10, mu=mu, K=K) > apply(ylang,1,crossprod) [1] 1 1 1 1 1 1 1 1 1 1 > I hope that this helps. Ravi. ---- --- Ravi Varadhan,

Re: [R] Timings of function execution in R [was Re: R in Industry]

2007-02-09 Thread Ravi Varadhan
dealing exclusively with numeric mode. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502

Re: [R] Timings of function execution in R [was Re: R in Industry]

2007-02-08 Thread Ravi Varadhan
NA > system.time( ans3 <- fast.pmax(x1,x2) ) [1] 0.29 0.05 0.35 NA NA > > all.equal(ans1,ans2,ans3) [1] TRUE Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and He

Re: [R] R in Industry

2007-02-08 Thread Ravi Varadhan
NA, n, n) mat <- matrix(x[abs(col(A) - row(A)) + 1], n, n) } mat } ### > system.time(top.mat <- toeplitz(runif(220))) [1] 0.00 0.01 0.02 NA NA Hope this is fast enough! Best, Ravi. ------

Re: [R] Help with efficient double sum of max (X_i, Y_i) (X & Y vectors)

2007-02-02 Thread Ravi Varadhan
+ sum333 <- sum(outer(x,y,FUN="fast.pmax")) + }) [1] 0.78 0.08 0.86 NA NA > > > all.equal(sum1,sum11,sum111) [1] TRUE > all.equal(sum3,sum33,sum333) [1] TRUE > > --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division

Re: [R] Help with efficient double sum of max (X_i, Y_i) (X & Y vectors)

2007-02-01 Thread Ravi Varadhan
Jeff, Here is something which is a little faster: sum1 <- sum(outer(x, x, FUN="pmax")) sum3 <- sum(outer(x, y, FUN="pmax")) Best, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professo

Re: [R] Need help writing a faster code

2007-02-01 Thread Ravi Varadhan
. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED

Re: [R] Need help writing a faster code

2007-02-01 Thread Ravi Varadhan
it. Robin - using two applys doesn't make the code any faster, it just produces a compact one-liner. Best, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatr

[R] Need help writing a faster code

2007-02-01 Thread Ravi Varadhan
heta < 0) } Thanks for any suggestions. Best, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614

[R] Looking for a faster code

2007-01-31 Thread RAVI VARADHAN
Hi, I have two matrices A (m x 2) and B (n x 2), where m and n are large integers (on the order of 10^4). I am looking for an efficient way to create another matrix, W (m x n), which can be defined as follows: for (i in 1:m){ for (j in 1:n) { W[i,j] <- g(A[i,], B[j,]) } } I have tried the fol

Re: [R] maximum likelihood estimation of 5 parameters

2007-01-05 Thread Ravi Varadhan
lem into a maximization problem. If this doesn't work, you should provide more details (a reproducible code with actual error message). Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on A

Re: [R] na.action and simultaneous regressions

2007-01-03 Thread Ravi Varadhan
regressions anyway. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL P

Re: [R] na.action and simultaneous regressions

2007-01-03 Thread Ravi Varadhan
ual standard error: 0.3115 on 15 degrees of freedom Multiple R-Squared: 0.118, Adjusted R-squared: 0.05915 F-statistic: 2.006 on 1 and 15 DF, p-value: 0.1771 Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Cente

Re: [R] RuleFit & quantreg: partial dependence plots; showing an effect

2006-12-20 Thread Ravi Varadhan
Thanks, Roger. These should be very useful tools. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph

Re: [R] RuleFit & quantreg: partial dependence plots; showing an effect

2006-12-20 Thread Ravi Varadhan
complete flexibility? If it is possible, are you or anyone else in the R community working on this? Thanks, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread Ravi Varadhan
g rows and/or columns. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu

Re: [R] How to solve differential equations with a delay (time lag)?

2006-11-29 Thread Ravi Varadhan
Thanks, Woodrow. I also found a DDE solver called "dde23" in Matlab written by L.F. Shampine. I will see if I can use it in Scilab, since I don't have Matlab. Ravi. ---- --- Ravi Varadhan, Ph.D. Assi

Re: [R] How to solve differential equations with a delay (time lag)?

2006-11-29 Thread Ravi Varadhan
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ravi Varadhan Sent: Wednesday, November 29, 2006 4:45 PM To: r-help@stat.math.ethz.ch Subject: [R] How to solve differential equations

[R] How to solve differential equations with a delay (time lag)?

2006-11-29 Thread Ravi Varadhan
Is there a way to incorporate delay in odesolve? Any hints would be much appreciated. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax

Re: [R] Matrix-vector multiplication without loops

2006-11-14 Thread Ravi Varadhan
n.html -Original Message- From: Christos Hatzis [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 14, 2006 2:49 PM To: 'Dimitris Rizopoulos'; 'Ravi Varadhan' Cc: r-help@stat.math.ethz.ch Subj

[R] Matrix-vector multiplication without loops

2006-11-14 Thread Ravi Varadhan
ggestions on how to perform this computation efficiently without the "for" loops? Thank you, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Me

Re: [R] R and Fortran 9x -- advice

2006-11-13 Thread Ravi Varadhan
Metcalf and Reid - FORTRAN 90/95 Explained Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410

Re: [R] Numerical Integration

2006-11-09 Thread Ravi Varadhan
y with Trapezoidal rule by just increasing the number of grid points. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins

Re: [R] Numerical Integration

2006-11-08 Thread Ravi Varadhan
n f(x)? Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/P

Re: [R] solve computationally singular

2006-11-07 Thread Ravi Varadhan
For heaven's sake, please stop sending repeat emails and send your R code that can reproduce the error. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geri

Re: [R] Ridge for logistic regression

2006-11-06 Thread Ravi Varadhan
Also check out the package "glmpath" which can incorporate both ridge (L2) and lasso (L1) type penalties. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of

[R] Markov blanket

2006-11-02 Thread Ravi Varadhan
. pdf I would also appreciate tips to any related algorithms/methods that are implemented in R. Thanks, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of

Re: [R] Hessian matrix

2006-11-01 Thread Ravi Varadhan
rate values. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage:

Re: [R] Multivariate regression

2006-10-31 Thread Ravi Varadhan
timated. Best, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTEC

Re: [R] R & gams

2006-10-27 Thread Ravi Varadhan
ing System (GAMS), which is a high-level modeling system for mathematical programming and optimization. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Me

  1   2   3   >