Re: [R] General-purpose GPU computing in statistics (using R)

2010-06-05 Thread Ravi Varadhan
differences? Best regards,. Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu

Re: [R] Positive Definite Matrix

2011-01-30 Thread Ravi Varadhan
of the matrix, (A + t(A))/2. Best, Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Spencer Graves Date: Sunday,

Re: [R] Matching patients

2011-02-01 Thread Ravi Varadhan
Look at the "optmatch" package. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu

Re: [R] Help with integrating R and c/c++

2011-02-06 Thread Ravi Varadhan
uld be the "optimx" package, which unifies a large number of optimiaztion tools under one umbrella. Hope this helps, Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology Scho

Re: [R] fast optimization routines in R

2011-02-07 Thread Ravi Varadhan
ntrol option as `all.methods=TRUE' to get all the algorithms. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi

Re: [R] Removing Outliers Function

2011-02-08 Thread Ravi Varadhan
u plotted the amount of learning on the Y-axis and time on the X-axis, a steep learning curve means that one learns very quickly, but this is just the opposite of what is actually meant. Best, Ravi. ____ Ravi Varadhan, Ph.D.

Re: [R] A question on Duplicating

2011-02-09 Thread Ravi Varadhan
?duplicated This will identify common locations where duplications occur: duplicated(a) & duplicated(b) Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hop

Re: [R] Optimization Question

2011-02-14 Thread Ravi Varadhan
e changes, you might want to try optimizing using "optimx" package, as it will try various optimization tools. Hopefully, some of them will be successful. If you send the data test$A, we might be able to help you better. Hope this helps, Ravi. -

Re: [R] Optimization Question

2011-02-14 Thread Ravi Varadhan
c(0.1, 0.1, 2.5),control=list(trace=TRUE)) Hope this helps, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.e

[R] How to flag those iterations which yield a warning?

2011-02-18 Thread Ravi Varadhan
etect warnings. Any pointers would be appreciated. Thanks, Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: r

Re: [R] How to flag those iterations which yield a warning?

2011-02-18 Thread Ravi Varadhan
May be I could do: for (i in 1:nsim) { last.warning <- NULL # do model fitting if(!is.null(last.warning)) # discard simulation result } I think this might work. Any other ideas? Ravi. ____ Ravi Varadhan, Ph.D. Assist

Re: [R] How to flag those iterations which yield a warning?

2011-02-18 Thread Ravi Varadhan
Nope - that does not work. The value of last.warning is not reset after the initial NULL. Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins

Re: [R] How to flag those iterations which yield a warning?

2011-02-18 Thread Ravi Varadhan
Dear Bill - your solution works beautifully. Thank you very much. David - thank you as well for your solution. It also works. Best regards, Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and

Re: [R] BFGS versus L-BFGS-B

2011-02-25 Thread Ravi Varadhan
separation using a minorization inequality, and hence the problem simplifies greatly. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502

Re: [R] Hello!

2011-02-27 Thread Ravi Varadhan
nging criticisms. Mark, by reacting to the comments in a personal manner, I am afraid that you are the loser. Best, Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Med

Re: [R] using pre-calculated coefficients and LP in coxph()?

2011-03-13 Thread Ravi Varadhan
t;Mean relative difference: 1.463598" The results from `offset' are correct, i.e. lp2 can be readily verified to be equal to 0.05 * (age - ph.karno). I don't know how lp1 is computed. Ravi. Ravi Varadhan, P

Re: [R] Problem with nls.lm function of minpack.lm package.

2011-03-15 Thread Ravi Varadhan
s. Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Yann PĂ©riar

Re: [R] BFGS and Neldear-Mead

2011-03-18 Thread Ravi Varadhan
iple optima, you can get different answers from properly converged iterations. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email

Re: [R] Part of a density plot

2011-03-19 Thread Ravi Varadhan
Take a look at pvladens() function in "bootruin" package. Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-

Re: [R] BFGS and Neldear-Mead

2011-03-21 Thread Ravi Varadhan
o accomplish this. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-

