similar to: Sorting Panel Data by Time

Displaying 20 results from an estimated 10000 matches similar to: "Sorting Panel Data by Time"

2012 Feb 09
1
Apply pmax to dataframe with different args based on dataframe factor
# I have a dataframe in the following form: track <- c(rep('A', 3), rep('B', 4), rep('C', 4)) value <- c(0.15, 0.25, 0.35, 0.05, 0.99, 0.32, 0.13, 0.80, 0.75, 0.60, 0.44) df <- data.frame(track=factor(track), value=value) #> print(df) #track value #1 A 0.15 #2 A 0.25 #3 A 0.35 #4 B 0.05 #5 B 0.99 #6 B 0.32 #7 B 0.13
2010 Jul 20
2
Problem with command apply
I try to utilize some operations on rows in a matrix using command 'apply' but find a problem. First I write a simple function to normalize a vector (ignore error handling) as follows: normalize = function( v ) { return( ( v-min(v) ) / ( max(v) - min(v) ) ) } The function works fine for a vector: > normalize( 1:5 ) [1] 0.00 0.25 0.50 0.75 1.00 Then I generate a matrix: > a =
2006 Aug 11
1
x tick labels - sparse?
Hi, I'm stuck on creating a plot with x tick labels for every Nth tick mark - how is that done? I don't see a simple solution to this in help(plot) or help(par) and what I've tried is not working, eg, the following does not work, although it seems intuitive to me that it should work: x <- seq(-100,1000,25) y <- x * x % find all the x values that are multiples of 100 tmp <-
2013 Jun 15
2
quick Help needed
Hi, i am new to this forum and not sure how it works, I am trying to do deskriptive descripe my data in terms of gender: head(scltotal) pbnr dat dep dys sop ago mis age female messpunkt2 messpunkt1 tage eintrittsjahr 1 10023 1994-02-21 0.75 1.00 0.50 0.50 0.75 35 1 8817 8817 0 1994 2 10023 1994-05-25 0.75 1.00 0.50 0.50 0.75 35 1 8910 8817
2013 May 27
1
Question about subsetting S4 object in ROCR
Dear list I'm testing a predictor and I produced nice performance plots with ROCR package utilizing the 3 standard command pred <- prediction(predictions, labels) perf <- performance(pred, measure = "tpr", x.measure = "fpr") plot(perf, col=rainbow(10)) The pred object and the perfo object are S4 with the following slots An object of class "performance"
2010 Mar 31
1
Weird R behaviour?
Dear list, I have observed a weird behaviour from R --- apologies if I am missing something obvious! df3f826f28 df3f826f28 Say you type in R: >c.preec <- 10074 >c.gd <- 2200 >p1 <- .2 >c.neo <- p1*9451 + (1-p1)*3883 >n.preec <- 3710 >n.gd <- 2650 >n.neo <- 2120 >n.pcos <- 53000 >unit.met <- 94 >cost.met <- 94*n.pcos >effect <-
2018 Oct 08
4
Texto en el eje de ordenadas de un gráfico
Hola a todos, Estoy usando la librería ltm, de teoría de respuesta al ítem, para crear gráficos. Resulta que añado unas líneas horizontales en los valores de 0.25, 0.50 y 0.75. Me gustaría que en el gráfico, desaparezcan las marcas de 0,.2, 0.4, 0.6 y 0.8 y aparezcan en 0.25, 0.50 y 0.75. He probado varias cosas que he visto por Googe pero no me han funcionado. ¿Alguna idea? library(ltm) # creo el
2004 Sep 14
3
Signs of loadings from princomp on Windows
I start a clean session of R 1.9.1 on Windows and I run the following code: > library(MASS) > data(painters) > pca.painters <- princomp(painters[ ,1:4]) > loadings(pca.painters) Loadings: Comp.1 Comp.2 Comp.3 Comp.4 Composition 0.484 -0.376 0.784 -0.101 Drawing 0.424 0.187 -0.280 -0.841 Colour -0.381 -0.845 -0.211 -0.310 Expression 0.664 -0.330 -0.513
2011 Sep 07
2
ggplot2-Issue placing error bars behind data points
Hi all, This seems like a basic problem, but no amount of playing with the code has solved it. I have a time-series data set like that shown below (only longer) and am seeking to plot the data with filled, circular points and error bars. I would like the error bars to be behind the points otherwise they tend to obscure the points (especially when I have a lot of points in the actual data set).
2011 Mar 24
1
Two matrix loop
Hi, I'm trying to create a distance matrix. And it works out somewhat ok. However, I suspect that there are some efficiency issues with my efforts. Plz have a look at this: donor <- matrix(c(3,1,2,3,3,1,4,3,5,1,3,2), ncol=4) receiver <- matrix(c(1,4,3,2,4,3,1,5,1,3,2,1,4,5,3,5,1,3,2,4,5,1,2,3,1,4,5,5,1,2,1,3,4,3,2,5,5,1,4,2,5,4,3,2), ncol=4) The above creates my two matrices. I have
2013 May 23
1
sample(c(0, 1)...) vs. rbinom
Greetings.? My wife is teaching an introductory stat class at UC Davis.? The class emphasizes the use of simulations, rather than mathematics, to get insight into statistics, and R is the mandated tool.?? A student in the class recently inquired about different approaches to sampling from a binomial distribution.? I've appended some code that exhibits the idea, the gist of which is that using
2018 Oct 09
2
Texto en el eje de ordenadas de un gráfico
Mando este mensaje de respuesta para dar las gracias tanto a Pedro como a Carlos por sus sugerencias. Ahora ya tengo los números que quiero en la gráfica, me falta por quitar los que no quiero. Teniendo en cuenta lo que dice Pedro, voy a preguntar al autor de la librería. saludos, Fernando En martes, 9 de octubre de 2018 13:23:51 CEST, Carlos Ortega <cof en qualityexcellence.es>
2003 Nov 11
1
cor
Greetings: It would seem to me that the three arguments "a", "c" and "p" ought to produce the same result with a data frame that doesn't have any missing data which is not the case. What am I doing wrong or what don't I understand? > tmp <- data.frame(vol,con,mot,esp,pri,sec) > tmp vol con mot esp pri sec 1 1.00 120 90 78 21 1 2 0.50
2011 Nov 14
2
How to compute eigenvectors and eigenvalues?
Hello. Consider the following matrix: mp <- matrix(c(0,1/4,1/4,3/4,0,1/4,1/4,3/4,1/2),3,3,byrow=T) > mp [,1] [,2] [,3] [1,] 0.00 0.25 0.25 [2,] 0.75 0.00 0.25 [3,] 0.25 0.75 0.50 The eigenvectors of the previous matrix are 1, 0.25 and 0.25 and it is not a diagonalizable matrix. When you try to find the eigenvalues and eigenvectors with R, R responses: > eigen(mp) $values [1]
2009 Jul 21
1
problem with heatmap.2 in package gplots generating non-finite breaks
I have written a wrapper for heatmap.2 called heatmap.w.row.and.col.clust which auto-generates breaks using breaks<-round((c(seq(from=(-20 * stddev), to=(20 * stddev))))/20, digits = 2) #(stddev in this case = 2.5) This has always worked well in the past but now I am getting an error that non-finite breaks are being generated. Drilling down, it seems that my wrapper is generating finite
2011 Sep 27
2
Pearson chi-square test
Dear all, I have some trouble understanding the chisq.test function. Take the following example: set.seed(1) A <- cut(runif(100),c(0.0, 0.35, 0.50, 0.65, 1.00), labels=FALSE) B <- cut(runif(100),c(0.0, 0.25, 0.40, 0.75, 1.00), labels=FALSE) C <- cut(runif(100),c(0.0, 0.25, 0.50, 0.80, 1.00), labels=FALSE) x <- table(A,B) y <- table(A,C) When I calculate the test statistic by hand
2009 May 18
2
Superscripts and subscripts in trellis graphics
I'd like to annotate an xyplot with an R^2 value, but can not find the syntax to define the superscript format for the text. I'd appreciate suggestions, xyplot(SharkSloughEggs.df$Sharkeggs.rel + SharkSloughEggs.df$SharkHatched.rel + SharkSloughEggs.df$SharkFlooded.rel + HSI.shark$MEAN ~ Year, pch=c(1,9,5,4), lty=c(1,6,3,4), lwd = c(2), col = c("black",
2010 May 09
1
lattice: customising panel.segments using groups
Hi, I want to customise the segments on an xyplot. Below is a simple example of what I'm trying to do... #Example dataset x <- c(-0.25, 0.25, 0.8) y <- c(-0.5, 0, 0.75) gp <- c("A", "I", "C") my.data <- cbind.data.frame(x,y,gp) #setting up the parameters to customise the lines with. ltype <- c(1,2,3) env.col <-
2002 Dec 31
3
Probit Analysis
Hello all, I have a very simple set of data and I would like to analyze them with probit analysis. The data are: X Event Trial 100 8 8 75 8 8 50 6 8 25 4 8 10 2 8 0 0 8 I want to estimate the value of X that will give a 95% hit rate (Event/Trial) and the corresponding 95% CI. Anyone can offer some help? Thanks!! -
2016 May 25
1
Slow RAID Check/high %iowait during check after updgrade from CentOS 6.5 -> CentOS 7.2
On 2016-05-25 19:13, Kelly Lesperance wrote: > Hdparm didn?t get far: > > [root at r1k1 ~] # hdparm -tT /dev/sda > > /dev/sda: > Timing cached reads: Alarm clock > [root at r1k1 ~] # Hi Kelly, Try running 'iostat -xdmc 1'. Look for a single drive that has substantially greater await than ~10msec. If all the drives except one are taking 6-8msec, but one is very