similar to: Need help optimizing/vectorizing nested loops

Displaying 20 results from an estimated 3000 matches similar to: "Need help optimizing/vectorizing nested loops"

2012 Jul 10
2
estimation of NA by predict command
Dear arun and all R users, I will first of all try to simply define my issue.. I have data in the following format Year Discharge dd/mm/yyyy x .. … … … There are some NA values in the discharge which I would like to predict by using “predict command”. I cant figure out the way to write the coding for that. Could you please help me on that??? I have also ,written
2010 Jun 26
1
predict newdata question
Hi: I am using a subset of the below dataset to predict PRED_SUIT for the whole dataset but I am having trouble with 'newdata'. The model was created with 153 records and want to predict for 208 records. wolf2 <- structure(list(gridcell = c(367L, 444L, 533L, 587L, 598L, 609L, 620L, 629L, 641L, 651L, 662L, 674L, 684L, 695L, 738L, 748L, 804L, 805L, 872L, 919L, 929L, 938L, 950L, 958L,
2012 Apr 16
1
R: Help; error in optim
Hello, When i run the code below from Weibull distribution with 30% censoring by using optim i get an error form R, which states that Error in optim(start, fn = z, data = q, hessian = T) :? ? objective function in optim evaluates to length 25 not 1 can somebody?help me remove this error. Is my censoring approach correct. n=25;rr=1000 p=1.5;b=1.2 for (i in 1:rr){ q<-c(t,cen)
2004 Mar 21
1
Multilevel analysis with package lme
Dear list, i am a student of psychology and have to do a multilevelanalysis on some data. About that i have one general and one specific question. This is what i have copied from the help-file on lme: data(bdf) fm <- lme(langPOST ~ IQ.ver.cen + avg.IQ.ver.cen, data = bdf, random = ~ IQ.ver.cen | schoolNR) summary(fm) after summary(fm) i get the following error:
2007 Aug 16
1
Question about sm.options & sm.survival
Hi, there: It's my first time to post question in this forum, so thanks for your tolerance if my question is too naive. I am using a nonparametric smoothing procedure in sm package to generate smoothed survival curves for continuous covariate. I want to truncate the suvival curve and only display the part with covariate value between 0 and 7. The following is the code I wrote:
2005 Oct 24
1
Error in step() (or stepAIC) for Cox model
Hello all, I am trying to use stepwise procedure to select covariates in Cox model and use bootstrap to repeat stepwise selection, then record how many times variables are chosen by step() in bootstrap replications. When I use step() (or stepAIC) to do model selection, I got errors. Here is the part of my code for (j in 1:mm){ #<--mm=10 for (b in 1:nrow(reg.bs)){ #<--bootstrap 10
2005 Jan 11
1
lme4 print and summary errror
Hi all - (this is posted to r-help and R-SIG-MAC) OSX 10.3.7, R 2.0.1, lme4/Matrix/latticeExtra latest, fresh install of R. MASS loaded (or not). I am getting an error message for the print() and summary() commands with all lme models I try and run in lme4 (GLMM's work fine). Using the example from the lme help, summary and print produce the following errors, despite the model being
2012 Aug 31
3
fitting lognormal censored data
Hi , I am trying to get some estimator based on lognormal distribution when we have left,interval, and right censored data. Since, there is now avalible pakage in R can help me in this, I had to write my own code using Newton Raphson method which requires first and second derivative of log likelihood but my problem after runing the code is the estimators were too high. with this email ,I provide
2011 Oct 05
2
gamm: problems with corCAR1()
Dear all, I?m analyzing this dataset containing biodiversity indices, measured over time (Week), and at various contaminant concentrations (Treatment). We have two replicates (Replicate) per treatment. I?m looking for the effects of time (Week) and contaminant concentration (Treatment) on diversity indices (e.g. richness). Initial analysis with GAM models showed temporal autocorrelation of
2014 Jul 25
1
2.2.13 + hg: Panic: file ioloop.c: line 39 (io_add_file): assertion failed: (fd >= 0)
Hi, Found this in logfiles: Jul 25 14:12:38 dovecot: pop3(cen at so.red): Error: UIDL: File name lookup failed: Message was expunged Jul 25 14:12:38 dovecot: pop3(cen at so.red): Disconnected: POP3 UIDLs couldn't be listed top=187/356348, retr=0/0, del=0/1207, size=789346199 Jul 25 14:12:38 dovecot: pop3(cen at so.red): Panic: file ioloop.c: line 39 (io_add_file): assertion failed: (fd
2006 Jun 14
3
A question about stepwise procedures: step function
Dear all, I tried to use "step" function to do model selection, but I got an error massage. What I don't understand is that data as data.frame worked well for my other programs, how come I cannot make it run this time. Could you please tell me how I can fix it? ***************************************************************************************************
2012 Nov 15
2
How to modify a S4 function (in the package NADA)
I want to get access to the code of an S4 method in order to possibly modify a function to accomplish my particular needs: in my case the function in is cenfit() from the package NADA Now, given my reproducible example: my.ex<-structure(list(TEC = c(0.21, 0.077, 0.06, 0.033, 0.014, 0.0072), LR = c(0L, 0L, 1L, 0L, 1L, 0L)), .Names = c("TEC", "LR"), class =
2017 Jun 20
2
Problem with shortestPath in igraph and qgraph
hello, I have a graph and i use qgraph package to calculate centrality parameters. Now I want to know the maximum value of shortest path for each vertex with discarding the Inf value in short pathes. For this I use the ShortestPathLengths of centrality function in qgraph. but when I want to get the maximum the result is wrong. here is my code: cen<-centrality(Q)
2012 Sep 20
3
Problem with Newton_Raphson
Hello, I have being trying to estimate the parameters of the?generalized?exponential distribution. The random number generation for the GE distribution is?x<-(-log(1-U^(1/p1))/b), where U stands for uniform dist. The data i have generated to estimate the parameters is right censored and the code is given below; The problem is that, the newton-Raphson approach isnt working and i do not know what
2013 Apr 15
2
regression with paired left-censored data
HI I am trying to analyse data which is left-censored (i.e. has values below the detection limit). I have been using the NADA package of R to derive summary statistics and do some regression. I am now trying to carry out regression on paired data where both my X and Y have left-censored data within them. I have tried various commands in R: rega = cenreg(Cen(conc, cens_ind) ~ Gp_ident))? with
2008 Jun 17
2
R error using Survr function with gcmrec
Would someone be able to help with this question? I'm using the Gcmrec, Survrec, and Design packages to do a power analysis on simulated data. I'm receiving an error after using the Survr function that all data must have a censoring time even after using the gcmrec function: newdata<-addCenTime(olddata). My program is below. I'd greatly appreciate any help!
2004 Sep 13
6
Spare some CPU cycles for testing lme?
If anyone has a few extra CPU cycles to spare, I'd appreciate it if you could verify a problem that I have encountered. Run the code below and tell me if it crashes your R before completion. library(lme4) data(bdf) dump<-sapply( 1:50000, function(i) { fm <- lme(langPOST ~ IQ.ver.cen + avg.IQ.ver.cen, data = bdf, random = ~ IQ.ver.cen | schoolNR); cat("
2017 Jun 21
0
Problem with shortestPath in igraph and qgraph
Hard to follow data analysis without data. Try making your example reproducible [1][2][3] and post in plain text (a setting in your emailer). Read the Posting Guide mentioned in the footer to avoid other posting pitfalls. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example [2] http://adv-r.had.co.nz/Reproducibility.html [3]
2008 Sep 16
1
Car.proper C[] matrix
I am hoping someone can help translate some WinBUGS code into R code. I would like to use R to create the C[] matrix required for a car.proper model in WinBUGS, but I am having a difficult time negotiating the coding. The C matrix provides normalized weights for each pair of spatial areas. So the WinBUGS example is as follows: # of the weight matrix with elements Cij. The first J1 elements
2013 Apr 16
1
Spatial Ananlysis: zero.policy=TRUE doesn't work for no neighbour regions??
Hello, I'm new to R and to Spatial Analysis and got a problem trying to create a Spatial Weights Matrix. *I us the following code to create the Neighbourslist:* >library(maptools) >library(spdep) >library(rgdal) >location_County<- readShapePoly("....") >proj4string(location_County)<- CRS("+proj=longlat ellps=WGS84") >location_nbq<-