Re: [R] < ABOUT Rdonlp2 package >

2011-03-23 Thread Ravi Varadhan
This is no longer on CRAN. Try one of the other constrained optimization packages: "Rsolnp" or "alabama" Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Me

Re: [R] R helps win competitions

2011-03-23 Thread Ravi Varadhan
R prediction experts. Thanks & Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu -Original M

Re: [R] a question on R optimization functions

2011-03-25 Thread Ravi Varadhan
You might want to use `trace' and/or other debugging options to better understand when and why this happens. Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Med

Re: [R] a question on R optimization functions

2011-03-25 Thread Ravi Varadhan
Ben, I am a huge fan of the old-fashioned and low-tech `cat'; it is good to know that I am not alone in this! Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Ho

Re: [R] pmt

2011-03-27 Thread Ravi Varadhan
That is essentially zero, because you are so far out in the left tail of the distribution. So, you can ignore the negative sign and treat it as zero. Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric

Re: [R] Integration with variable bounds

2011-03-29 Thread Ravi Varadhan
mp; u1 <= z2) & (u2 > 4 & u2 <= z2) ff <- ifelse (reg.nonzero, u1*(z1-u1)*u2*(z2-u2)*exp(-0.027*(12-z2)), 0) return(ff) } Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontolo

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Ravi Varadhan
The following one-liner generates uniformly distributed 3-tuples that sum to 1: diff(c(0, sort(runif(2)), 1)) More, generally you can generate n-tuples that sum to unity as: diff(c(0, sort(runif(n-1)), 1)) Ravi. Ravi

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Ravi Varadhan
t;- runif(3) rtrg2[i, ] <- tmp/sum(tmp) } par(mfrow=c(2,1)) triplot(rtrg) # Looks more uniformly distributed triplot(rtrg2, col=2) # Corners are sparsely populated Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Ravi Varadhan
TRUE) rtrg.1 <- cbind(pmin(tmp[,1], tmp[,2]), abs(tmp[,1] - tmp[,2]),1 - pmax(tmp[,1], tmp[,2])) }) all.equal(rtrg, rtrg.1) Now, how can we use vis.test to test differences between these? Best, Ravi. ____ Ravi Varadhan, Ph.D. Assi

Re: [R] Integration with variable bounds

2011-03-29 Thread Ravi Varadhan
You get 0 because you did not specify lower and upper bounds that define the hyper-rectangle; therefore, the default is used which is (0,1)^4. Specify the proper lower and upper bounds. Ravi. Ravi Varadhan, Ph.D. Assistant

Re: [R] Integration with variable bounds

2011-03-29 Thread Ravi Varadhan
ct. Ravi. ____ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message ----- From: Ravi Varad

Re: [R] optim and optimize are not finding the right parameter

2011-03-30 Thread Ravi Varadhan
Try this: pred <- pred/1e06 DV <- DV/1e03 opt1 <- optim(fn=my.function, par=1.0) opt2 <- optim(fn=my.function, par=1.0, method="BFGS") opt3 <- optim(fn=my.function, par=1.0, method="L-BFGS-B", lower=0, upper=1) opt1 opt2 opt3 Ravi. -

Re: [R] integration

2011-04-08 Thread Ravi Varadhan
?integrate From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of cindy Guo [cindy.g...@gmail.com] Sent: Friday, April 08, 2011 9:21 PM To: r-help@r-project.org Subject: [R] integration Hi, All, I have a density function with 3 v

Re: [R] integration

2011-04-11 Thread Ravi Varadhan
It does. See `lower' and `upper' arguments. Why are y and z not known? Say, you want the marginal of x, i.e. integrate over x. Now, y and z are fixed. You fix them at different values, but they are known. Ravi. --- Ravi Vara

Re: [R] Find number of elements less than some number: Elegant/fastsolution needed

