Displaying 20 results from an estimated 3000 matches similar to: "problem of "constrOptim.nl", no hessian and convergence"
2011 Dec 29
0
problem of "constrOptim.nl", no hessian and convergence values
Dear Helper,
I used "constrOptim.nl" and got the value of par. The estimations looks good
even if the number of iterations is only 16. But the values of hessian and
convergence are both "NULL".
I tested the objective function and gradient function by "optim" and didn't
see any problem there. With these functions, "optim" gives the convergence
value
2012 Apr 03
1
A contour plot question - vis.gam () function in "mgcv"
Hi,
Please see the attached contour plot (I am sorry about the big file). This was created using the vis.gam() function in "mgcv" package. However, my question is somewhat broader.
In generating this figure, I first created the contours using vis.gam() and then I plotted the points. These point are plotted on top of the contours so that some of the contour lines are only partially
2011 Aug 31
1
Gradients in optimx
Hi Reuben,
I am puzzled to note that the gradient check in "optimx" does not work for you. Can you send me a reproducible example so that I can figure this out?
John - I think the best solution for now is to issue a "warning" rather than an error message, when the numerical gradient is not sufficiently close to the user-specified gradient.
Best,
Ravi.
2011 Sep 28
1
Download statistics for a package
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 University
Ph. (410) 502-2619
email: rvaradhan@jhmi.edu<mailto:rvaradhan@jhmi.edu>
[[alternative
2013 Jan 30
1
starting values in glm(..., family = binomial(link =log))
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
rvaradhan@jhmi.edu<mailto:rvaradhan@jhmi.edu>
410-502-2619
[[alternative HTML version deleted]]
2006 Sep 18
0
Propensity score modeling using machine learning methods. WAS: RE: LARS for generalized linear models
There may be benefits to having a machine learning method that
explicitly targets covariate balance. We have experimented with
optimizing the weights directly to obtain the best covariate balance,
but got some strange solutions for simple cases that made us wary of
such methods.
Machine learning methods that yield calibrated probability estimates
should do well (e.g. those that optimize the
2006 Nov 14
2
Matrix-vector multiplication without loops
Hi,
I am trying to do the following computation:
p <- rep(0, n)
coef <- runif(K+1)
U <- matrix(runif(n*(2*K+1)), n, 2*K+1)
for (i in 0:K){
for (j in 0:K){
p <- p + coef[i+1]* coef[j+1] * U[,i+j+1]
} }
I would appreciate any suggestions on how to perform this computation
efficiently without the "for" loops?
Thank
2012 Apr 19
4
Column(row)wise minimum and maximum
Hi,
Currently, the "base" has colSums, colMeans. It seems that it would be useful to extend this to also include colMin, colMax (of course, rowMin and rowMax, as well) in order to facilitate faster computations for large vectors (compared to using apply). Has this been considered before? Please forgive me if this has already been discussed before.
Thanks,
Ravi
Ravi Varadhan, Ph.D.
2004 Dec 03
3
Computing the minimal polynomial or, at least, its degree
Hi,
I would like to know whether there exist algorithms to compute the
coefficients or, at least, the degree of the minimal polynomial of a square
matrix A (over the field of complex numbers)? I don't know whether this
would require symbolic computation. If not, has any of the algorithms been
implemented in R?
Thanks very much,
Ravi.
P.S. Just for the sake of completeness, a
2006 Sep 29
2
X-axis labels in histograms drawn by the "truehist" function
Hi,
I have a simple problem that I would appreciate getting some tips. I am
using the "truehist" function within an "apply" call to plot multiple
histograms. I can't figure out how to get truehist to use the column names
of the matrix as the labels for the x-axis of the histograms.
Here is a simple example:
X <- matrix(runif(4000),ncol=4)
colnames(X)
2005 Apr 20
3
Keeping factors with zero occurrences in "table" output
Dear R group,
I have a data frame which contains data on preferences on 7 items (ranks 1
through 7) listed by each participant. I would like to tabulate this in a
7x7 table where the rows would be the items and the columns would be the
number of times that item received a particular rank.
I tried doing this by creating a matrix by "rbind"ing each vector obtained
using
2013 Apr 25
2
Vectorized code for generating the Kac (Clement) matrix
Hi,
I am generating large Kac matrices (also known as Clement matrix). This a tridiagonal matrix. I was wondering whether there is a vectorized solution that avoids the `for' loops to the following code:
n <- 1000
Kacmat <- matrix(0, n+1, n+1)
for (i in 1:n) Kacmat[i, i+1] <- n - i + 1
for (i in 2:(n+1)) Kacmat[i, i-1] <- i-1
The above code is fast, but I am curious about
2010 Feb 28
1
Which system.time() component to use?
Hi,
The `system.time(expr)' command provide 3 different times for evaluating the expression `expr'; the first two are user and system CPUs and the third one is total elapsed time. Suppose I want to compare two different computational procedures for performing the same task, which component of `system.time' is most meaningful in the sense that it most accurately reflects the
2009 Feb 19
2
Source code for nlm()
Hi,
Where can I find the source code for nlm()? I dowloaded the R2.8.1.tar.gz
file and looked at all the .c and .f files, but couldn't find either nlm.c
or nlm.f
There is an nlm.r file, but that is not useful.
Thanks for any help,
Ravi.
----------------------------------------------------------------------------
-------
Ravi Varadhan, Ph.D.
Assistant Professor, The Center on Aging
2011 Aug 26
2
How to generate a random variate that is correlated with a given right-censored random variate?
Hi,
I have a right-censored (positive) random variable (e.g. failure times subject to right censoring) that is observed for N subjects: Y_i, I = 1, 2, ..., N. Note that Y_i = min(T_i, C_i), where T_i is the true failure time and C_i is the censored time. Let us assume that C_i is independent of T_i. Now, I would like to generate another random variable U_i, I = 1, 2, ..., N, which is
2023 Mar 20
0
Optimizing with constraints using alabama
Hi,
I am testing code that is working successfully using constrOptim. I am replacing constrOptim with other solvers to compare benefits and performance.
My belief was that, like constrOptim, auglag in the alabama package would eliminate beta vectors that failed the constraints prior to calling the objective
function. These betas are not only not in the solution space but also cause
2008 Apr 23
1
BB - a new package for solving nonlinear system of equations and for optimization with simple constraints
Hi,
We (Paul Gilbert and I) have just released a new R package on CRAN called
"BB" (stands for Barzilai-Borwein) that provides functionality for solving
large-scale (and small-scale) nonlinear system of equations. Until now, R
didn't have any functionality for solving nonlinear systems. We hope that
this package fills that need.
We also have an implementation of the
2008 Mar 18
1
How to reverse colors in filled.contour?
Hi,
I am plotting values of log(hazards ratio) as a function of two predictors,
using the plotting function filled.contour(). Here is a simple simulated
example of this:
x <- seq(0,1, length=20)
y <- seq(0,1, length=20)
z <- outer(x,y, function(x,y) x^2 + y^2 )
zmat <- matrix( rexp(n=400, rate = z+0.001), 20, 20)
filled.contour(x, y, log(zmat),
2011 Jun 24
4
How to capture console output in a numeric format
Hi,
I would like to know how to capture the console output from running an algorithm for further analysis. I can capture this using capture.output() but that yields a character vector. I would like to extract the actual numeric values. Here is an example of what I am trying to do.
fr <- function(x) { ## Rosenbrock Banana function
on.exit(print(f))
x1 <- x[1]
x2 <- x[2]
2009 Nov 26
0
R: RE: R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails
Thanks for your message!
Actually it works quite well for me too.
If I then take the trace of the final result below, I end up with a number
made up of both a real and an imaginary part. This does not probably mean much
if the trace of the matrix below givens me info about the degrees of freedom of
a model...
Simona
>----Messaggio originale----
>Da: RVaradhan at jhmi.edu
>Data: