similar to: Generating a count variable

Displaying 20 results from an estimated 10000 matches similar to: "Generating a count variable"

2009 Jan 28
2
Dynamic random effects model
All R experts, How do I fit a dynamic Random effects model with a binary dependent variable in R Thanks JCM [[alternative HTML version deleted]]
2009 Feb 06
1
glm package
Hi all, can the glm package be used to estimate a logit model to panel data? I am asking this because stata has a standard logit model and then an xtlogit for longitudinal data. Is there something similar in R? Thank you jcm [[alternative HTML version deleted]]
2008 Nov 21
2
log likelihood
Hi all, I ran a Weibull model, and I am wondering if there is any way to extract the log likelihood. I tried loglik(model) but it does not seem to work any help would be greatly appreciated joe [[alternative HTML version deleted]]
2009 Apr 29
1
arma model with garch errors
Dear R experts, I am trying to estimate an ARMA 2,2 model with garch errors. I used the following code on R 2.9. #library library(fGarch) #data data1<-ts(read.table("C:/Users/falcon/Desktop/Time Series/exports/goods1.csv"), start=c(1992,1), frequency=12) head(data1) #garch garchFit(formula.mean= ~arma(2,2),formula.var=~garch(1,1), data=data1) but get this error: >
2009 Nov 24
1
reshaping data
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091125/5ce76d9b/attachment-0001.pl>
2010 Nov 11
1
Count continuous dates
Dear List, I have a series of dates and I am needing to know the greatest length of continuous dates - i.e. the number of dates before a break in the series.? For example, below there are three continuous series of dates with lengths 4, 6, and 8.? How can I count the number of continuous dates?? rle() will do it for constant integers, but I can't figure a way to modify it for continuous
2012 Oct 16
5
uniq -c
I need an analogue of "uniq -c" for a data frame. xtabs(), although dog slow, would have footed the bill nicely: --8<---------------cut here---------------start------------->8--- > x <- data.frame(a=1:32,b=1:32,c=1:32,d=1:32,e=1:32) > system.time(subset(as.data.frame(xtabs( ~. , x )), Freq != 0 )) user system elapsed 12.788 4.288 17.224 --8<---------------cut
2011 Nov 02
3
how to count number of occurrences
Dear R users, I have this data frame, y samp 8 0.03060419 X 18 0.06120838 Y 10 0.23588374 X 3 0.32809965 X 1 0.36007100 X 7 0.36730571 X 20 0.47176748 Y 13 0.65619929 Y 11 0.72014201 Y 17 0.73461142 Y 6 0.76221313 X 2 0.77005691 X 4 0.92477243 X 9 0.93837591 X 5 0.98883581 X 16 1.52442626 Y 12 1.54011381 Y 14 1.84954487 Y
2007 Feb 15
3
count sequence of integers
Hi, I would like to be able to count a sequence of numbers. For example, given a vector of the following integers (1,1,1,2,2,2,2,3,3,3,3,3,3,1,1,1,1, 3,3) the function would return (3, 4, 6, 4,2) Does anyone have any cool ideas to solve this? Any help appreciated. Regards, Sam. [[alternative HTML version deleted]]
2004 May 10
1
Explaining Survival difference between Stata and R
Dear Everybody: I'm doing my usual "how does that work in R" thing with some Stata projects. I find a gross gap between the Stata and R in Cox PH models, and I hope you can give me some pointers about what goes wrong. I'm getting signals from R/Survival that the model just can't be estimated, but Stata spits out numbers just fine. I wonder if I should specify initial
2008 Oct 24
1
count zero or one in a list
I have a list of {0,1} values, say y<-c(0,0,0,1,1,0,0,1,0,1,1,1,1) I want to compute the first few zeros and the last few ones. So the output I expect is 3 and 4 for this vector. Is there a fast way to match the numbers easily? [[alternative HTML version deleted]]
2011 Jun 07
1
count length of continues elements in a vector
I am performing a precipitation analysis. data is in the form of daily precipitation amounts, e.g. x<- c(4,5,3,0,0,0,2,4,6,4,0,0,0,2,2,0,3,4,1,0,...) I would like to find the length of the "storm", length of storm would be defined as the number of days with continues precipitation. in this case the returned vector would be: (3,4,2,3,...) I would also like the amount of
2010 Oct 28
2
Determining a basal correct count
Here's another interesting problem: if you recall I have a data frame (LCvars1) that consists of about 1500 cases (rows) of data from kids who took a test of listening comprehension. The columns are their scores (1 = correct, 0 = incorrect, . = missing) on 140 test items. The items are numbered sequentially and are ordered by increasing difficulty as you go from left to right across the
2010 Jan 22
2
Stata and R user GLM method
Hello people, I am in the process of migrating from Stata to R and I would like to check if my results are similar under the two softwares: Here is my GLM command under R nurse.model<-glm(pQSfteHT~dQSvacrateHTQuali3_2 + dQSvacrateHTQuali3_3 + dQSvacrateHTQuali3_4 + dQSvacrateHTQuali3_5 + cluster_32 + cluster_33 + cluster_34 ,family=binomial(link = "logit")) and below the stata
2015 Jan 18
2
NHW Image codec
Hello, Ok, and that's too many work to review a source code.In my codec, I have 3 compression schemes, I think 2 are not patented, but the third... I don't know.For the rest, I think my codec is patent-free (I don't use SPIHT,EZW,zerotree methods), even the wavelet transform is new and don't use the lifting scheme nor the convolution product. Else, if you found time to review the
2007 Nov 15
2
counting strings of identical values in a matrix
Hello I have this problem. I have a large matrix of this sort: > prova [,1] [,2] [,3] [,4] [1,] 3 3 3 3 [2,] 3 3 3 1 [3,] 1 3 3 3 [4,] 1 1 1 3 [5,] 3 1 1 3 [6,] 3 1 1 3 [7,] 1 3 1 3 [8,] 1 3 3 3 What I want to do is to count the number of sequences of ones and stack the results in a
2009 Feb 04
7
counting entries in vector
Hi all, I've a vector with entries, which are all of the same type, e.g. string: k <- c("bb", "bb", "bb", "aa", "cc", "cc") and want to create a second vector containing the number of each entry in k in the same order as in k, i.e. c(3, 1, 2) or: k <- c(5,5,5,5,2,2,4) => c(4,2,1) thanks
2005 Jun 24
1
r programming help II
Dear List, Suppose we have a variable K.JUN defined as (with 1=wet, 0=dry): K.JUN1984 = c(1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) K.JUN1985 = c(0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1) K.JUN1986 = c(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1)
2010 May 26
3
Counting indexes
Hallo! I have a vector of ID's like so, id <- c(1,2,2,3,3,3,4,5,5) I would like to create a [start,stop] pair of vectors that index the first and last observation per ID. For the ID list above, it would look like 1 1 2 3 4 6 7 7 8 9 I haven't worked with indexes/data manipulation much in R, so any pointers would be helpful. Many thanks! ~~~~~~~~~~~~~~~~~~~ -Robin Jeffries Dr.P.H.
2012 Oct 16
2
cannot coerce class '"rle"' into a data.frame
why? > rle Run Length Encoding lengths: int [1:1650061] 2 2 8 2 4 5 6 3 26 46 ... values : chr [1:1650061] "4bbf9e94cbceb70c BG bg" "4fbbf2c67e0fb867 SK sk" ... > as.data.frame(rle) Error in as.data.frame.default(vertices.rle) : cannot coerce class '"rle"' into a data.frame it seems that rle.df <-