similar to: Another simple q - removing negative values

Displaying 20 results from an estimated 20000 matches similar to: "Another simple q - removing negative values"

2005 Jul 08
2
Plotting a simple subset
Hi all Just converting from Stata to R and struggling a little to come to terms with the new philosophy/command line. E.g. I want to plot x against y if x < 5 In Stata: graph x y, if( x < 5 ) How do I do this in R? Have tried most of the obvious options without success. Can I have multiple subsets? I.e. In Stata: if( x < 5 && y > 3 ) TIA Michael
2007 Mar 01
2
Another newbie book recommandation question
I hope this question is sufficiently different from the other requests for book recommendations that it's not repetitious. If not, I apologize in advance. I'm curious what standard reference books working statisticians, or biostatisticians, have within easy reach of their desk. I'm a computer systems administrator, and have a two-foot bookshelf directory under my monitor that contains
2005 Apr 18
1
Storing vectors as vectors and iterating through them
Hi all, I have a bunch of int vectors. Each vector holds a bunch of ints that correspond to row numbers of an existing matrix. I use the int vectors to pull out rows of data from a matrix, i.e. data <- my_matrix[int_vector,] I would like to store these int vectors in some sort of data structure that will preserve them as-is and allow iteration. I guess what I'm looking for would be
2006 Dec 05
2
intro + specification remarks + some questions
hi everyone, since about 10 days I've been working on an implementation of ogg vorbis *decoder* from scratch, and I've got a few constructive remarks about the specs and some questions. -------------------------- First a question: > 9.2.4. low_neighbor > > "low_neighbor(v,x)" finds the position n in vector [v] of the greatest > value scalar element for which
2006 Mar 24
2
How to avoid for or while loops when one index depends on another
Dear R Community, I'm trying to exploit the elegance of R by doing the following pseudocode routine without a WHILE or FOR loop in R: for i = 1 to length-1 for j = (i+1) to length print a[i], a[j] That is, I want i and j to be the indices of a half-matrix 1 2, 1 3, 1 4, ..., 1 length, 2 3, 2 4, ..., 2 length, 3 4, ..., 3 length 1. Can this be done with the 'whole
2009 May 04
1
Nelson-Aalen estimator of cumulative hazard
Hi, I am computing the Nelson-Aalen (NA) estimate of baseline cumulative hazard in two different ways using the "survival" package. I am expecting that they should be identical. However, they are not. Their difference is a monotonically increasing with time. This difference is probably not large to make any impact in the application, but is annoyingly non-trivial for me to just
2008 May 14
1
Negative Binomial Model
Hello, I am trying to run a negative binomial regression model in R and can't get the standard errors to match the output I get from the Stata nbreg command. I've tried a few different options but haven't had much luck. The closest I've found is: gamlss(formula, family = NBI, sigma.formula = ~ 1,data=dataframe) ...But this is still a little off most of the time and pretty far
2003 Dec 04
2
Comparing Negative Binomial Regression in Stata and R. Constants differ?
I looked for examples of count data that might interest the students and found this project about dropout rates in Los Angeles High Schools. It is discussed in the UCLA stats help pages for the Stata users: http://www.ats.ucla.edu/stat/stata/library/count.htm and See: http://www.ats.ucla.edu/stat/stata/library/longutil.htm To replicate those results, I used R's excellent foreign package to
2010 Jul 15
1
Longitudinal negative binomial regression - robust sandwich estimator standard errors
Hi All, I have a dataset, longitudinal in nature, each row is a 'visit' to a clinic, which has numerous data fields and a count variable for the number of 'events' that occurred since the previous visit. ~50k rows, ~2k unique subjects so ~25 rows/visits per subject, some have 50 some have 3 or 4. In STATA there is an adjustment for the fact that you have multiple rows per
2012 Jul 16
4
Error in as.xts
Hi I got the following error using as.xts Error in xts(x, order.by = order.by, frequency = frequency, ...) : NROW(x) must match length(order.by) Here is how the data looks like > d1 <- read.csv(file.path(dataDir,"AppendixA-FishCountsTable-2009.csv"), as.is=T) > d1[1:3,] dive_id date time species count size site depth level TRANSECT VIS_M 1 62 10/12/2009
2007 Aug 22
1
C code generators
Dear R-helpers Are there any established R packages that include a C code generator -- that generates new C language files and compiles them? To be precise what I'm looking for is a process that takes text input in some format (it might be pseudocode, fragments of C code, etc) and creates a valid C language source file that can be compiled by R CMD COMPILE. Ideally the procedure should also
2002 May 16
1
foreign library - negative integers??
I am having a problem with the foreign library correctly reading some integer data. Specifically, d _ read.dta('aptaa.dta') > d[1:5,] scenario metcode yr ginv cons gocc abs dvac gmre gmer 1 1 AA 2002 0.007 1377 -0.071 51710 0.071 -0.011 -0.127 2 1 AA 2003 0.000 0 -0.016 62568 0.014 -0.043 -0.538 3 1 AA 2004 0.000 0 -0.002
2003 Mar 27
4
Multinomial logistic regression under R and Stata
Dear Colleagues I have been fitting some multinomial logistic regression models using R (version 1.6.1 on a linux box) and Stata 7. Although the vast majority of the parameter estimates and standard errors I get from R are the same as those from Stata (given rounding errors and so on), there are a few estimates for the same model which are quite different. I would be most grateful if
2005 Mar 12
1
generalized negative binomial
I am looking for code that allows for a more flexible negative binomial model (similar to Stata's "gnbreg"). In particular, I am looking to be able to model the ancillary shape parameter in terms of a series of covariates. So if, y[i] ~ poisson(mu[i]) mu[i] = exp(x[i]beta + u[i]) exp(u[i]) ~ Gamma(1/alpha, alpha) I am looking to parameterize alpha as exp(z[i]gamma). If you
2004 May 26
2
Subtracting number of days from a date
Hi group, suppose I have a date, say May 15 2004, and I want to now what date it is 23 days before that date. The way to calculate the new date should (...) take account of leap years :) In pseudocode: olddate <- "May 15 2004" newdate <- olddate-23 I looked around in POSIXct etc..., maybe I overlooked? Thanks, Maarten
2008 Feb 19
2
Looping through a list of objects & do something...
Hey Folks, Could somebody show me how to loop through a list of dataframes? I want to be able to generically access their elements and do something with them. For instance, instead of this: df1<- data.frame(x=(1:5),y=(1:5)); df2<- data.frame(x=(1:5),y=(1:5)); df3<- data.frame(x=(1:5),y=(1:5)); plot(df1$x,df1$y); plot(df2$x,df2$y); plot(df3$x,df3$y); I would like to do something like:
2010 Mar 02
4
two questions for R beginner
>>> What were your biggest misconceptions or >>> stumbling blocks to getting up and running >>> with R? Easy. I terms of materials I have been unable to find good books that introduce users to R from the perspective of someone familiar only with packages like SPSS or STATA, or not familiar with statistics packages at all. Even introduction texts use jargon
2007 Jan 06
2
negative binomial family glm R and STATA
Dear Lister, I am facing a strange problem fitting a GLM of the negative binomial family. Actually, I tried to estimate theta (the scale parameter) through glm.nb from MASS and could get convergence only relaxing the convergence tolerance to 1e-3. With warning messages: glm1<-glm.nb(nbcas~.,data=zonesdb4,control=glm.control(epsilon = 1e-3)) There were 25 warnings (use warnings() to see
2005 Apr 20
3
Keeping factors with zero occurrences in "table" output
Dear R group, I have a data frame which contains data on preferences on 7 items (ranks 1 through 7) listed by each participant. I would like to tabulate this in a 7x7 table where the rows would be the items and the columns would be the number of times that item received a particular rank. I tried doing this by creating a matrix by "rbind"ing each vector obtained using
2012 Apr 03
2
Looking for the name of a certain kind of quantile plot
Hi, While playing with quantile-quantile plots, I wrote up some code which plots something strangely different. Here's the pseudocode: testhist <- hist(sample_data) refhist <- hist(rnorm(n, mean=0,sd=1)) # for some large-ish n cumtest <- cumsum(testhist) cumref <- cumsum(refhist) plot(cumref,cumtest) This produces a straight line of slope 1 for a sample with the same