2011-04-14 Thread Ravi Varadhan
Bill's code is insanely fast! f2 <- function(x, y) length(y) - findInterval(-x, rev(-sort(y))) n1 <- 1e07 n2 <- 10^c(1,2,3,4,5,6,7) tt <- rep(NA, 7) x <- rnorm(n1) for (i in 1:length(n2)){ y <- runif(n2[i]) tt[i] <- system.time(a1 <- f2(x, y))[3] } > tt [1] 0.70 0.86 1.03 1.28 1.54 4.99

Re: [R] How to generate a correlation matrix with restrictions on its eigenvalues

2011-04-15 Thread Ravi Varadhan
Generate random numbers from a multinomial. ?rmultinom # The following will generate n multinomial vectors each of size m rmultinom(n, size=m, prob=m^(-1/8)) # you need to specify probabilities appropriately Ravi. From: r-help-boun...@r-project.org [r-he

Re: [R] question regarding qmvnorm

2011-04-20 Thread Ravi Varadhan
If you had told us what the error message was, my job would have been easier. But, at least you provied the code, so it was not hard for me to see where the problem was. There is a problem with the strategy used by `qmvnorm' to locate the initial interval in which the quantile is supposed to l

Re: [R] Matching a vector with a matrix row

2011-04-22 Thread Ravi Varadhan
Here is one solution: rowmatch <- function(A,B) { # Rows in A that match the rows in B f <- function(...) paste(..., sep=":") if(!is.matrix(B)) B <- matrix(B, 1, length(B)) a <- do.call("f", as.data.frame(A)) b <- do.call("f", as.data.frame(B)) match(b, a) } A <- matrix(1:1000

Re: [R] Matching a vector with a matrix row

2011-04-24 Thread Ravi Varadhan
I gave a solution previously with integer elements. It also works well for real numbers. rowMatch <- function(A,B) { # Rows in A that match the rows in B # The row indexes correspond to A f <- function(...) paste(..., sep=":") if(!is.matrix(B)) B <- matrix(B, 1, length(B)) a <- do.cal

Re: [R] Multi-dimensional non-linear fitting - advice on best method?

2011-04-24 Thread Ravi Varadhan
Julian, You have not specified your problem fully. What is the nature of f? Is f a scalar function or is it a vector function (2-dim)? Here are some examples showing different possibilities: (1) y1 = f + e1 = a + b*exp(-c*x) + e1; y2 = f + e2 = a + b*exp(-c*x) + e2; (e1, e2) ~ bivariate norm

Re: [R] ridge regression - covariance matrices of ridge

2011-08-07 Thread Ravi Varadhan
Hi Michael, The coefficients of ridge regression are given by: \beta^* = (X'X + k I)^{-1} X' y, (1) where k > 0 is the penalty parameter and I is the identity matrix. The ridge estimates are related to OLS estimates \beta as follows: \beta^* = Z \beta,

[R] optimization problems

2011-08-13 Thread Ravi Varadhan
Kathie, It is very difficult to help without adequate information. What does your objective function look like? Are you maximizing (in which case you have to make sure that the sign of the objective function is correct) or minimizing? Can you try "optimx" with the control option all.methods=TR

Re: [R] Scaling problem in optim()

2011-08-15 Thread Ravi Varadhan
ization algorithms. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu<mailto:rvarad...@jhmi.edu> [[a

[R] How to generate a random variate that is correlated with a given right-censored random variate?

2011-08-26 Thread Ravi Varadhan
. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu<mailto:rvarad...@jhmi.edu> [[alternative HTML version d

Re: [R] How to generate a random variate that is correlated with a given right-censored random variate?

2011-08-26 Thread Ravi Varadhan
distribution. What kind of bivariate coupla might work? Then, how to generate from the conditional distribution [U | T]? Any thoughts? Thanks, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology

Re: [R] Gradient function in OPTIMX

2011-08-30 Thread Ravi Varadhan
these gradients to us? In "optimx", we should probably change this into a "warning" rather than a "stop". Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology Sc

Re: [R] Gradients in optimx

2011-08-31 Thread Ravi Varadhan
ical gradient is not sufficiently close to the user-specified gradient. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email

[R] Hessian matrix issue

2011-09-07 Thread Ravi Varadhan
s will be close to zero ans2$hessian However, it is not known whether the standard errors obtained from this Hessian are asymptotically valid. Best, Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Geronto

Re: [R] Hessian matrix issue

2011-09-07 Thread Ravi Varadhan
lculate significance levels. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu<mailto:rvarad..

Re: [R] Imposing Feller condition using project constraint in spg

2011-09-08 Thread Ravi Varadhan
ction of w1'. This is a simple calculus exercise, and I will leave this as a homework problem for you to solve! Best, Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns

Re: [R] Global optimisation with inequality constraints

2011-09-09 Thread Ravi Varadhan
argument. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu<mailto:rvarad...@jhmi.edu> [[alternative

Re: [R] numerical integration and 'non-finite function value' error

2011-06-22 Thread Ravi Varadhan
In the limit as x goes to infinity, the integrand x f(x) should go to 0 sufficiently fast in order for the integral to be finite. The error indicates that the integrand becomes infinite for large x. Check to ensure that the integrand is correctly specified. I don't understand how you can repla

Re: [R] Time-series analysis with treatment effects - statistical approach

2011-06-22 Thread Ravi Varadhan
If you have any specific features of the time series of soil moisture, you could either model that or directly estimate it and test for differences in the 4 treatments. If you do not have any such specific considerations, you might want to consider some nonparametric approaches such as function

[R] How to capture console output in a numeric format

2011-06-24 Thread Ravi Varadhan
n the actual numerical values. How can I do this? Thanks very much for any suggestions. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410)

Re: [R] How to capture console output in a numeric format

2011-06-24 Thread Ravi Varadhan
he 3-column matrix. It would be nice, if there was a more direct way to get the numerical output, perhaps a numeric option in capture.output(). Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Ger

Re: [R] How to capture console output in a numeric format

2011-06-24 Thread Ravi Varadhan
I did think of this solution, Keith, but I am generally uncomfortable (may be "paranoid" is a better word) with the use of `<<-'. Perhaps, my fear is unjustified in this particular situation. Thanks, Ravi. ------- Ravi Vara

