similar to: R Optimization 101 for R Newcomers: An extended example

Displaying 20 results from an estimated 9000 matches similar to: "R Optimization 101 for R Newcomers: An extended example"

2004 Jun 29
0
gambling problem
Hi all i have an interesting project that i have been working on. i intended to set this as a first year programming problem but then changed my mind since i thought that it might be too difficult for them to program. the problem is as follows: You have been approached by a local casino in order to investigate the performance of one of their slot machines. The slot machine
2001 Jul 28
2
Re: [S] Labels wrong with lrm
Dear Jan, Thank you very much for your excellent description of the problem and the self-contained test code. This is a problem that I've been meaning to either document better or solve for some time. The root of the problem is with the builtin S-Plus terms.inner function: > attr(terms.inner(asthma ~ pol(age,kx) + smok),'variables') expression(age, kx, smok) You can see that
2011 Jul 31
1
example package for devel newcomers
Hi, I'd like to know whether there is a package (or more, of course) regarded as a good example that could be used also as an instructional tool for newcomers to R extensions development. Thanks. -- Alexandre -- Alexandre Santos Aguiar, MD, SCT -------------- Pr?xima Parte ---------- Um anexo n?o-texto foi limpo... Nome: n?o dispon?vel Tipo: application/pgp-signature Tamanho: 198
2011 Aug 02
0
[Rd] example package for devel newcomers
Em Segunda 01 Agosto 2011, voc? escreveu: > Is there a preferred language you would like to use in your package > development? I randomly downloaded packages until I found some that > helped me along my way, and might be able to help you pick one. If you > are just looking at building a package of R functions and data you > have developed, possibly the following example will get you
2011 Jul 31
3
example package for devel newcomers
Hi, I'd like to know whether there is a package (or more, of course) regarded as a good example that could be used also as an instructional tool for newcomers to R extensions development. Thanks. -- Alexandre -- Alexandre Santos Aguiar, MD, SCT -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198
2010 Oct 13
4
loop
Dear all, I am trying to run a loop in my codes, but the software returns an error: "subscript out of bounds" I dont understand exactly why this is happenning. My codes are the following: rm(list=ls()) #remove almost everything in the memory set.seed(180185) nsim <- 10 mresultx <- matrix(-99, nrow=1000, ncol=nsim) mresultb <- matrix(-99, nrow=1000, ncol=nsim) N
2010 Oct 13
1
(no subject)
Dear all, I have just sent an email with my problem, but I think no one can see the red part, beacuse it is black. So, i am writing again the codes: rm(list=ls()) #remove almost everything in the memory set.seed(180185) nsim <- 10 mresultx <- matrix(-99, nrow=1000, ncol=nsim) mresultb <- matrix(-99, nrow=1000, ncol=nsim) N <- 200 I <- 5 taus <- c(0.480:0.520) h <-
2006 Apr 27
1
? bug in 'sample' (PR#8813)
I have found that specifying different "sizes" in the sample command has a funny effect on the random sampling. The code below is a condensed version of a function I wrote to simulate a bootstrap method. For simplicity, I eliminated the internal bootstrap loop, but kept a statement to draw one bootstrap sample, because this is where the problem occurs. The output (mean(y)^2) should be
2013 Feb 25
1
creating variable that codes for the match/mismatch between two other variables
Dear all, I have got two vectors coding for a stimulus presented in the current trial (mydat$Stimulus) and a prediction in the same trial (mydat$Prediciton), respectively. By applying an if-conditional I want to create a new vector that indicates if there is a match between both vectors in the same trial. That is, if the prediction equals the stimulus. When I pick out some trials randomly, I get
2002 Feb 11
0
profile
I am running 1.3.1 on a Windows (NT 4.0) machine. I've fit a nonlinear model intended to predict crop yield from nutrient information, and want to use the profile function. If I type say, profile(simparj.fm) I get the following error message: "Error in prof$getProfile(): number of iterations exceeded maximum of 5.25515e-308" I used the profiler function to profile simparj,fm step
2006 Jul 20
1
Loss of numerical precision from conversion to list ?
I?m working on an R-implementation of the simulation-based finite-sample null-distribution of (R)LR-Test in Mixed Models (i.e. testing for Var(RandomEffect)=0) derived by C. M. Crainiceanu and D. Ruppert. I'm in the beginning stages of this project and while comparing quick and dirty grid-search-methods and more exact optim()/optimize()-based methods to find the maximum of a part of the
2011 Nov 07
1
How do I return to the row values of a matrix after computing distances
## Package Needed library(fields) ## Assumptions set.seed(123) nsim<-5 p<-2 ## Generate Random Matrix G G <- matrix(runif(p*nsim),nsim,p) ## Set Empty Matraces dmax and dmin dmax<- matrix(data=NA,nrow=nsim,ncol=p) dmin<- matrix(data=NA,nrow=nsim,ncol=p) ## Loop to Fill dmax and dmin for(i in 1:nsim) { dmax[i]<- max(rdist(G[i,,drop=FALSE],G)) dmin[i]<-
2008 Apr 08
1
Weibull maximum likelihood estimates for censored data
Hello! I have a matrix with data and a column indicating whether it is censored or not. Is there a way to apply weibull and exponential maximum likelihood estimation directly on the censored data, like in the paper: Backtesting Value-at-Risk: A Duration-Based Approach, P Chrisoffersen and D Pelletier (October 2003) page 8? The problem is that if I type out the code as below the likelihood
2008 Oct 02
1
For newcomers to the mailing list.
1. Don't top post. 2. Don't hijack another thread with new unrelated info. 3. Trim your responses. 4. Turn off html in your mail client. 5. Try and do some basic google searches on your problem. Quoted from: http://www.centos.org/modules/tinycontent/index.php?id=16
2018 Feb 25
0
include
Jim has been exceedingly patient (and may well continue to be so), but this smells like "failure to launch". At what point will you start showing your (failed) attempts at solving your own problems so we can help you work on your specific weaknesses and become self-sufficient? -- Sent from my phone. Please excuse my brevity. On February 25, 2018 7:55:55 AM PST, Val <valkremk at
2011 Feb 17
1
How to speed up a for() loop
Dear all, Does anyone have any idea on how to speed up the for() loop below. Currently it takes approximately 2 minutes and 30 seconds. Because of the size of Nsim and N, simulating a multivariate normal (instead of simulating Nsim times a vector of N normal distributions) would require too much memory space. Many thanks for your kind help, Simona N=3000 PD=runif(N,0,1) cutoff.=qnorm(PD)
2010 Dec 30
1
Sorting data.frame datewise in a descending order
Dear 'HTH' R friends I have a small dataframe as given below. I need to sort this database based on date in a decending order. I am not sure whether I have defined the date column in a proper format. mydat<-data.frame(date = (c("1/31/2010", "2/28/2010", "3/31/2010", "4/30/2010", "5/31/2010", "6/30/2010",
2018 Feb 25
0
include
Hi Val, My fault - I assumed that the NA would be first in the result produced by "unique": mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) val23<-unique(unlist(mydat[,c("Col2","col3")])) napos<-which(is.na(val23)) preval<-data.frame(Col1=val23[-napos],
2018 Feb 25
0
include
hi Val, Your problem seems to be that the data are read in as a factor. The simplest way I can think of to get around this is: mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) rbind(preval,mydat)
2018 Feb 25
2
include
HI Jim and all, I want to put one more condition. Include col2 and col3 if they are not in col1. Here is the data mydat <- read.table(textConnection("Col1 Col2 col3 K2 X1 NA Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) The desired out put would be Col1 Col2 col3 1 X1 0 0 2 K1 0 0 3 Y1 0 0 4 W1 0 0 6 K2 X1