similar to: transcript a matlab code in R

Displaying 20 results from an estimated 500 matches similar to: "transcript a matlab code in R"

2009 May 16
1
maxLik pakage
Hi all; I recently have been used 'maxLik' function for maximizing G2StNV178 function with gradient function gradlik; for receiving this goal, I write the following program; but I have been seen an error  in calling gradient  function; The maxLik function can't enter gradlik function (definition of gradient function); I guess my mistake is in line ******** ,that the vector  ‘h’ is
2010 Dec 25
2
predict.lrm vs. predict.glm (with newdata)
Hi all I have run into a case where I don't understand why predict.lrm and predict.glm don't yield the same results. My data look like this: set.seed(1) library(Design); ilogit <- function(x) { 1/(1+exp(-x)) } ORDER <- factor(sample(c("mc-sc", "sc-mc"), 403, TRUE)) CONJ <- factor(sample(c("als", "bevor", "nachdem",
2011 Sep 21
2
Weighted Average on More than One Variable in Data Frame
Dear R Users, I have looked for a solution to the following problem and I have not been able to find it on the archive, through Google or in the R documentation. I have a data frame, say df, which has 4 variables, one of which I would like to use as a grouping variable (g), another one that I would like to use for my weights (w) The other two variables are variables (x1 and x2) for which I would
2009 Jan 05
1
transform R to C
Dear R users, i would like to transform the following function from R-code to C-code and call it from R in order to speed up the computation because in my other functions this function is called many times. `dgcpois` <- function(z, lambda1, lambda2) { `f1` <- function(alpha, lambda1, lambda2) return(exp(log(lambda1) * (alpha - 1) - lambda2 * lgamma(alpha))) `f2` <-
2006 Jul 07
1
convert ms() to optim()
How to convert the following ms() in Splus to Optim in R? The "Calc" function is also attached. ms(~ Calc(a.init, B, v, off, d, P.a, lambda.a, P.y, lambda.y, 10^(-8), FALSE, 20, TRUE)$Bic, start = list(lambda.a = 0.5, lambda.y = 240), control = list(maxiter = 10, tol = 0.1)) Calc <- function(A.INIT., X., V., OFF., D., P1., LAMBDA1., P2., LAMBDA2., TOL., MONITOR.,
2010 Jul 30
4
transpose of complex matrices in R
Hello everybody When one is working with complex matrices, "transpose" very nearly always means *Hermitian* transpose, that is, A[i,j] <- Conj(A[j,i]). One often writes A^* for the Hermitian transpose. I have only once seen a "real-life" case where transposition does not occur simultaneously with complex conjugation. And I'm not 100% sure that that wasn't a
2007 Nov 23
1
complex conjugates roots from polyroot?
Hi, All: Is there a simple way to detect complex conjugates in the roots returned by 'polyroot'? The obvious comparison of each root with the complex conjugate of the next sometimes produces roundoff error, and I don't know how to bound its magnitude: (tst <- polyroot(c(1, -.6, .4))) tst[-1]-Conj(tst[-2]) [1] 3.108624e-15+2.22045e-16i
2008 Sep 12
1
Error in "[<-"(`*tmp*`, i, value = numeric(0)) :
I use "while" loop but it produces an errro. I have no idea about this. Error in "[<-"(`*tmp*`, i, value = numeric(0)) : nothing to replace with The problem description is The likelihood includes two parameters to be estimated: lambda (=beta0+beta1*x) and alpha. The algorithm for the estimation is as following: 1) with alpha=0, estimate lambda (estimate beta0
2008 Sep 19
2
Error: function cannot be evaluated at initial parameters
I have an error for a simple optimization problem. Is there anyone knowing about this error? lambda1=-9 lambda2=-6 L<-function(a){ s2i2f<-(exp(-lambda1*(250^a)-lambda2*(275^a-250^a)) -exp(-lambda1*(250^a)-lambda2*(300^a-250^a))) logl<-log(s2i2f) return(-logl)} optim(1,L) Error in optim(1, L) : function cannot be evaluated at initial parameters Thank you in advance -- View this
2007 Feb 02
1
Inaccuracy in ?convolve
Hi, Man page for 'convolve' says: conj: logical; if 'TRUE', take the complex _conjugate_ before back-transforming (default, and used for usual convolution). The complex conjugate of 'x', of 'y', of both? In fact it seems that it takes the complex conjugate of 'y' only which is OK but might be worth mentioning because (1) conj=TRUE is the
2009 Aug 09
1
Inaccuracy in svd() with R ubuntu package
On two laptops running 32-bit kubuntu, I have found that svd(), invoked within R 2.9.1 as supplied with the current ubuntu package, returns very incorrect results when presented with complex-valued input. One of the laptops is a Dell D620, the other a MacBook Pro. I've also verified the problem on a 32-bit desktop. On these same systems, R compiled from source provides apparently
2011 Apr 11
1
pseudo-R by hand
hello dear list! since we want to do a model analysis and some people would like to see pseudo-R^2 values for different types of glm of a logistic regression, i've decided to write a function that computes either nagelkerkes normed pseudo-R or cox & snells pseudo-R. however, i am not clear as in the decisive step, i need to calculate the log of (maximum likelihood estimates of model
2009 Oct 14
1
different L2 regularization behavior between lrm, glmnet, and penalized?
The following R code using different packages gives the same results for a simple logistic regression without regularization, but different results with regularization. This may just be a matter of different scaling of the regularization parameters, but if anyone familiar with these packages has insight into why the results differ, I'd appreciate hearing about it. I'm new to
2005 Dec 09
1
O-ring statistic
Rainer M Krug writes: > Thorsten Wiegand used in his paper Wiegand T., and K. A. Moloney 2004. > Rings, circles and null-models for point pattern analysis in ecology. > Oikos 104: 209-229 a statistic he called O-Ring statistic which is > similar to Ripley's K, only that it uses rings instead of circles. > > http://www.oesa.ufz.de/towi/towi_programita.html#ring
2007 Dec 19
1
strange timings in convolve(x,y,type="open")
Dear R-ophiles, I've found something very odd when I apply convolve to ever larger vectors. Here is an example below with vectors ranging from 2^11 to 2^17. There is a funny bump up at 2^12. Then it gets very slow at 2^16. > for( i in 11:20 )print( system.time(convolve(1:2^i,1:2^i,type="o"))) user system elapsed 0.002 0.000 0.002 user system elapsed 0.373
2001 Sep 14
1
Supply linear constrain to optimizer
Dear R and S users, I've been working on fitting finite mixture of negative exponential distributions using maximum likelihood based on the example given in MASS. So far I had much success in fitting two components. The problem started when I tried to extend the procedure to fit three components. More specifically, likelihood = sum( ln(c1*exp(-x/lambda1)/lambda1 + c2*exp(-x/lambda2)/lambda2
2003 Jul 03
2
SVD and spectral decompositions of a hermitian matrix
Hi: I create a hermitian matrix and then perform its singular value decomposition. But when I put it back, I don't get the original hermitian matrix. I am having the same problem with spectral value decomposition as well. I am using R 1.7.0 on Windows. Here is my code: X <- matrix(rnorm(16)+1i*rnorm(16),4) X <- X + t(X) X[upper.tri(X)] <- Conj(X[upper.tri(X)]) Y <-
2005 Sep 09
2
two almost identical packages: best practice
Hi I have written a whole bunch of methods for objects of class "octonion". [ an octonion is a single column of an eight-row matrix. Octonions have their own multiplication rules and are a generalization of quaternions, which are columns of a four-row matrix. ] So far I've done about a dozen generic functions such as seq.octonion(), rep.octonion(), [<-.octonion(), and so on
2012 Oct 03
1
Errors when saving output from WinBUGS to R
Dear all I used R2WinBUGS package's bugs() function to generate MCMC results. Then I tried to save the simulation draws in R, using read.bugs() function. Here is a simple test: ###################### library(coda) library(R2WinBUGS) #fake some data to test beta0=1 beta1=1.5 beta2=-1 beta3=2 N=200 x1=rnorm(N, mean=0,sd=1) x2=rnorm(N, mean=0,sd=1) x3=rnorm(N, mean=0,sd=1) lambda2= exp(beta0+
2008 Dec 16
0
[LLVMdev] Another compiler shootout
On Tuesday 16 December 2008 01:03:36 Evan Cheng wrote: > FYI. http://leonardo-m.livejournal.com/73732.html > > If anyone is motivated, please file bugs for the losing cases. Also, > it might make sense to incorporate the tests into our nightly tester > test suite. FWIW, I just ported my ray tracer benchmark to C and found that llvm-gcc gives much worse performance than gcc on x86