similar to: problem in loop

Displaying 20 results from an estimated 500 matches similar to: "problem in loop"

2009 Nov 26
1
different fits for geese and geeglm in geepack?
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091126/7134fc17/attachment-0001.pl>
2010 Oct 07
3
quantile regression
Dear all, I am a new user in r and I am facing some problems with the quantile regression specification. I have two matrix (mresultb and mresultx) with nrow=1000 and ncol=nsim, where I specify (let's say) nsim=10. Hence, the columns in my matrix represents each simulation of a determined variable. I need to regress each column of mresultb on mresultx. My codes are the following:
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 <-
2007 Oct 11
3
reason for error in small function?
Running the function below, tested using the cardiff dataset from splancs generates the following error. What changes do I need to make to get the function to work? Thanks. --Dale > gen.rpoints(events, poly, 99) > rpoints Error: object "rpoints" not found # test spatial data library(splancs) data(cardiff) attach(cardiff) str(cardiff) events <- as.points(x,y) ###
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
2008 Oct 29
2
call works with gee and yags, but not geepack
I have included data at the bottom of this email. It can be read in by highlighting the data and then using this command: dat <- read.table("clipboard", header = TRUE,sep="\t") I can obtain solutions with both of these: library(gee) fit.gee<-gee(score ~ chem + time, id=id, family=gaussian,corstr="exchangeable",data=dat) and library(yags) fit.yags <-
2008 Mar 05
1
problem with geepack
Hi all I am analyzing a data set containing information about the behaviour of marine molluscs on a vertical wall. Since I have replicate observations on the same individuals I was thinking to use the geepack library. The data are organised in a dataframe with the following variables Date = date of sampling, Size = dimensions (mm) Activity duration of activity (min) Water = duration of
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]<-
2013 Apr 07
1
confidence interval calculation for gee
Hello, I have the following r-codes for solving a quasilikelihood estimating equation: >library(geepack) >fit<-geese(y~x1+x2+x3,jack=TRUE,id=id,scale.fix=TRUE,data=dat,mean.link = "logit", corstr="independence") Now my question is how can I calculate the confidence interval of the parameters of the above model "fit"? [[alternative HTML version deleted]]
2003 Oct 24
1
gee and geepack: different results?
Hi, I downloaded both gee and geepack, and I am trying to understand the differences between the two libraries. I used the same data and estimated the same model, with a correlation structure autoregressive of order 1. Surprisingly for me, I found very different results. Coefficients are slightly different in value but sometimes opposite in sign. Moreover, the estimate of rho (correlation
2006 Feb 06
3
power and sample size for a GLM with poisson response variable
Hi all, I would like to estimate power and necessary sample size for a GLM with a response variable that has a poisson distribution. Do you have any suggestions for how I can do this in R? Thank you for your help. Sincerely, Craig -- Craig A. Faulhaber Department of Forest, Range, and Wildlife Sciences Utah State University 5230 Old Main Hill Logan, UT 84322 (435)797-3892
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)
2012 Nov 23
1
Spatstat: Mark correlation function
I normally use the following code to create a figure displaying the mark correlation function for the point pattern process "A": M<-markcorr(A) plot(M) I have now started to use the following code to perform 1000 Monte Carlo simulations of Complete Spatial Randomness (CSR). It is a Monte Carlo test based on envelopes of the Mark correlation function obtained from simulated point
2007 Oct 03
2
Speeding up simulation of mean nearest neighbor distances
I've written the function below to simulate the mean 1st through nth nearest neighbor distances for a random spatial pattern using the functions nndist() and runifpoint() from spatsat. It works, but runs relatively slowly - would appreciate suggestions on how to speed up this function. Thanks. --Dale library(spatstat) sim.nth.mdist <- function(nth,nsim) { D <- matrix(ncol=nth,
2006 Mar 08
1
power and sample size for a GLM with Poisson response variable
Craig, Thanks for your follow-up note on using the asypow package. My problem was not only constructing the "constraints" vector but, for my particular situation (Poisson regression, two groups, sample sizes of (1081,3180), I get very different results using asypow package compared to my other (home grown) approaches. library(asypow) pois.mean<-c(0.0065,0.0003) info.pois <-
2007 Dec 04
1
Metropolis-Hastings within Gibbs coding error
Dear list, After running for a while, it crashes and gives the following error message: can anybody suggest how to deal with this? Error in if (ratio0[i] < log(runif(1))) { : missing value where TRUE/FALSE needed ################### original program ######## p2 <- function (Nsim=1000){ x<- c(0.301,0,-0.301,-0.602,-0.903,-1.208, -1.309,-1.807,-2.108,-2.71) # logdose
2013 Jan 06
4
random effects model
Hi A.K Regarding my question on comparing normal/ obese/overweight with blood pressure change, I did finally as per the first suggestion of stacking the data and creating a normal category . This only gives me a obese not obese 14, but when I did with the wide format hoping to get a obese14,normal14,overweight 14 Vs hibp 21, i could not complete any of the models. This time I classified obese=1
2011 Apr 07
2
Two functions as parametrs of a function.
Hi R users: I'm trying to make a function where two of the parameters are functions, but I don't know how to put each set of parameters for each function. What am I missing? I try this code: f2<-function(n=2,nsim=100,fun1=rnorm,par1=list(),fun2=rnorm,par2=list()){ force(fun1) force(fun2) force(n) p1<-unlist(par1) p2<-unlist(par2) force(p1) force(p2)
2012 Feb 18
3
foreach %do% and %dopar%
Hi everyone, I'm working on a script trying to use foreach %dopar% but without success, so I manage to run the code with foreach %do% and looks like this: The code is part of a MCMC model for projects valuation, returning the most important results (VPN, TIR, EVA, etc.) of the simulation. foreach (simx = NsimT, .combine=cbind, .inorder=FALSE, .verbose=TRUE) %do% { MCPVMPA = MCVAMPA[simx]