similar to: Matlab code to R code

Displaying 20 results from an estimated 500 matches similar to: "Matlab code to R code"

2010 Oct 04
1
Help with apply
Suppose I have the following data: tmp <- data.frame(var1 = sample(c(0:10), 3, replace = TRUE), var2 = sample(c(0:10), 3, replace = TRUE), var3 = sample(c(0:10), 3, replace = TRUE)) I can run the following double loop and yield what I want in the end (rr1) as: library(statmod) Q <- 2 b <- runif(3) qq <- gauss.quad.prob(Q, dist = 'normal', mu = 0, sigma=1) rr1 <- matrix(0,
2005 Jun 08
2
Converting code from MATLAB to R
Hi, I'm having trouble converting code from MATLAB to R; I want to find the equivalence to MATLAB's function 'fsolve'. I've tried 'nlm', on the squared argument, in R but i did not get the same results. Thankful if helped. Best regards, Martin Englund ------------------------------------------------------------------------------ This e-mail and any attachment may
2012 Jul 15
1
how to extract p-value in GenMatch function
Dear R-Users, I have a problem on extracting T-Stat and P-Value. I have written R-code below library("Matching") data("lalonde") attach(lalonde) names(lalonde) Y <- lalonde$re78 Tr <- lalonde$treat glm1 <- glm(Tr~age+educ+black+hisp+married+nodegr+re74+re75,family=binomial,data=lalonde) pscore.predicted <- predict(glm1) rr1 <-
2010 May 17
1
sapply code
Hi r-users,   I have this code here, but I just wonder how do I use 'sapply' to make it more efficient lamda_cor <- eigen(winter_cor)$values   > lamda_cor [1] 1.3459066 1.0368399 0.8958128 0.7214407   lamda_cxn <- function(dt) { n       <- length(dt)   term    <- vector(length=n, mode="numeric")     for (i in 1:n)   { term[i] <- (dt[i]/n)*log(dt[i]/n) }    
2009 Jul 06
1
transform multi skew-t to uniform distribution
Hi R-users,  I have a data from multi skew t and would like to transform each of the data to uniform data.  I tried using 'pmst' but only got one output:   > rr1 <- as.vector(r1);rr1  [1]  0.7207582  5.2250906  1.7422237  0.5677233  0.7473555 -0.6020626 -2.1947872 -1.1128313 -0.6587316 -1.1409261     > pmst(rr1, xi=rep(0,10), Omega=diag(10), alpha=rep(1,10), df=5) [1] 3.676525e-09
2010 Sep 29
1
nlminb and optim
I am using both nlminb and optim to get MLEs from a likelihood function I have developed. AFAIK, the model I has not been previously used in this way and so I am struggling a bit to unit test my code since I don't have another data set to compare this kind of estimation to. The likelihood I have is (in tex below) \begin{equation} \label{eqn:marginal} L(\beta) = \prod_{s=1}^N \int
2005 Nov 08
2
retrieve most abundant species by sample unit
Hi R-users: [R 2.2 on OSX 10.4.3] I have a (sparse) vegetation data frame with 500 rows (sampling units) and 177 columns (plant species) where the data represent % cover. I need to summarize the cover data by returning the names of the most dominant and the second most dominant species per plot. I reduced the data frame to omit cover below 5%; this is what it looks like stacked. I have
2008 Aug 26
2
svymeans question
I have the following code which produces the output below it clus1 <- svydesign(ids = ~schid, data = lower_dat) items <- as.formula(paste(" ~ ", paste(lset, collapse= "+"))) rr1 <- svymean(items, clus1, deff='replace', na.rm=TRUE) > rr1 mean SE DEff W525209 0.719748 0.015606 2.4932 W525223 0.508228 0.027570 6.2802 W525035 0.827202
2003 Sep 29
2
Solving nonlinear system equation
Hi all, I would like to ask that is there any function in R which can solve nonlinear system equations with several variables. Thats mean some functions similar to the 'fsolve' or 'fzero' in matlab. Thanks you Jerry _________________________________________________________________ Get 10Mb extra storage for MSN Hotmail. Subscribe Now!
2005 May 01
3
Roots of quadratic system.
Hello, I have a system of quadratic equations (results of a Hamiltonian optimization) which I need to find the roots for. Is there a package and/or function which will find the roots for a quadratic system? Note that I am not opimizing, but rather solving the first order conditions which come from a Hamiltonian. I am basically looking for something in R that will do the same thing as fsolve in
2009 Nov 29
1
optim or nlminb for minimization, which to believe?
I have constructed the function mml2 (below) based on the likelihood function described in the minimal latex I have pasted below for anyone who wants to look at it. This function finds parameter estimates for a basic Rasch (IRT) model. Using the function without the gradient, using either nlminb or optim returns the correct parameter estimates and, in the case of optim, the correct standard
2008 Jul 19
2
How to solve systems of nonlinear equations in R?
Hey, I was wondering if there existed a R function similar to 'fsolve' or 'fzero' Matlab functions? Thanks! Francois Aucoin [[alternative HTML version deleted]]
2014 Dec 26
2
[LLVMdev] X86 disassembler & assembler mismatch
The IMM3/IMM5 come from here X86RecognizableInstr.cpp 943 TYPE("SSECC", TYPE_IMM3) 944: TYPE("AVXCC", TYPE_IMM5) On Thu, Dec 25, 2014 at 8:22 PM, Jun Koi <junkoi2004 at gmail.com> wrote: > > > On Fri, Dec 26, 2014 at 11:54 AM, Jun Koi <junkoi2004 at gmail.com> wrote: > >> hi, >> >> some instructions
2007 Sep 24
1
Root finding problem
Hello, I have a problem finding a root of a function, which I define like this: tuki <- function(u, x, a, lambda){ if((lambda%%1>0) & u<0) {u<-(u+0i)} f <- Re(x-(a*(u)^lambda-(1-(u))^lambda)/lambda) f } What I want to do is to find the root, but without specifying the interval within which to search for it. I can do it easily in MATLAB with fsolve() or fzero() functions. I
2011 Apr 14
1
Using GSL Routines
Dear R-programmers, I am trying out certain methods in R, and the statistics require me to calculate n-(sample size) dimensional equations. They are not really very hard to solve - my home-brew implentation of Newton-Raphson in R succeeds most of time with simulated data. (Note that I am assured of a unique solution by theory). Problem comes in with real data, for which I should really implement
2008 Sep 19
0
panel data analysis possible with mle2 (bbmle)?
Dear R community, I want to estimate coefficients in a (non-linear) system of equations using 'mle2' from the "bbmle" package. Right now the whole data is read in as just one long time series, when it's actually 9 cross sections with 30 observations each. I would like to be able to test and correct for autocorrelation but haven't found a way to do this in this package.
2007 Aug 23
0
weighted nls and confidence intervals
for unweighted fits using `nls' I compute confidence intervals for the fitted model function by using: #------------------- se.fit <- sqrt(apply(rr$m$gradient(), 1, function(x) sum(vcov(rr)*outer(x,x)))) luconf <- yfit + outer(se.fit, qnorm(c(probex, 1 - probex))) #------------------- where `rr' contains an `nls' object, `x' is the independent variable vector, `yfit'
2007 Aug 31
0
non-linear fitting (nls) and confidence limits
dear list members, I apologize in advance for posting a second time, but probably after one week chances are, the first try went down the sink.. my question concerns computation of confidence intervals in nonlinear fits with `nls' when weigthing the fit. the seemingly correct procedure does not work as expected, as is detailed in my original post below. any remarks appreciated. greetings
2008 Oct 08
1
Troubleshooting ZFS performance with SIL3124 cards
Hi! I have a problem with ZFS and most likely the SATA PCI-X controllers. I run opensolaris 2008.11 snv_98 and my hardware is Sun Netra x4200 M2 with 3 SIL3124 PCI-X with 4 eSATA ports each connected to 3 1U diskchassis which each hold 4 SATA disks manufactured by Seagate model ES.2 (500 and 750) for a total of 12 disks. Every disk has its own eSATA cable connected to the ports on the PCI-X
1997 Aug 13
0
Incomplete backups with tar option of smbclient.
We use the tar option of smbclient (Samba 1.9.16p9, SunOS 4.1.3) to backup Windows 95 PCs: smbclient "\\${server}\backup" -U COMPUTING -d 1 -D "\" -Tc tarfile >! logfile backup is set as a share of c:\ The backups are incomplete (as shown by the logfile and gzip -tf tarfile). Typically, only very roughly 5700 of 6600 files get copied. I expect I've got a bad