similar to: optim() question

Displaying 20 results from an estimated 4000 matches similar to: "optim() question"

2009 Oct 15
4
Generating a stochastic matrix with a specified second dominant eigenvalue
Hi, Given a positive integer N, and a real number \lambda such that 0 < \lambda < 1, I would like to generate an N by N stochastic matrix (a matrix with all the rows summing to 1), such that it has the second largest eigenvalue equal to \lambda (Note: the dominant eigenvalue of a stochastic matrix is 1). I don't care what the other eigenvalues are. The second eigenvalue is
2009 Jul 02
2
constrained optimisation in R.
i want to estimate parameters with maximum likelihood method with contraints (contant numbers). for example sum(Ai)=0 and sum(Bi)=0 i have done it without the constraints but i realised that i have to use the contraints. Without constraints(just a part-not complete): skellamreg_LL=function(parameters,z,design) { n=length(z); mu=parameters[1]; H=parameters[2]; Apar=parameters[3:10];
2009 Nov 03
1
Passing Command to Optim in factanal
Hi, I am currently trying to execute the following command: f<-factanal(factors=k$Components$nparallel,covmat=m,n.obs=2287,rotation="varimax",control=list(opt=list(method=c("BFGS")))) but keep getting the error: L-BFGS-B needs finite values of 'fn' I can't figure out what I am doing wrong here, why isn't optim being told to use BFGS instead of L-BFGS-B...
2008 Sep 25
2
Two overlaid density plots - Does order matter?
In the following code, the only difference between the two plots is the order the variables are plotted. In this case, the plot of "cdata.den" in plot #1 is different from its plot in #2. Specifically, "cdata.den" spans the x-axis from -5 to 30 in plot #1 and from 0 to 20 in plot #2. Does anyone understand why these two plots do not yield the same result? #Make density
2008 Nov 07
2
Vectorizing sample()
I am simulating sickness among a group of families. Part of the task is to randomly draw who in the family will be sick, randomly drawing from family ID's where Dad =1, Mom = 2, Kid1 = 3, Kid2 = 4., etc. My census of Dads is of the form shown below. Dad_ID Spouse (Y=1;N=0) #Kids #People_Becoming_Sick 1 1 0 1 2
2010 Jun 03
3
General-purpose GPU computing in statistics (using R)
Hi All, I have been reading about general purpose GPU (graphical processing units) computing for computational statistics. I know very little about this, but I read that GPUs currently cannot handle double-precision floating points and also that they are not necessarily IEEE compliant. However, I am not sure what the practical impact of this limitation is likely to be on computational
2009 Feb 10
1
loglik and arima()
All - I am evaluating an arima(2,1,3) and arima(3,1,3) and notice the log-likelihood of the restricted model is higher than the log-likelihood of the unrestricted. Since these are nested models, I thought the unrestricted model would have a log-likelihood at least as large as that of the restricted model. Am I interpreting the "loglik" output incorrectly? Regards, Stephen
2009 Jul 02
1
lokern package
Dear Martin, I have been playing a lot with the glkerns() function in the "lokern" package for "automatic" smoothing of time-series data. This kernel smoothing approach of Gasser and Mueller seems to perform quite well for estimating the function and its derivatives (first and second derivatives). In fact, this is one of the best methods based on my simulation studies for
2009 Jul 20
2
EM Clustering
Hi all, could someone send me examples of the EM Clustering algorithm and/or some pdf describing it? Thanks, Douglas Sousa.
2009 Sep 10
1
function to solve equations
Hi, I am trying to solve this equation prob = exp(-3.33 + 0.0102*x)/(1+exp(-3.33 + 0.0102*x)). I want to write a function where I call the function and enter the 'prob' value and the output should be the 'x'. Im not sure how to write this. I have a basic structure but im not sure if its correct. calc <- function(prob){ prob <- exp(-3.33+0.0102*x)/(1+exp(-3.33 + 0.0102*x))
2009 Oct 07
1
sinusoidal relationship
Hi, Suppose x and y are vectors whose elements are known. I know that there is a sinusoidal relation between them. In other words, y=a*sin(bx) where b is probably a function of pi. How do I find a and b in R? Hakan [[alternative HTML version deleted]]
2009 Oct 07
1
Simulate negative skewed, fat-tailed distribution
Hi guys Is there a way in R to simulate/generate random numbers from a negative skewed and fat tailed distribution ? I would like to simulate a set of (discrete) data. Regards, Carlos Carlos http://www.nabble.com/file/p25783889/graph.png graph.png -- View this message in context: http://www.nabble.com/Simulate-negative-skewed%2C-fat-tailed-distribution-tp25783889p25783889.html Sent from the
2009 Nov 03
1
multivariate numerical integration.
I am currently using the package 'adapt' for multivariate integration. However this package seems to be removed from CRAN (It is still referred to in the help file for integrate(stats) though). I assume it has been deprecated for a reason? Is there an alternative for multivariate numerical integration? ----- Jeroen Ooms * Dept. of Methodology and Statistics * Utrecht University Visit
2009 Dec 16
1
regularised incomplete beta function
Dear: I am trying to work out the regularised incomplete beta function in R. I searched google on this and found UCS library. But I can not find this in R packages. Does anyone have use this before or how to insert UCS in R? Many Thanks! Xin Xin ------- Dr.Xin Shi Senior Lecturer in Statistics Manchester Metropolitan University Business School Aytoun Building Aytoun Street Manchester M1
2010 Feb 23
2
significance of coefficients in Constrained regression
I am fittting a linner regression with constrained parameters, saying, all parameters are non-negative and sum up to 1. I have searched historical R-help and found that this can be done by solve.QP from the quadprog package. I need to assess the significance of the coefficient estimates, but there is no standard error of the coefficient estimates in the output. So I can not compute the p-value.
2009 Dec 01
1
eigenvalues of complex matrices
Dear all, I want to compute the eigenvalues of a complex matrix for some statistics. Comparing it to its matlab/octave sibling, I don't get the same eigenvalues in R computing it from the exact same matrix. In R, I used eigen() and arpack() that give different eigenvalues. In matlab/octave I used eig() and eigs() that give out the same eigenvalues but different to the R ones. For real
2010 Jan 12
3
optim: abnormal termination in lnsrch (resend)
[sorry, forgot some details...] I'm using optim(param, fun, method='L-BFGS-B', lower=lo, upper=up) to minimize a certain function. Often the minimization ends with the message: ERROR: ABNORMAL_TERMINATION_IN_LNSRCH What is optim() trying to say? What have I to change in my function to make the minimization succeed? Do you think using BBoptim() instead of optim() changes anything?
2009 Nov 18
2
Error "system is computationally singular" by using function dmvnorm
Dear R users, i try to use function dmvnorm(x, mean, sigma, log=FALSE) from R package mvtnorm to calculate the probability of x under the multivariate normal distribution with mean equal to mean and covariance matrix sigma. I become the following Error in solve.default(cov, ...) : system is computationally singular: reciprocal condition number = 1.81093e-19 What could be the reason of it?
2009 Jun 17
3
Matrix inversion-different answers from LAPACK and LINPACK
Hello. I am trying to invert a matrix, and I am finding that I can get different answers depending on whether I set LAPACK true or false using "qr". I had understood that LAPACK is, in general more robust and faster than LINPACK, so I am confused as to why I am getting what seems to be invalid answers. The matrix is ostensibly the Hessian for a function I am optimizing. I want to get
2009 Jul 23
1
Non-negative solutions to complicated equations
Hi all, I have a system of 3 equations with many defined parameters and 3 variables I need to find solutions to. I actually know the solutions I'm aiming for (0.07,0.287,0.0061) but R tends to give me (0,0,0). I tried the "BB" package but don't really follow how to refine my solutions from that; these are wrong so far. Here's my code from trying that: > f<-function(x){