Re: [R] Coxph not converging with continuous variable

2012-09-04 Thread Ravi Varadhan
covariates, and then converting the scaled coefficients back to the original scale? Of course, the end user could do this just as easily! Best, Ravi Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric Medicine & Gerontology Johns Hopkins Univer

Re: [R] Non-negativity constraints for logistic regression

2011-12-22 Thread Ravi Varadhan
boundary. Asymptotic distribution of MLE estimators will not be normal in the case of convergence at the boundary. This is a difficult problem. Best, Ravi --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology

[R] problem of "constrOptim.nl", no hessian and convergence

2011-12-29 Thread Ravi Varadhan
default method "BFGS" is better in this setting. Hope this helps, Ravi ------- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email:

Re: [R] quadratic programming-maximization instead of

2012-01-04 Thread Ravi Varadhan
ite matrix since the original matrix ought to be negative-definite. Ravi --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad..

[R] Download statistics for a package

2011-09-28 Thread Ravi Varadhan
Hi, How can I get information on how many times a particular package has been downloaded from CRAN? Thanks, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins

Re: [R] Poor performance of "Optim"

2011-10-02 Thread Ravi Varadhan
Hi, You really need to study the documentation of "optim" carefully before you make broad generalizations. There are several algorithms available in optim. The default is a simplex-type algorithm called Nelder-Mead. I think this is an unfortunate choice as the default algorithm. Nelder-Mea

[R] optim seems to be finding a local minimum

2011-11-11 Thread Ravi Varadhan
here is also the issue of properly scaling your function, because it is poorly scaled. Look how different the 2 parameters are - they are 7 orders of magnitude apart. You are really asking for trouble here. Hope this is helpful, Ravi. ----

[R] performance of adaptIntegrate vs. integrate

2011-11-11 Thread Ravi Varadhan
roving the convergence of a sequence. This could be an explanation for the better performance, but I cannot say for sure. Hope this is helpful, Ravi --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School o

