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
- 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 Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619

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 University

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 Geriatric

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

2007-07-24 Thread Ravi Varadhan
that 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 Varadhan, Ph.D

Re: [R] Linear programming question

2007-07-18 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] 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] 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
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-2619 Fax: (410) 614-9625

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

Re: [R] No convergence using ADAPT

2007-07-09 Thread Ravi Varadhan
] 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: (410) 502-2619 Fax: (410

Re: [R] Incidence estimated from Kaplan-Meier

2007-07-05 Thread Ravi Varadhan
, the 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

Re: [R] unexpected result in function valuation

2007-07-05 Thread Ravi Varadhan
(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 Gerontology

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 problem.

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 am

Re: [R] Fine tunning rgenoud

2007-07-03 Thread Ravi Varadhan
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 Gerontology Johns

Re: [R] Fine tunning rgenoud

2007-07-03 Thread Ravi Varadhan
is an 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
: Paul Smith [EMAIL PROTECTED] Date: Tuesday, July 3, 2007 7:32 pm Subject: Re: [R] Fine tunning rgenoud To: R-help r-help@stat.math.ethz.ch 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): first, check

Re: [R] Question about PCA with prcomp

2007-07-02 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] 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] 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
, the 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] 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. --- Ravi Varadhan, Ph.D

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

Re: [R] fft and the derivative

2007-06-25 Thread Ravi Varadhan
(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 Fax: (410) 614-9625 Email

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
this is 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

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

[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] 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

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

2007-06-14 Thread Ravi Varadhan
-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: (410) 502-2619 Fax: (410) 614

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

2007-06-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] Webpage: http

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

2007-06-12 Thread Ravi Varadhan
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

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

2007-06-12 Thread Ravi Varadhan
y: 54.9 function: 0.00778 Of these, you can ignore the first 3, which have zero density. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine

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

2007-06-11 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

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

2007-06-11 Thread Ravi Varadhan
. 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, The Center

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

2007-06-11 Thread Ravi Varadhan
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 Medicine

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

2007-06-11 Thread Ravi Varadhan
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 Medicine

[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. --- Ravi Varadhan, Ph.D

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

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

2007-05-25 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

Re: [R] Calculation of ratio distribution properties

2007-05-25 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

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

2007-05-22 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

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

2007-05-22 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

Re: [R] Nonlinear constrains with optim

2007-05-10 Thread Ravi Varadhan
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 Division

Re: [R] Optim

2007-05-10 Thread Ravi Varadhan
. If they are not 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 Division

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

2007-05-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] Webpage: http://www.jhsph.edu/agingandhealth/People

Re: [R] Bad optimization solution

2007-05-08 Thread RAVI VARADHAN
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. Paul On 5/8/07, Ravi Varadhan

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

2007-05-07 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

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] [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 Gerontology Johns

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

2007-04-23 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] Estimates at each iteration of optim()?

2007-04-23 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

Re: [R] Suggestions for statistical computing course

2007-04-20 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

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] Problems in programming a simple likelihood

2007-04-19 Thread Ravi Varadhan
(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. --- Ravi Varadhan

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

2007-04-07 Thread RAVI VARADHAN
20 20 20 20 20 20 20 Looking forward to comments. Best, Ravi. - Original Message - From: Martin Maechler [EMAIL PROTECTED] Date: Saturday, April 7, 2007 10:57 am Subject: Re: [R] Computing the rank of a matrix. To: Ravi Varadhan [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], 'José Luis

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
) and different optimization methods (e.g. conjugate gradient with Polak-Ribiere steplength option, Nelder-Mead, etc.). Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division

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
Legendre, Laguerre polynomials. 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] 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

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

2007-03-02 Thread Ravi Varadhan
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 on Aging and Health Division

[R] Questions regarding biplot

2007-03-02 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

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 Aging

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 Professor

Re: [R] simulating from Langevin distributions

2007-02-13 Thread Ravi Varadhan
)) 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, Ph.D. Assistant Professor, The Center on Aging and Health Division

Re: [R] Multidimensional Integration over arbitrary sets

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

Re: [R] nls: missing value or an infinity (Error in numericDeriv) andsingular gradient matrixError in nlsModel

2007-02-13 Thread Ravi Varadhan
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 of Geriatric Medicine

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] R in Industry

2007-02-08 Thread Ravi Varadhan
], 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. --- Ravi Varadhan, Ph.D. Assistant

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

2007-02-08 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] Help with efficient double sum of max (X_i, Y_i) (X Y vectors)

2007-02-02 Thread Ravi Varadhan
- sum(outer(x,x,FUN=fast.pmax)) + 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

[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] Webpage: http://www.jhsph.edu/agingandhealth/People

Re: [R] Need help writing a faster code

2007-02-01 Thread Ravi Varadhan
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 Geriatric Medicine

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] 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 Professor, The Center on Aging and Health

[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

Re: [R] maximum likelihood estimation of 5 parameters

2007-01-05 Thread Ravi Varadhan
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 Aging and Health

Re: [R] na.action and simultaneous regressions

2007-01-03 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

Re: [R] na.action and simultaneous regressions

2007-01-03 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

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] 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] any way to make the code more efficient ?

2006-12-08 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

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

2006-11-29 Thread Ravi Varadhan
)) } times - seq(0,30,by=0.1) y0 - c(0,0) parms - c(k1=0.7, k2=0.5, k3=0.2, k4=0.8, T=10, delay=5) Is there a way to incorporate delay in odesolve? Any hints would be much appreciated. Ravi. --- Ravi

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

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. Assistant Professor

[R] Matrix-vector multiplication without loops

2006-11-14 Thread Ravi Varadhan
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 Medicine and Gerontology

Re: [R] Matrix-vector multiplication without loops

2006-11-14 Thread Ravi Varadhan
-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 Subject: RE: [R] Matrix-vector

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
of grid points. 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] 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 Geriatric

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 Geriatric

[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

Re: [R] Hessian matrix

2006-11-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] Webpage: http://www.jhsph.edu/agingandhealth

Re: [R] Multivariate regression

2006-10-31 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

[R] Multivariate regression

2006-10-27 Thread Ravi Varadhan
weighted least squares. Any help is appreciated. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins

Re: [R] R gams

2006-10-27 Thread Ravi Varadhan
), 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 Medicine

  1   2   >