Re: [R] Number of Cores limited to two in CRAN

2023-07-03 Thread Ravi Varadhan via R-help
Dear Henrik, Thank you! This is quite helpful, especially your longer blog post. Best regards, Ravi From: Henrik Bengtsson Sent: Sunday, July 2, 2023 4:33 AM To: Ravi Varadhan Cc: R-Help Subject: Re: [R] Number of Cores limited to two in CRAN External

Re: [R] Number of Cores limited to two in CRAN

2023-07-02 Thread Ravi Varadhan via R-help
This is the specific error messsage from R CMD check --as-cran Error in .check_ncores(length(names)) : 16 simultaneous processes spawned Calls: prepost -> makeCluster -> makePSOCKcluster -> .check_ncores Execution halted Thanks, Ravi ____ From: Ravi

[R] Number of Cores limited to two in CRAN

2023-07-02 Thread Ravi Varadhan via R-help
Hi, I am developing a package where I would like to utilize multiple cores for parallel computing. However, I get an error message when I run R CMD check --as-cran. I read that CRAN limits the number of cores to 2. Is this correct? Is there any way to overcome this limitation? Thank you,

Re: [R] How to use ifelse without invoking warnings

2021-10-08 Thread Ravi Varadhan via R-help
Ravi From: John Fox Sent: Thursday, October 7, 2021 2:00 PM To: Ravi Varadhan Cc: R-Help Subject: Re: [R] How to use ifelse without invoking warnings External Email - Use Caution Dear Ravi, It's already been suggested that you could disable warnings, but th

[R] How to use ifelse without invoking warnings

2021-10-07 Thread Ravi Varadhan via R-help
Hi, I would like to execute the following vectorized calculation: ans <- ifelse (k >= -1 & k <= n, pbeta(p, k+1, n-k, lower.tail = FALSE), ifelse (k < -1, 0, 1) ) For example: > k <- c(-1.2,-0.5, 1.5, 10.4) > n <- 10 > ans <- ifelse (k >= -1 & k <= n, pbeta(p,k+1,n-k,lower.tail=FALSE),

Re: [R] A Question about MLE in R

2020-07-24 Thread Ravi Varadhan
I agree with John that SANN should be removed from optim. More importantly, the default choice of optimizer in optim should be changed from "Nelder-Mead" to "BFGS." Nelder-Mead is a bad choice for the most commonly encountered optimization problems in statistics. I really do not see a good

Re: [R] Fast matrix multiplication

2018-08-14 Thread Ravi Varadhan
Does Microsoft open R come with pre-compiled BLAS that is optimized for matrix computations? Thanks, Ravi -Original Message- From: Ista Zahn Sent: Monday, August 13, 2018 3:18 PM To: Ravi Varadhan Cc: r-help@r-project.org Subject: Re: [R] Fast matrix multiplication On Mon, Aug 13

Re: [R] Fast matrix multiplication

2018-08-14 Thread Ravi Varadhan
Hi Ista, Thank you for the response. I use Windows. Is there a pre-compiled version of openBLAS for windows that would make it easy for me to use it? Thanks, Ravi -Original Message- From: Ista Zahn Sent: Friday, August 10, 2018 12:20 PM To: Ravi Varadhan Cc: r-help@r-project.org

[R] Fast matrix multiplication

2018-08-10 Thread Ravi Varadhan
Hi, I would like to compute: A %*% B %*% t(A) A is a mxn matrix and B is an nxn symmetric, positive-definite matrix, where m is large relative to n (e.g., m=50,000 and n=100). Here is a sample code. M <- 1 N <- 100 A <- matrix(rnorm(M*N), M, N) B <- crossprod(matrix(rnorm(N*N),

Re: [R] adding overall constraint in optim()

2018-05-05 Thread Ravi Varadhan
vect)), b=1, meq=1))) Ravi ____ From: Ravi Varadhan Sent: Saturday, May 5, 2018 12:31 PM To: m.ash...@enduringinvestments.com; r-help@r-project.org Subject: adding overall constraint in optim() Hi, You can use the projectLinear argument in BB::spg to optimize with linear