Re: [R] A contour plot question - vis.gam () function in "mgcv"

2012-04-03 Thread Ravi Varadhan
Thank you, Peter. I don't know why I didn't think of this! Also, thanks to Ilai. Ravi From: Peter Ehlers [ehl...@ucalgary.ca] Sent: Tuesday, April 03, 2012 8:22 PM To: ilai Cc: Ravi Varadhan; r-help@r-project.org Subject: Re: [R] A co

Re: [R] How to solve a non-linear system of equations using R

2008-06-04 Thread Ravi Varadhan
Jorge, You can use the package "BB" to try and solve this problem. I have re-written your functions a little bit. # -- # Constants # -- l=1 m=0.4795 s=0.4795 # -- # Functions to estimate f_i-k_i #

Re: [R] How to combine to PCAs

2008-06-05 Thread Ravi Varadhan
Let V = (v11, v12, ..., v1n, v21, v22, ..., v2n) be the matrix of data with 2*n columns. Now, you simply do PCA on this data matrix. See the following paper, which has a related example: Gabriel, K. R. and Odoroff, C. L. (1990). Biplots in biomedical research. Statistics in Medicine, 9, 469-48

[R] A faster way to compute finite-difference gradient of a scalar function of a large number of variables

2008-03-27 Thread Ravi Varadhan
in advance for any help or hints. 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] A faster way to compute finite-difference gradient of ascalarfunction of a large number of variables

2008-03-27 Thread Ravi Varadhan
regards, 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]

Re: [R] Fwd: Re: Nonlinear equation

2008-04-02 Thread Ravi Varadhan
ose to zero. If not, try a different starting value. 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] Fwd: Re: Nonlinear equation

2008-04-02 Thread Ravi Varadhan
Also, note that depending on A and B there are likely to be multiple (or no) solutions to your equation. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine

Re: [R] L-BFGS-B needs finite values of 'fn'

2008-04-02 Thread Ravi Varadhan
tion is what you want. 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] L-BFGS-B needs finite values of 'fn'

2008-04-02 Thread Ravi Varadhan
uot; posed. You could increase your penalty to get a solution that is closer to the analytical solution you are expecting. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health D

Re: [R] L-BFGS-B needs finite values of 'fn'

2008-04-03 Thread Ravi Varadhan
[8] 0.8044702 0.7879365 > > As you can see, things are much better! Hope this helps, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University

[R] Skipping specified rows in scan or read.table

2008-04-09 Thread Ravi Varadhan
"numeric" mode. Is there a way to do this so that I can then manipulate the numeric data frame? Thanks for any help. Best, Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging

Re: [R] LSODA not accurate when RK4 is; what's going on?

2008-04-10 Thread Ravi Varadhan
uot;) 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: (4

Re: [R] LSODA not accurate when RK4 is; what's going on?

2008-04-10 Thread Ravi Varadhan
;, the maximum steplength. s4 <- lsoda(y=sqrt(pi/2), times=t4, func=fn, parms=0, hmax=0.001) plot(s4, type="l") Best, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and

Re: [R] LSODA not accurate when RK4 is; what's going on?

2008-04-10 Thread Ravi Varadhan
t values for atol, rtol, and hmax, which are 1e-06, 1e-06, and Inf, respectively. "rk4", on the other hand is not so intelligent. It basically use fixed time increment. Ravi. ---- --- Ravi Varadhan, Ph.D. A

Re: [R] SVD of a variance matrix

2008-04-15 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] SVD of a variance matrix

2008-04-15 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] SVD of a variance matrix

2008-04-16 Thread Ravi Varadhan
or example, GW Stewart's Matrix Algorithms (vol 1. Basic decompositions, SIAM 1998), page 70. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine

[R] BB - a new package for solving nonlinear system of equations and for optimization with simple constraints

2008-04-23 Thread Ravi Varadhan
mapping. Best regards, 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://

Re: [R] Non-linear system of equations

2008-04-25 Thread Ravi Varadhan
ow you intended to use these, but they are the problem. Therefore, you need to define your function correctly. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Ger

