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
2
votes
1 answer

"sample sizes in the longitudinal and event processes differ" in JointModel in r

I am trying to perform a joint model analysis with simulated data. I believe I have formatted the data properly, but I receive this error: "Error in jointModel(lmeFitJ, coxFit, timeVar = "time.point") : sample sizes in the longitudinal and event…
reedjor
  • 21
  • 1
2
votes
5 answers

Select rows with all longitudinal measurements

I have a longitudinal dataset with ID, Wave (Wave1-4), and Score. Here's sample data with the same structure. The length of the original data is around 2000, with 500 participants total, put in long form. ID Wave Score 1 1001 1 28 2 1001…
Eslie
  • 23
  • 3
2
votes
0 answers

How do I run a mixed-effects logistic longitudinal model in R compliant with SAS?

My question is about running a longitudinal trial with mixed effects and binomial response. I have a repeated-measure trial data to analyze: Patients are subjected to 4 therapies (placebo and 3 devices) - each patient is randomized to a certain…
2
votes
2 answers

Creating a starting value variable with longitudinal data (conditional)

I am trying to create a new variable that is basically the starting value of another variable in my dataframe. Example data: id <- rep(c(1, 2), each = 8) outcome <- rep(1:5, length.out = 16) time <- rep(c(0, 1, 3, 4),4) Attitude <- rep(c('A1', 'A2',…
Anonymous
  • 502
  • 4
  • 23
2
votes
1 answer

Calculate largest value for multiple overlapping events in a specific range

I have multiple large data frames that capture events that last a certain amount of time. This example gives a simplified version of my data set Data frame 1: ID Days Date Value 1 10 80 30 1 10 85 30 2 20 75 …
PCK1992
  • 213
  • 1
  • 14
2
votes
0 answers

R: Bayesian package for nonlinear mixed effects model

I'm looking for a Bayesian parallel for nonlinear mixed effects models, specifically those using the nlme package in R. I've come across blme but that seems to be only for linear mixed-effects models. Would brms be appropriate in this case? I've…
Adrian
  • 9,229
  • 24
  • 74
  • 132
2
votes
2 answers

Converting data to longitudinal data

Hi i am having difficulties trying to convert my data into longitudinal data using the Reshape package. Would be grateful if anyone could help me, thank you! Data is as follows: m <- matrix(sample(c(0, 0:), 100, replace = TRUE),…
Kris.k
  • 23
  • 3
1
vote
0 answers

Cross mixed effects model in R as a Mathematical Formula

Mixed effects models(MEM) can be nested or crossed. For crossed models specifically, how would the below R code look as a mathematical formula in an academic paper? There are multiple random and fixed effects. M1 = lmer(Y ~ A + B + C + D + E + (…
MLux
  • 11
  • 2
1
vote
1 answer

Nested sample design in mgcv syntax

I'm having trouble translating my sample design into the correct mgcv package syntax for random effects. Here is the set-up: we trawl for fish, once per "collection" site, at the same 12 sites per month (hopefully), for 7 consecutive months, every…
Nate
  • 411
  • 2
  • 10
1
vote
1 answer

Collapsing longitudinal data into time periods by identifier with dplyr

I have the following example data where there are daily observations for columns X, Y, Z, and C: structure(list(ID = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), day = c(1, 2, 3, 4,…
Statistix
  • 83
  • 5
1
vote
1 answer

R: How to transform long longitudinal data to wide longitudinal data, when I only have the age (in days) as an indicator of measurement time?

I have a long-formatted set of longitudinal data with two variables that change over time (cognitive_score and motor_score), subject id (labeled subjid) and age of each subject in days at the moment of measurement(labeled agedays). Measurements were…
1
vote
0 answers

How to create a frequency table in R

I have a repeated measures of BMI over 50K people who took BMI measurements on different timepoints. What I want to know is the number of people who took only 1 measurement as well as for only 2 measurements and onwards. How get it in a table with…
Ko Htut
  • 33
  • 4
1
vote
1 answer

Generate a Pandas dataframe for joining longitudinal data

I have disparate longitudinal data. I want to create a "scaffolding" dataframe to join those data to. I have N longitudinal individuals and I know that each timeseries component should be Y periods long, uniform longitudinal segments. I'm trying to…
JPErwin
  • 223
  • 1
  • 10
1
vote
1 answer

Create variable counting unique IDs in long format table

I would like to structure my long format SPSS file so I can clean it and get a better overview. However, I run into some problems. Patients appear several times in the database (Column patientID). How can I make a new variable that contains only 1…
1
vote
1 answer

Collapsing daily longitudinal data into monthly observations by ID in R

I have longitudinal data with >100 rows per subject representing daily observations. I want to collapse columns, by subject ID, into monthly observations (i.e. have multiple rows per ID that are summarizing every 30 rows (days) of data). How can you…
Statistix
  • 83
  • 5
1 2
3
17 18