[R] adding overall constraint in optim()

2018-05-05 Thread Ravi Varadhan
Hi, You can use the projectLinear argument in BB::spg to optimize with linear equality/inequality constraints. Here is how you implement the constraint that all parameters sum to 1. require(BB) spg(par=p0, fn=myFn, project="projectLinear", projectArgs=list(A=matrix(1, 1, length(p0)),

Re: [R] Subject: glm and stepAIC selects too many effects

2017-06-06 Thread Ravi Varadhan
More principled would be to use a lasso-type approach, which combines selection and estimation in one fell swoop! Ravi From: Ravi Varadhan Sent: Tuesday, June 6, 2017 10:16 AM To: r-help@r-project.org Subject: Subject: [R] glm and stepAIC selects too many

[R] Subject: glm and stepAIC selects too many effects

2017-06-06 Thread Ravi Varadhan
If AIC is giving you a model that is too large, then use BIC (log(n) as the penalty for adding a term in the model). This will yield a more parsimonious model. Now, if you ask me which is the better option, I have to refer you to the huge literature on model selection. Best, Ravi

Re: [R] Haplo.glm error: Failed to converge during EM-glm loop

2016-06-14 Thread Ravi Varadhan
onverge when you set a small tolerance for convergence. You may fiddle with the control options for EM algorithm and see if you can get convergence. If not, you should contact the package authors. Hope this is helpful, Ravi Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg) Associate Pr

[R] Linear Regressions with non-negativity constraint

2016-05-23 Thread Ravi Varadhan
Hi, Take a look at the package "ic.infer" by Ulrike Gromping. https://www.jstatsoft.org/article/view/v033i10 Best, Ravi Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg) Associate Professor, Department of Oncology Division of Biostatistics & Bionformatics

Re: [R] help in maximum likelihood

2016-03-04 Thread Ravi Varadhan
Standard error = sqrt(diag(solve(opt$hessian))) Ravi From: Alaa Sindi [mailto:alaasi...@icloud.com] Sent: Wednesday, March 02, 2016 3:22 PM To: Ravi Varadhan <ravi.varad...@jhu.edu> Cc: r-help@r-project.org Subject: Re: help in maximum likelihood Thank you very much prof. Ravi, That wa

Re: [R] help in maximum likelihood

2016-03-02 Thread Ravi Varadhan
6, 63, 59, 62, 60) # note: there is no need to have the choose(n, y) term in the likelihood fn <- function(p) sum( - (y*(p[1]+p[2]*x) - n*log(1+exp(p[1]+p[2]*x))) ) out <- nlm(fn, p = c(-50,20), hessian = TRUE) out eigen(out$hessian) Hope this is helpful, Ravi Ravi Varadhan, Ph.D.

[R] Looking for a data set - Teratology data of Chen and Kodell (1989)

2016-02-18 Thread Ravi Varadhan
it. Does anyone know of this or worked with this data set? If so, can someone share it with me? Thank you very much. Best, Ravi Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg) Associate Professor, Department of Oncology Division of Biostatistics & Bionformatics Sidney Ki

Re: [R] Solve an equation including integral

2016-01-08 Thread Ravi Varadhan
nf, t, nu=nu, exi=exi)$value return(res) } uniroot(myroot, c(-2, 2), nu=2, exi=0.5, alpha=.05) Ravi From: Ravi Varadhan Sent: Friday, January 08, 2016 11:29 AM To: r-help@r-project.org; 'sstol...@gmail.com' <sstol...@gmail.com> Subject: Re: Solve an equation including integral I think t

Re: [R] Solve an equation including integral