Re: [R] Non-linear system of equations

2008-04-25 Thread Ravi Varadhan
lly for possible errors. 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 Ema

Re: [R] complex conjugates roots from polyroot?

2007-11-24 Thread Ravi Varadhan
e of numerical round-off (there is no argument in polyroot that governs the accuracy of the roots). Best, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medici

Re: [R] complex conjugates roots from polyroot?

2007-11-26 Thread Ravi Varadhan
qrt(.Machine$double.eps). I wouldn't consider multiple real roots to be conjugates, since they are not distinct points on the complex plane, as well as for the reason that you have given. Best, Ravi. ---- --- Ravi

Re: [R] complex conjugates roots from polyroot?

2007-11-26 Thread Ravi Varadhan
ances are used by these algorithms. However, it appears that "polynom" is more accurate. Best, Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriat

Re: [R] measure smoothness

2007-11-27 Thread Ravi Varadhan
derivative sqrt(mean(diff(A[1:11,2], diff=2)^2)) sqrt(mean(diff(A[12:22,2], diff=2)^2)) sqrt(mean(diff(A[23:33,2], diff=2)^2)) It is clear that the "new smoothed" data is the smoothest. Ravi. ---- --- Ravi Vara

Re: [R] simulating a 2-parameter integrated ornstein-uhlenbeck process?

2007-11-28 Thread Ravi Varadhan
You may want to check the package "sde" that can simulate from a number of different stochastic differential equations, including the OU process. Ravi. ------- Ravi Varadhan, Ph.D. Assistant Professor,

Re: [R] 3D array

2007-12-04 Thread Ravi Varadhan
The following will work: apply(my.array, c(1,2), mean) Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University

Re: [R] Calculating large determinants

2007-12-05 Thread Ravi Varadhan
you ensure that you have a "global" maximum? Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University

Re: [R] Calculating large determinants

2007-12-05 Thread Ravi Varadhan
tin. 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/agingandhea

Re: [R] Large determinant problem

2007-12-10 Thread Ravi Varadhan
components, and stop when you suspect rank-deficiency. 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] Calculating Rsquared values in rpart

2007-12-13 Thread Ravi Varadhan
45 9%2bdi015668%2b01p00145%2b0%2cFF15&searchUrl=http%3A%2F%2Fwww.jstor.org%2Fse arch%2FAdvancedResults%3Fhp%3D25%26si%3D1%26q0%3DYe%2Bdata%2Bmining%26f0%3D% 26c0%3DAND%26wc%3Don%26sd%3D%26ed%3D%26la%3D%26dc%3DStatistics Ravi. ---

Re: [R] Result depends on previous result; easy with a loop; but without a loop?

2007-12-14 Thread Ravi Varadhan
.identical(initial.matrix, initial.matrix2) This tests for "identicality", which, of course, is not appropriate for floating point computations. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center

Re: [R] integration

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

Re: [R] PCA - "cov.wt(z) : 'x' must contain finite values only"

2007-12-18 Thread Ravi Varadhan
A code that can deal with missing values by somehow imputing them. Ravi. ---- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins

Re: [R] can optimize solve paired euqations?

2007-12-20 Thread Ravi Varadhan
rm of the set of functions by calling optim() # Uses the BFGS algorithm within optim() # All the control parameters can be passed as in the call to optim() # # Author: Ravi Varadhan, Center on Aging and Health, Johns Hopkins University, [EMAIL PROTECTED] # # June 21, 2007 # func <- functi

Re: [R] Can R solve this optimization problem?

2008-01-07 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] We

Re: [R] Maximum likelihood estimation

2008-09-05 Thread Ravi Varadhan
*t)-(l-b*p)*exp(-t)*sinh(delta*t)/delta) logl <- sum(diff(y)*log(diff(mt))-diff(mt)-lfactorial(diff(y))) return(-logl) } However, I don't understand what the following fragment is doing in `fr': l^2 > lambda*b*p Can you clarfy that? Ravi. --

<    1   2   3   4   5   6   7   >