Summing over observations in unbalanced panel data
Mostrar comentarios más antiguos
Hello, I have an unbalanced panel data set. For each id, I'd like to sum all values of x up to the latest time I observe that id, and record the summation to a new variable. How can I do this? Ideally, I'd like to avoid looping as I have a large dataset and I try to speed up the process.
Thank you in advance!
Selcen
3 comentarios
the cyclist
el 16 de Ag. de 2024
Can you upload the data, or a small representative sample? You can use the paper clip icon in the INSERT section of the toolbar.
dpb
el 17 de Ag. de 2024
As @the cyclist notes, w/o a sample dataset we're pretty-much without recourse to a direct reponse, but look at rowfun and/or splitapply
Selcen Cakir
el 25 de Sept. de 2024
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!