2016-01-08 Thread Ravi Varadhan
05) Hope this is helpful, Ravi Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg) Associate Professor, Department of Oncology Division of Biostatistics & Bionformatics Sidney Kimmel Comprehensive Cancer Center Johns Hopkins University 550 N. Broadway, Suite -E Baltimore, MD

[R] grep/regexp

2015-12-01 Thread Ravi Varadhan
ent_of_CD4" and "Fr_II_percent_of_CD4". How can I use grep() to do this? More generally, are there any good online resources with examples like this for the use of grep() and regexp() in R? I didn't find the help pages for these very user-friendly. Thank you very much, Ravi Ra

[R] Cautioning optim() users about "Nelder-Mead" default - (originally) Optim instability

2015-11-15 Thread Ravi Varadhan
Hi, While I agree with the comments about paying attention to parameter scaling, a major issue here is that the default optimization algorithm, Nelder-Mead, is not very good. It is unfortunate that the optim implementation chose this as the "default" algorithm. I have several instances

Re: [R] Cautioning optim() users about "Nelder-Mead" default - (originally) Optim instability

2015-11-15 Thread Ravi Varadhan
mentations of Nelder-Mead. Best regards, Ravi From: ProfJCNash <profjcn...@gmail.com> Sent: Sunday, November 15, 2015 12:21 PM To: Ravi Varadhan; 'r-help@r-project.org'; lorenzo.ise...@gmail.com Cc: b...@xs4all.nl; Gabor Grothendieck Subject: Re:

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

2015-11-11 Thread Ravi Varadhan
still happen). I would strongly suggest that when you are doing simulations, you should encapsulate the parameter estimation inside a `try' or `tryCatch' statement so that when there is an error, the simulation keeps going rather than crashing out. See the attached code. Best, Ravi Ravi Varadhan

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

2015-11-11 Thread Ravi Varadhan
It seems like there is substantial finite-sample bias in the MLEs. Either that or there is some error in your procedure. See attached code. Ravi From: Ravi Varadhan Sent: Wednesday, November 11, 2015 2:33 PM To: 'denizozo...@gazi.edu.tr' <denizozo...@gazi.edu.tr>; r-help@r-project.

[R] How to get variable name while doing series of regressions in an automated manner?

2015-10-27 Thread Ravi Varadhan
HS? In addition, is there a better paradigm for doing these type of series of regressions in an automatic fashion? Thank you very much, Ravi Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg) Associate Professor, Department of Oncology Division of Biostatistics & Bionfor

Re: [R] How to get variable name while doing series of regressions in an automated manner?

2015-10-27 Thread Ravi Varadhan
Sent: Tuesday, October 27, 2015 1:50 PM To: Ravi Varadhan <ravi.varad...@jhu.edu> Cc: r-help@r-project.org Subject: Re: [R] How to get variable name while doing series of regressions in an automated manner? Marc,Ravi: I may misunderstand, but I think Marc's solution labels the list

Re: [R] Linear regression with a rounded response variable

2015-10-22 Thread Ravi Varadhan
:11 PM To: Charles C. Berry Cc: Ravi Varadhan; r-help@r-project.org Subject: Re: [R] Linear regression with a rounded response variable > On 21 Oct 2015, at 19:57 , Charles C. Berry <ccbe...@ucsd.edu> wrote: > > On Wed, 21 Oct 2015, Ravi Varadhan wrote: > >> [snippage] > &g

[R] Linear regression with a rounded response variable

2015-10-21 Thread Ravi Varadhan
ered. Any suggestions? Thank you, Ravi Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg) Associate Professor, Department of Oncology Division of Biostatistics & Bionformatics Sidney Kimmel Comprehensive Cancer Center Johns Hopkins University 550 N. Broadway, Suite -E Baltimore

Re: [R] Bug in auglag?

2015-10-06 Thread Ravi Varadhan
.de> Sent: Tuesday, October 6, 2015 9:20 AM To: Ravi Varadhan Cc: 'r-help@r-project.org' Subject: Bug in auglag? Hi Ravi, I would like come back to your offer. I have a problem which possibly is caused by a bug or by something I don't understand: My function to be minimised is executed eve

