similar to: debugging a try() statement

Displaying 20 results from an estimated 700 matches similar to: "debugging a try() statement"

2008 Feb 15
2
help on using try() to catch an error
Dear R Users, I have the following glm, which I am running several times in a loop (I am not including the full code): reduced_model <- NULL; full_model <- NULL; reduced_model <- try(glm.fit(X4,n,family=poisson(link="log"))) full_model <- try(glm.fit(X5,n,family=poisson(link="log"))); On some occasions, an error is produced, which is why I have attempted to work
2008 Jan 25
1
increasing speed for permutations of glm
Dear R Programmers, I am trying to run a Poisson regression on all pairs of variables in a data set and obtain the permutation distribution. The number of pairs is around 100000. It seems my code will take weeks to run, unless I try something else. Could you give me any suggestions on how to improve the speed of the code below, or any general suggestions on how I may accomplish this task. Thanks
2010 Sep 22
3
extracting random effects from model formula
Hi R-users I would like to extract the random effects ("1|SITE", "1+SPECIES|SITE" and "BA|SITE") from this model formula: Full_model <- formula (VAR ~ (1|SITE) + (1+SPECIES|SITE) + (BA|SITE) + HEIGHT + COND + NN_DIST) I tried: terms(Full_model) labels(terms(Full_model)) but I could not distinguish between random and fixed effects. thanks
2011 May 08
1
Hosmer-Lemeshow 'goodness of fit'
I'm trying to do a Hosmer-Lemeshow 'goodness of fit' test on my logistic regression model. I found some code here: http://sas-and-r.blogspot.com/2010/09/example-87-hosmer-and-lemeshow-goodness.html The R code is above is a little complicated for me but I'm having trouble with my answer: Hosmer-Lemeshow: p=0.6163585 le Cessie and Houwelingen test (Design library): p=0.2843620
2008 Aug 23
3
graphs for pretest data
Is there an easy way to make graphs for the following data. I have pretest and posttest scores for men and women. I would like to form a 'titlted segment' plot for the data. That is, make segments joining the scores, with different types of segments for men and women. Example data: menpre <- c(43,42,26,39,60,60,46) menpost <- c(40,41,36,42,54,58,43) womenpre <-
2008 Jul 09
3
randomly select duplicated entries
Using this data as an example dat <- read.table(textConnection("Id myvar 12 1 12 2 12 6 34 9 34 4 34 8 65 15 65 23"), header = TRUE) closeAllConnections() how can I create another data set that does not have duplicate entries for 'Id', but the included values are randomly selected from the available ones. Thanks! Juliet
2009 Mar 07
6
using a noisy variable in regression (not an R question)
Hi, This is not an R question, but I've seen opinions given on non R topics, so I wanted to give it a try. :) How would one treat a variable that was measured once, but is known to fluctuate a lot? For example, I want to include a hormone in my regression as an explanatory variable. However, this hormone varies in its levels throughout a day. Nevertheless, its levels differ substantially
2010 Jul 15
2
replace negative numbers by smallest positive value in matrix
Hi Group, I have a matrix, and I would like to replace numbers less than 0 by the smallest minimum number. Below is an small matrix, and the loop I used. I would like to get suggestions on the "R way" to do this. Thanks, Juliet # example data set mymat <- structure(c(-0.503183609420937, 0.179063475173256, 0.130473004669938, -1.80825226960127, -0.794910626384209, 1.03857280868547,
2009 Mar 02
3
ways to put multiple graphs on single page (using ggplot2)
Hi, Here are three plots: library(ggplot2) data(diamonds) randind <- sample(nrow(diamonds),1000,replace=FALSE) dsmall <- diamonds[randind,] qplot(carat, data=dsmall, geom="histogram",binwidth=1) qplot(carat, data=dsmall, geom="histogram",binwidth=.1) qplot(carat, data=dsmall, geom="histogram",binwidth=.01) What are ways to put these three plots on a single
2012 Mar 21
2
glmnet: obtain predictions using predict and also by extracting coefficients
All, For my understanding, I wanted to see if I can get glmnet predictions using both the predict function and also by multiplying coefficients by the variable matrix. This is not worked out. Could anyone suggest where I am going wrong? I understand that I may not have the mean/intercept correct, but the scaling is also off, which suggests a bigger mistake. Thanks for your help. Juliet Hannah
2008 Sep 22
2
adding layers in ggplot2 (data and code included)
Here is some sample data: mydata <- read.table(textConnection("Est Group Tri 0 0 4.639644 1 0 4.579189 2 0 4.590714 0 1 4.443696 1 1 4.588243 2 1 4.650505 0 2 4.296608 1 2 4.826036 2 2 4.765386"),header=TRUE); closeAllConnections(); I can form two plots,
2009 Apr 20
3
what is R best for; what should one learn in addition to R
Hi, I've been working with R for a couple of years, and I've been able to get most of the things done that I needed (sometimes in a roundabout way). A few experienced statisticians told me that R is best for interactive data analysis, but for large-scale computations, one needs something else. I understand that this all depends on what you are trying to accomplish, and R offers many ways
2009 Jan 24
2
how to prevent duplications of data within a loop
Hi All, I had posted a question on a similar topic, but I think it was not focused. I am posting a modification that I think better accomplishes this. I hope this is ok, and I apologize if it is not. :) I am looping through variables and running several regressions. I have reason to believe that the data is being duplicated because I have been monitoring the memory use on unix. How can I avoid
2008 Nov 19
2
ggplot2; dot plot, jitter, and error bars
With this data x <- c(0,0,1,1,2,2) y <- c(5,6,4,3,2,6) lwr <- y-1 upr <- y+1 xlab <- c("Low","Low","Med","Med","High","High") mydata <- data.frame(x,xlab,y,lwr,upr) I would like to make a dot plot and use lwr and upr as error bars. Above 0=Low. I would like there to be some space between the 5 and the 6 corresponding
2007 Sep 24
2
Getting host IP address?
Hi, I''m gradually moving my site''s config over to Puppet (still in the testing phases at the moment!). Is there any way of getting/referring to a host''s IP address? I want to set up iptables via Puppet, & can use a template but need to get the IP address into the template somehow. I''m getting my node definitions (& thus classes) from LDAP. I
2007 Nov 13
6
Facter and arrays
Hi, Is it possible to have an array as the output of a custom fact? And then to pass it into a template in Puppet? I currently have a fact that looks like this: Facter.add("exports") do setcode do case Facter.hostname when (/thishost/i): [ "/local", "/local2" ] end end end & a template like this: <%
2009 Feb 08
2
how to make this qq plot in lattice and/or ggplot2
Hi Group, Here is some data. p <- runif(1000) # sample data groups <- rep(c(1,2),each=500) #conditioning variable mydata <- cbind(p,groups) n <- length(p) u <- (1:n)/(n + 1) # uniform distribution reference for qqplot logp <- -log(p,base=10) logu <- -log(u,base=10) qqplot(logp,logu) How can I make the above qqplot in lattice and/or ggplot2. The sample is uniform, and I take
2010 Jan 30
2
convert data frame of values into correlation matrix
Hi Group, Consider a data frame like this: mylabel1 <- rep(c("A","B","C"),each=3) mylabel2 <- rep(c("A","B","C"),3) corrs <- c(1,.8,.7,.8,1,.7,.7,.7,1) myData <- data.frame(mylabel1,mylabel2,corrs) myData mylabel1 mylabel2 corrs 1 A A 1.0 2 A B 0.8 3 A C 0.7 4 B
2011 Aug 11
3
improve formatting of HTML table
I am trying to improve the look of an HTML table for a report (that needs to be pasted into Word). Here is an example. table2 <- structure(c(26L, 0L, 40L, 0L, 10L, 0L, 0L, 188L, 0L, 281L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 4L), .Dim = c(6L, 3L), .Dimnames = structure(list( myvar = c("Don't know", "Somewhat likely", "Somewhat unlikely", "Very
2007 Oct 09
2
Failure to find definition
Hi, I''m trying to set up apache2 under puppet, as in this recipe: http://reductivelabs.com/trac/puppet/wiki/Recipes/DebianApache2Recipe I have a file "apache2.pp" as shown there, and then a webserver.pp file (see below). On running puppetd on the client, I get this message: err: Could not retrieve configuration: Could not find definition site in file