Questions tagged [longitudinal]

Data from studies or processes with multiple observations over time. Econometrics is a typical topic where such data would be collected and analyzed. Proper analysis will take into account auto-correlation and cross-correlation.

262 questions
11
votes
1 answer

Implementing Longitudinal Random Forest with LongituRF package in R

I have some high dimensional repeated measures data, and i am interested in fitting random forest model to investigate the suitability and predictive utility of such models. Specifically i am trying to implement the methods in the LongituRF package.…
6
votes
2 answers

Clustering longitudinal data with multiple variables in R

I have a dataset that contains the observations of 30 people and each of them had done 20 experiments. Suppose my data looks like this: ID trial reaction response prop_1 prop_2 "s1" 1 2.12 0 0.52 0.48 "s1" 2 …
Mina
  • 327
  • 1
  • 6
4
votes
4 answers

Remove single observations then duplicate remaining observations

For the following data, I'd like to do the following: [1] remove observations with only one repeated measure / observation for that id [2] if the remaining id's have fewer than 5 repeated measures, repeat those observations till there's at least 5…
Vons
  • 3,277
  • 2
  • 16
  • 19
4
votes
3 answers

Reorganize multiple variables based on date variable in R

If I have a dataset that has scores from the same measure collected at different time points, how can I organize those dates/times so they represents a timepoint after a certain date? Is this possible to do in R or would it be easier for me to do…
Karen
  • 43
  • 5
4
votes
0 answers

Dimensionality reduction on repeated measures: PCA? MFA? (FactoMineR)

I have a repeated measures sample, where each participant was asked to complete a sleep survey over the course of 5 years (baseline though year 4 of follow-up). Each survey item is fairly correlated (e.g. when you go to bed correlates with your…
Jess G
  • 188
  • 9
4
votes
2 answers

Within-group operations in R (not rolling sum)

I have a dataset comprised of students (id) and the grade they where in every year: library(data.table) set.seed(1) students <- data.table("id" = rep(1:10, each = 10), "year" = rep(2000:2009, 10), "grade" =…
4
votes
1 answer

why do results of clogit and bife function (both in R) differ?

I like to calculate a logistic fixed effect panel regression (conditional maximum likelihood) in R and get predicted values and/or average marginal effects. I found two functions: bife and clogit from the survival packages Nevertheless, the…
k.r.
  • 41
  • 2
3
votes
1 answer

Regression tree size in the context of state sequence analysis using TraMineR in R

I am conducting a regression tree using state sequence analysis and I want the image output to have the dimensions of a Letter size paper (landscape). When I use the code I include the regression tree appears as a separate window, always of the same…
3
votes
1 answer

R: How to delete ID from a list of multiple strings in a longitudinal format

I had an earlier post regarding how to delete ID if any of the rows within ID contain certain strings (e.g., A or D) from the following data frame in a longitudinal format. These are R code examples that I received from the earlier post (r2evans,…
birch
  • 47
  • 5
3
votes
1 answer

How to calculate nonlinear (binary) Fixed-Effects Logit for Longitudinal/Panel Data?

I'm trying to estimate child work based on a lagged variable on children's school aspirations. I'm deciding whether I should use glm or clogit to run my models (need fixed effect logits). When I run my glm, my coefficients are very different from my…
shaq1993
  • 55
  • 5
3
votes
2 answers

Carry Forward Data for Each Case

In SPSS, how do I pull forward longitudinal data to blank cells for each id? Example: ID Time Gender 1 1 M 1 2 . 1 3 . 2 1 F 2 2 . 2 3 . 3 1 . 3 2 F 3 3 . How do I get to this? ID Time Gender Gender_Recoded 1 …
3
votes
0 answers

How can we show the trajectories belonging to clusters in `kml` package?

The kml package implements k-means for longitudinal data. The clustering works just fine. Now I'm wondering how I can show the 'structure' of the clusters, for example, by coloring them. A most simple example from the docs (help file of the…
symbolrush
  • 7,123
  • 1
  • 39
  • 67
3
votes
2 answers

(Longitudinal data) Create new variable with last value for each ID

I am working with a longitudinal dataset with ID's, timestamps, and values. I would like to create a new variable for each individual that saves the value for the last timestamp for that individual in each of that individual's rows. For example, if…
Jess
  • 33
  • 2
3
votes
0 answers

Fit curve in spaghetti plot

For descriptive plots in R studio, I would like to fit a regression curve in my spaghetti plot. To create the spaghetti plot I used: library(lattice) GCIP <- data_head$GCIP time_since_on <- data_head$time_since_on Patient <-…
Lili
  • 547
  • 6
  • 19
3
votes
1 answer

How to check and control for autocorrelation in a mixed effect model of longitudinal data?

I have behavioral data for many groups of birds over 10 days of observation. I wanted to investigate whether there is a temporal pattern in some behaviors (e.g. does mate competition increase over time?) And I was told that I had to account for the…
Romulo
  • 41
  • 1
  • 2
1
2 3
17 18