Re: [R] optimizing with non-linear constraints

2015-10-01 Thread Ravi Varadhan
2015 3:37 AM To: Ravi Varadhan <ravi.varad...@jhu.edu> Cc: 'r-help@r-project.org' <r-help@r-project.org> Subject: Re: optimizing with non-linear constraints Ravi Varadhan <ravi.varad...@jhu.edu> writes: > Hi Rainer, > It is very simple to specify the constraints (l

Re: [R] optimizing with non-linear constraints

2015-09-30 Thread Ravi Varadhan
n(x, LAI) { h <- rep(NA, 2) h[1] <- LAI^x[2] / x[3] + x[1] h[2] <- 1 - x[1] - LAI^x[2] / x[3] h } Please take a look at the help page. If it is still not clear, you can contact me offline. Best, Ravi Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg) Associate Professor,

[R] lsqlin in pracma

2015-08-29 Thread Ravi Varadhan
In solve.QP(), you don't need to expand the equality into two inequalities. It can DIRECTLY handle the equality constraints. The first `meq' rows of the constraint matrix are equality constraints. Here is the excerpt from the documentation. meq the first meq constraints are treated as

Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R

2015-07-04 Thread Ravi Varadhan
What about numeric constants, like `163'? eval(Pre(exp(sqrt(163)*pi), 120))does not work. Thanks, Ravi From: David Winsemius dwinsem...@comcast.net Sent: Saturday, July 4, 2015 1:12 PM To: Duncan Murdoch Cc: r-help; John Nash; Ravi Varadhan Subject

Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R

2015-07-03 Thread Ravi Varadhan
), then all the constants, 163, pi, are automatically of 120 bits precision. Is this easy to do? Best, Ravi From: David Winsemius dwinsem...@comcast.net Sent: Friday, July 3, 2015 2:06 PM To: John Nash Cc: r-help; Ravi Varadhan Subject: Re: [R] : Ramanujan

Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R

2015-07-03 Thread Ravi Varadhan
matters in Rmpfr. Even if it does, the answer you get is still wrong as you showed. Thanks, Ravi -Original Message- From: Richard M. Heiberger [mailto:r...@temple.edu] Sent: Thursday, July 02, 2015 6:30 PM To: Aditya Singh Cc: Ravi Varadhan; r-help Subject: Re: [R] : Ramanujan

[R] Ramanujan and the accuracy of floating point computations - using Rmpfr in R

2015-07-02 Thread Ravi Varadhan
Hi, Ramanujan supposedly discovered that the number, 163, has this interesting property that exp(sqrt(163)*pi), which is obviously a transcendental number, is real close to an integer (close to 10^(-12)). If I compute this using the Wolfram alpha engine, I get:

Re: [R] multiple parameter optimization with optim()

2015-02-21 Thread Ravi Varadhan
Harold, Obviously the bottleneck is your objective function fn(). I have speeded up your function by a factor of about 2.4 by using `outer' instead of sapply. I think it can be speeded much more. I couldn't figure it out without spending a lot of time. I am sure someone on this list-serv

Re: [R] Unable to use `eval(parse(text))' in nlme::lme

2015-02-14 Thread Ravi Varadhan
Yes, this is a very important point. Thank you, Bill. Best, Ravi From: William Dunlap wdun...@tibco.com Sent: Friday, February 13, 2015 4:56 PM To: Ravi Varadhan Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] Unable to use `eval(parse(text))' in nlme::lme ff

Re: [R] Unable to use `eval(parse(text))' in nlme::lme

2015-02-09 Thread Ravi Varadhan
, Transplant_type!=0 time 0) lme(ff, random=~1|Patient, data=dd, correlation=corAR1(), na.action=na.omit) Best, Ravi Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg) Associate Professor Department of Oncology Division of Biostatistics Bionformatics Johns Hopkins University 550 N. Broadway

[R] Unable to use `eval(parse(text))' in nlme::lme

2015-02-08 Thread Ravi Varadhan
Hi, I would like to run lme() on a number of response variables in a dataframe in an automatic manner. Bu, when I use eval(parse(text=yname)) to denote the LHS of the formula in lme(), I get the following error message: require(nlme) mod2 - with(subset(labdata2, Transplant_type!=0

Re: [R] Re-order levels of a categorical (factor) variable

2015-01-22 Thread Ravi Varadhan
...@stat.math.ethz.ch Sent: Thursday, January 22, 2015 10:29 AM To: Bert Gunter Cc: William Dunlap; r-help@r-project.org; Ravi Varadhan Subject: Re: [R] Re-order levels of a categorical (factor) variable Bert Gunter gunter.ber...@gene.com on Wed, 21 Jan 2015 18:52:12 -0800 writes: Bill/Ravi: I

[R] Re-order levels of a categorical (factor) variable

2015-01-21 Thread Ravi Varadhan
Hi, I have a fairly elementary problem that I am unable to figure out. I have a continuous variable, Y, repeatedly measured at multiple times, T. The variable T is however is coded as a factor variable having these levels: c(Presurgery, Day 30, Day 60, Day 180, Day 365). When I plot the

Re: [R] R 3.1.2 mle2() function on Windows 7 Error and multiple solutions

2015-01-15 Thread Ravi Varadhan
Hi, I tried your problem with optimx package. I found a better solution than that found by mle2. ?library(optimx) # the objective function needs to be re-written LL2 - function(par,y) { lambda - par[1] alpha - par[2] beta - par[3] R = Nweibull(y,lambda,alpha,beta) -sum(log(R)) }

Re: [R] R 3.1.2 mle2() function on Windows 7 Error and multiple solutions

2015-01-15 Thread Ravi Varadhan
difficult to know a priori which one would be the best for my problem. Thus, the benchmarking capability provided by optimx is a powerful feature. Ravi From: Ben Bolker bbol...@gmail.com Sent: Thursday, January 15, 2015 9:29 AM To: Ravi Varadhan; R-Help Cc

[R] Subject: short-sale constraint with nonpositive-definite matrix in portfolio optimization

2014-12-21 Thread Ravi Varadhan
Hi, You can try a projected gradient approach, which is implemented in the spg() function in the BB package. You have to provide a projection function which will take an infeasible matrix as input and will give a feasible (i.e. positive-definite) matrix as output. This kind of matrix

[R] Checking modeling assumptions in a binomial GLMM

2014-07-16 Thread Ravi Varadhan
Dear All, I am fitting a model for a binary response variable measured repeatedly at multiple visits. I am using the binomial GLMM using the glmer() function in lme4 package. How can I evaluate the model assumptions (e.g., residual diagnostics, adequacy of random effects distribution) for a

Re: [R] Box-cox transformation

2014-07-07 Thread Ravi Varadhan
Thank you. It is very helpful. Ravi -Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Monday, July 07, 2014 4:15 PM To: Ravi Varadhan Cc: r-help@r-project.org Subject: Re: [R] Box-cox transformation Dear Ravi, In my previous example, I used the residuals, so

[R] Box-cox transformation

2014-07-06 Thread Ravi Varadhan
Hi, I am trying to do Box-Cox transformation, but I am not sure how to do it correctly. Here is an example showing what I am trying: # example from MASS require(MASS) boxcox(Days+1 ~ Eth*Sex*Age*Lrn, data = quine, lambda = seq(-0.05, 0.45, len = 20)) # Here is My attempt at getting

[R] A combinatorial assignment problem

2014-05-01 Thread Ravi Varadhan
Hi, I have this problem: K candidates apply for a job. There are R referees available to review their resumes and provide feedback. Suppose that we would like M referees to review each candidate (M R). How would I assign candidates to referees (or, conversely, referees to candidates)?

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Ravi Varadhan
Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. H. Gilbert Welch On Thu, May 1, 2014 at 6:09 AM, Ravi Varadhan ravi.varad...@jhu.edu wrote: Thank you, Dan and Bert. Bert – Your approach provides

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Ravi Varadhan
for referees is 13 - 3 = 10. Of course, I have to increase the # iters to get a better solution, but for large K and R this may not converge at all. Best regards, Ravi From: Ravi Varadhan Sent: Wednesday, April 30, 2014 1:49 PM To: r-help@r-project.org Subject: A combinatorial assignment

[R] A couple of issues with lattice::bwplot

2014-02-25 Thread Ravi Varadhan
Hi All, I am using lattice::bwplot to plot the results of a subgroup analysis for different simulation scenarios. I have 4 subgroups, 5 methods of estimating treatment effect in subgroups, and 4 scenarios. I am plotting the subgroup effect and its upper and lower CI. I have 2 issues that I

[R] Unable to Install a package from source in Windows

2014-01-09 Thread Ravi Varadhan
Hi, I am using following R version: version _ platform i386-w64-mingw32 arch i386 os mingw32 system i386, mingw32 status major 3 minor 0.1 year 2013 month 05 day16 svn rev62743 language

Re: [R] convergence=0 in optim and nlminb is real?

2013-12-17 Thread Ravi Varadhan
The optimization algorithms did converge to a limit point. But, not to a stationary point, i.e. a point in parameter space where the first and second order KKT conditions are satisfied. If you check the gradient at the solution, you will see that it is quite large in magnitude relative to 0.

Re: [R] [optim/bbmle] function returns NA

2013-08-14 Thread Ravi Varadhan
Carlos, There are likely several problems with your likelihood. You should check it carefully first before you do any optimization. It seems to me that you have box constraints on the parameters. They way you are enforcing them is not correct. I would prefer to use an optimization algorithm

Re: [R] GARCH Optimization Problems

2013-08-01 Thread Ravi Varadhan
Hi Tony, Did you try the `auglag' algorithm in alabma package? Ravi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] While using R CMD check: LaTex error: File `inconsolata.sty' not found

2013-07-12 Thread Ravi Varadhan
Hi, While using R CMD check I get the following Latex error message which occurs when creating PDF version of manual: LaTex error: File `inconsolata.sty' not found I am using Windows 7 (64-bit) and R 3.0.1. I have MikTex 2.9. I see that the incosolata.sty is present under \doc\fonts folder.

[R] Vectorized code for generating the Kac (Clement) matrix

2013-04-26 Thread Ravi Varadhan
in 2:(n+1)) Kacmat[i, i-1] - i-1 The above code is fast, but I am curious about vectorized ways to do this. Thanks in advance. Best, Ravi Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric Medicine Gerontology Johns Hopkins University rvarad

Re: [R] Vectorized code for generating the Kac (Clement) matrix

2013-04-26 Thread Ravi Varadhan
Varadhan; 'r-help@r-project.org' Subject: Re: [R] Vectorized code for generating the Kac (Clement) matrix On 26-04-2013, at 14:42, Enrico Schumann e...@enricoschumann.net wrote: On Thu, 25 Apr 2013, Ravi Varadhan ravi.varad...@jhu.edu writes: Hi, I am generating large Kac matrices (also known

Re: [R] Crrstep help

2013-03-28 Thread Ravi Varadhan
Hi Kathy, You should first contact the package maintainer (which is me!) before posting to r-help. Which version of the package are you using? Can you send me a minimally reproducible code? Ravi Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric

Re: [R] Crrstep help

2013-03-28 Thread Ravi Varadhan
Kathy, You need to make sure that you have installed the latest version of `cmprsk' package (version 2.2-4). crrstep will not work Otherwise. Ravi From: Ravi Varadhan Sent: Thursday, March 28, 2013 5:25 PM To: 'kathyhan...@gmail.com' Cc: r-help@r-project.org Subject: Re: [R] Crrstep help

Re: [R] Constrained Optimization in R (alabama)

2013-02-11 Thread Ravi Varadhan
optimizers like alabama would still NOT be good approaches. It would be easiest to just go through the discrete values. Ravi From: Berend Hasselman [b...@xs4all.nl] Sent: Monday, February 11, 2013 12:45 AM To: Axel Urbiz Cc: R-help@r-project.org; Ravi

Re: [R] Constrained Optimization in R (alabama)

2013-02-10 Thread Ravi Varadhan
Urbiz [axel.ur...@gmail.com] Sent: Sunday, February 10, 2013 3:16 PM To: R-help@r-project.org; Ravi Varadhan Subject: Constrained Optimization in R (alabama) Dear List, I'm trying to solve this simple optimization problem in R. The parameters are the exponents to the matrix mm. The constraints

Re: [R] Constrained Optimization in R (alabama)

2013-02-10 Thread Ravi Varadhan
) Ravi From: Axel Urbiz [axel.ur...@gmail.com] Sent: Sunday, February 10, 2013 3:16 PM To: R-help@r-project.org; Ravi Varadhan Subject: Constrained Optimization in R (alabama) Dear List, I'm trying to solve this simple optimization problem in R

[R] Non linear programming: choose R that minimizes corr(y,x^R)

2013-02-06 Thread Ravi Varadhan
(p, function(p) cor(y, x^p)^2) plot(seq(0,5,length=1000), obj2(seq(0,5,length=1000),x,y), type=l) Best, Ravi Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric Medicine Gerontology Johns Hopkins University rvarad...@jhmi.edumailto:rvarad...@jhmi.edu 410

[R] starting values in glm(..., family = binomial(link =log))

2013-01-30 Thread Ravi Varadhan
Try this: Age_log_model = glm(Arthrose ~ Alter, data=x, start=c(-1, 0), family=quasibinomial(link = log)) Ravi Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric Medicine Gerontology Johns Hopkins University rvarad...@jhmi.edumailto:rvarad

Re: [R] starting values in glm(..., family = binomial(link =log))

2013-01-30 Thread Ravi Varadhan
I did not get any warnings when I ran your data/model example. From: Fischer, Felix [mailto:felix.fisc...@charite.de] Sent: Wednesday, January 30, 2013 11:19 AM To: Ravi Varadhan Cc: r-help@r-project.org Subject: AW: [R] starting values in glm(..., family = binomial(link =log)) Thanks for your

Re: [R] model selection with spg and AIC (or, convert list to fitted model object)

2012-12-04 Thread Ravi Varadhan
: Sunday, December 02, 2012 5:04 PM To: Ravi Varadhan Cc: Adam Zeilinger (zeil0...@umn.edu); r-help@r-project.org Subject: Re: [R] model selection with spg and AIC (or, convert list to fitted model object) Dear Ravi, Thank you so much for the help. I switched to using the optimx function but I

Re: [R] Integration in R

2012-11-21 Thread Ravi Varadhan
Send us a reproducible R code that shows what you actually tried. Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric Medicine Gerontology Johns Hopkins University rvarad...@jhmi.edumailto:rvarad...@jhmi.edu 410-502-2619 [[alternative HTML

Re: [R] vectorized uni-root?

2012-11-09 Thread Ravi Varadhan
() will not be deprecated unless you can vectorize Brent's hybrid root-finding approach! Best, Ravi Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric Medicine Gerontology Johns Hopkins University rvarad...@jhmi.edumailto:rvarad...@jhmi.edu 410-502-2619

Re: [R] Struggeling with nlminb...

2012-11-05 Thread Ravi Varadhan
Try optimx() in the optimx package with the control option `all.methods=TRUE'. Ravi Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric Medicine Gerontology Johns Hopkins University rvarad...@jhmi.edumailto:rvarad...@jhmi.edu 410-502-2619

Re: [R] optim .C / Crashing on run

2012-11-05 Thread Ravi Varadhan
You might also want to try the Nelder-Mead algorithm, nmk(), in the dfoptim package. It is a better algorithm than the Nelder-Mead in optim. It is all R code, so you might be able to modify it to fit your needs. Ravi Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health

Re: [R] Creating Optimization Constraints

2012-10-17 Thread Ravi Varadhan
You have nonlinear constraints on the parameters. Take a look at constrained optimization algorithms in packages alabama or Rsolnp that can handle non-linearly constrained optimization problems. Ravi Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric

Re: [R] fit a threshold function with nls

2012-10-16 Thread Ravi Varadhan
From: Vito Muggeo [vito.mug...@unipa.it] Sent: Tuesday, October 16, 2012 9:55 AM To: Bert Gunter Cc: Véronique Boucher Lalonde; r-help@r-project.org; Ravi Varadhan Subject: Re: [R] fit a threshold function with nls Véronique, in addition to Bert's comments, I would like to bring

[R] model selection with spg and AIC (or, convert list to fitted model object)

2012-10-11 Thread Ravi Varadhan
optimization are not using optimx. This is a very powerful for benchmarking unconstrained and box-constrained optimization problems. It deserves to be used widely, in my biased, but correct, opinion. Ravi Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric

Re: [R] Constraint Optimization with constrOptim

2012-09-18 Thread Ravi Varadhan
: require(BB)   proj.simplex - function(y, c=1) { # # project an n-dim vector y to the simplex S_n # S_n = { x | x \in R^n, 0 = x = c, sum(x) = c} # Copyright: Ravi Varadhan, Johns Hopkins University # August 8, 2012 # n - length(y) sy - sort(y, decreasing=TRUE) csy - cumsum(sy) rho

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 University rvarad

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 contour plot

Re: [R] quadratic programming-maximization instead of

2012-01-04 Thread Ravi Varadhan
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] problem of constrOptim.nl, no hessian and convergence

2011-12-29 Thread Ravi Varadhan
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: rvarad...@jhmi.edumailto:rvarad...@jhmi.edu

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

2011-12-22 Thread Ravi Varadhan
on the 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] optim seems to be finding a local minimum

2011-11-11 Thread Ravi Varadhan
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. --- Ravi Varadhan, Ph.D. Assistant Professor

[R] performance of adaptIntegrate vs. integrate

2011-11-11 Thread Ravi Varadhan
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 of Medicine

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-Mead

[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] Global optimisation with inequality constraints

2011-09-09 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.edumailto:rvarad...@jhmi.edu [[alternative HTML version deleted

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

2011-09-08 Thread Ravi Varadhan
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 Hopkins University Ph. (410) 502-2619 email

[R] Hessian matrix issue

2011-09-07 Thread Ravi Varadhan
whether the standard errors obtained from this Hessian are asymptotically valid. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619

Re: [R] Hessian matrix issue

2011-09-07 Thread Ravi Varadhan
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.edumailto:rvarad...@jhmi.edu From: Ravi Varadhan

Re: [R] Gradients in optimx

2011-08-31 Thread Ravi Varadhan
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: rvarad

Re: [R] Gradient function in OPTIMX

2011-08-30 Thread Ravi Varadhan
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 School of Medicine Johns Hopkins University Ph. (410) 502

[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.edumailto:rvarad...@jhmi.edu [[alternative HTML version deleted

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] Scaling problem in optim()

2011-08-15 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.edumailto:rvarad...@jhmi.edu [[alternative HTML version deleted

[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

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] How to capture console output in a numeric format

2011-06-24 Thread Ravi Varadhan
. 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) 502-2619 email: rvarad

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

2011-06-24 Thread Ravi Varadhan
. 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 Gerontology School of Medicine

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

  1   2   3   4   5   6   7   >