279 questions
0
votes
0
answers
24
views
LMest - Reference of the multilogit - how to know the significance [migrated]
We run latent transition analysis with covariates using LMest and with the help of the available Literature (e.g., Bartolucci et al., 2017) and what we found on the web, we were also able to interpret ...
0
votes
1
answer
100
views
Imputing date in time series dataframe
I have a dataframe in R with several ID, DAY and TIME and amount of a compound (AMT). Typically, for every ID, there should two records at every day, indicating two doses a day, typically in the ...
2
votes
1
answer
68
views
Repeat first row per group id for time-varying variables in R data frame
A grouped/longitudinal data frame takes the form
id <- c(1,1,2,2,2,3,3,3)
x <- c(0,0,1,1,1,1,1,1)
t1 <- c(1,0,1,1,0,0,1,0)
t2 <- c(2.1,1.5,1.7,2.0,2.0,2.8,2.1,2.1)
t3 <- c(21,18,23,26,...
3
votes
1
answer
503
views
Linear Mixed Effect Model in R will not converge
I have a long format dataset for data on about 70K individuals. The data is tracking a continuous follow-up measure at 3, 6, and 12 months past baseline (a +/- 1 month buffer was given for each time ...
0
votes
0
answers
55
views
count continuous enrollment in claims data
I need to count number of patients with continuous enrollment after indexdt by month in claims data in SAS.
Below is my data structure.
startdt is the starting date of insurance coverage and
enddt is ...
1
vote
2
answers
152
views
Clustering longitudinal data with labels?
I have longitudinal data as follows:
import pandas as pd
# Define the updated data with samples only in 'sample_A' or 'sample_B'
data = {
'gene_id': ['gene_1', 'gene_1', 'gene_1', 'gene_1', '...
0
votes
1
answer
100
views
Microsoft SQL join on longitudinal data
In Microsoft SQL Server, I have one table (live table) that takes snapshot of student enrollment information on a daily basis such that one students can take multiple rows by date. In this table, we ...
0
votes
1
answer
62
views
How to remove non-significant higher order terms from latent class growth models in lcmm/hlme?
I am running a latent class growth model using hlme from the lcmm package in R. See code below:
gridsearch(rep = 100, maxiter = 10, minit = lcga1_c,
m=hlme(cHairCortisolConclog~Visit+I(Visit^2)+I(...
0
votes
1
answer
47
views
In a longitudinal dataset, how to create a status variable 0/1 depending on a second, diagnostic variable that varies with time
I work on sexually transmitted diseases, such as gonorrhoea, and their possible consequences, such as ectopic pregnancy in women. My dataset (df_gono) contains longitudinal epidemiological data by ...
1
vote
2
answers
80
views
In a long table for a longitudinal study, how to loop efficiently across a large number of individuals?
I work on sexually transmitted diseases, such as gonorrhoea, and their possible consequences, such as ectopic pregnancy in women. I have a first dataset (df_gono) that contains whether and how many ...
1
vote
3
answers
63
views
Drop rows based on conditions (longitudinal dataset)
I have a dataset with the following structure:
ID
drug
drug sequence
drup type
A
X
1
AB
A
X
1
AB
A
Y
2
CD
A
Z
3
CD
A
V
4
EF
A
V
4
EF
B
W
1
GH
B
W
1
GH
B
W
2
GH
C
Z
1
CD
C
V
2
EF
C
V
2
EF
I want to ...
0
votes
0
answers
137
views
Using GEE with "geepack" for survey data that includes time-fixed covariates
I want to use Generalized Estimating Equations (GEE) to model longitudinal survey data. Participants' responses were recorded at three timepoints, and I have multiple independent variables (which are ...
0
votes
1
answer
42
views
Merging data to create a longitudinal dataframe in R
I have dataframe, df_master, which is comprised of longitudinal data for multiple patients ("record_id") where each row represents a day of follow-up ("time").
A second data frame ...
0
votes
0
answers
56
views
How do I perform an ordered logistic regression with the R lme package?
I have longitudinal ordinal data and survival data. I want to do a joint model. I am familiar with the JM package, which uses lme for the longitudinal model. I theoretically understand that you can ...
0
votes
1
answer
232
views
lme4 convergence warning and rescaling in longitudinal data analysis
I have a longitudinal data with ~2400 participants and ~15000 observations. When fitting the mixed effects model using lmer() with a random slope of time, I received a warning:
optimizer (nloptwrap) ...
0
votes
0
answers
21
views
Difference between DSEM and Latent Trajectory with Structured Residuals
I am having a find time understanding the difference between Dynamic Structural Equation Modelling (Asparouhov et al., 2018) and Latent Trajectory with Structured Residuals (Curran et al., 2014). I am ...
1
vote
1
answer
124
views
estimating percent trend of category variable per year in Stata
I am trying to graph a trend line of categorical variable by gender in Stata. It would be like a percentage trend of each value of this categorical variable (level 1, 2, and 3) by gender and I can't ...
0
votes
1
answer
38
views
MicrobiomeTest::generate_alpha_trend_test_long() not recognising rownames and columns
Good morning everyone,
I am trying to use MicrobiomeTest to perform a longitudinal analysis on a microbial community. It worked all fine at the beginning, but after I used a different dataset, the ...
0
votes
1
answer
323
views
Goodness of fit in Hidden Markov models (Latent Transition Analysis) using LMest, assessing covariate effects
I am a student trying to do Latent Transition Analysis/Hidden Markov for the first time for my thesis using LMest in R. I am analyzing various behaviors (binary variables) measured during two time ...
0
votes
0
answers
479
views
lcmm() in R Error: Numerical problem by computing fn value of function is : NaN
My data frame filtered_gmmdf_long (long format) has no NA. It contains the variables ID, time (i.e. 0, 3, 8, 15, 25), and wblv (continuous, approximately Normal distributed).
Sample data
library(dplyr)...
0
votes
0
answers
45
views
I need help in estimates lme models
I'm analyzing two models of class LME for longitudinal data (observations in two times), but
this message appears Error in lme.formula(y ~ x, random = ~1 | id, data = data_long) : nlminb problem, ...
0
votes
0
answers
188
views
Predicting outside of follow-up time with JMBayes2
I am trying to work with the JMBayes2 package to simulate outcomes outside of my datarange for a problem where I have a longitudinal outcome which forms a proxy for cognitive functioning and a binary ...
1
vote
0
answers
250
views
REDCap Longitudinal Survey Not Displaying Correctly via Email
I have a REDCap project intended to do the following tasks:
Allow an individual to register for an event.
Allow a registered individual to cancel their registration if necessary.
Capture contact ...
0
votes
1
answer
54
views
R - how to find out people whose event 1 disappeared after event 2 happened
I have a dataset in which each person has multiple visits and Event1 and Event2 were documented at each visit (1=yes, 0=no). Not everyone has Event1 or Event2 happened. How do I pick out people whose ...
1
vote
2
answers
45
views
Transposing repeated measures data - can't create time variable correctly
I have data with ID, repeated cognitive measure (cog1-cog6), and medication (SSRI) at start. I will eventually run the mixed procedure to determine the association between cognitive score at the time ...
1
vote
1
answer
92
views
R - How to show multiple lines with different x-axis values (dates) in ggplot2?
I have done a longitudinal study on children's letter knowledge development.
In this study, 120 children were given a letter knowledge task, at three different time points.
The first five rows of df
&...
1
vote
1
answer
3k
views
Group based trajectory modeling in R
I have a dataset consisting of 3 variables one ID, on variable Y, and time variable t.
It is in long form with each subject having several rows of registrations with the ordinal variable Y (1-5) and ...
0
votes
0
answers
79
views
Using ggplot to reflect uneven spacing between time points
I am plotting for longitudinal trjaectories, which are latent trajectories from the results of Growth Mixture modelling. My data were collected at uneven distributed time points, say age 13,15,17,21,...
0
votes
1
answer
124
views
How do I get a count of participants with at least one observation at time point A and one observation at a later point on a different variable? - R
I want to create an overview for a longitudinal analysis for which I require all participants from my data, which have valid responses on Variable X at any point and a valid response on variable Y at ...
1
vote
0
answers
368
views
Assessing variable importance of REEMforest and MERF using the "iml" package
I recently started working with the LongituRF package.
I'm fitting it to some data, and I'd like to assess the variable importance using the iml package.
I have already used iml, and I like its ...
0
votes
1
answer
93
views
Exploring data coverage for different time point ranges in longitudinal (weekly) data
This is a very basic question and maybe more about data wrangling than coding, sorry.
I have a dataset in which 1520 participants were measured once a week for 12 weeks. However, there are a lot of ...
0
votes
1
answer
31
views
Filtering longitudinal data by last recorded event, and counting number of rows that meet criteria (and storing that value)
I have some (medical) longitudinal data on the detection (or not) of bronchiectasis. I wish to count the number of participants with and without bronchiectasis at their latest follow up/check. I ...
0
votes
1
answer
137
views
Longitudinal dataset: counting the number of repeats and storing the value in a variable
I have a longitudinal/long layout dataset in Stata in which RecordIDs are repeated/ I want to generate a new variable which shows the number of times each ID is repeated. How can I write the code?
I ...
-1
votes
1
answer
61
views
How to group by ID numbers in dataset when running H2O automl
I'm using the H2O package for machine learning. The goal is to use my dataset to estimate new predicted ages for each participant in my dataset. My setup for the code was to get rid of all unnecessary ...
3
votes
1
answer
76
views
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 ...
1
vote
1
answer
741
views
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 ...
0
votes
1
answer
1k
views
How to check for homoscedasticity in a mixed effect model with longitudinal data in r
I am new to using mixed effect models and all the information online has me quite confused. I hope someone can help me.
I have data of patients who did the same test at three different timepoints. I ...
2
votes
2
answers
76
views
Finding observations occuring more than 3 times in longitudinal data
I have the following data:
structure(list(ID = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, ...
4
votes
4
answers
102
views
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, ...
0
votes
0
answers
23
views
Categorical exposure (genetic predisposition of a SNP) and continuous repeated measures outcome (depressive symptoms)
I am looking for some help on the following matter.
I have to analyse the association between SNPs and depressive symptoms. Genetic predisposition of the SNP will be categorised in either 0,1 or 2 ...
0
votes
0
answers
21
views
How big should the cell size for each time point be in longitudinal data with GAM in R
I have a question about the cell size by time point for my longitudinal data set to estimate smooth curves by each category of the X variable in GAM.
Basically, the data is from a cohort study which ...
0
votes
1
answer
344
views
Clustering for Longitudinal data
for my project I need to cluster unbalanced longitudinal data. So, for participants there are varying amount of responses:
[Example of the data](https://i.sstatic.net/HemLJ.png)
I just can't really ...
0
votes
0
answers
72
views
How do I use a GLM with longitudinal data to get a treatment effect at a specific time point in Stata?
So I want to use the mixed command. I have 3 different time points. I want to do a regression at time point 3 to see the effect of 'group' on 'score'. I tried to create a variable for score when time=...
1
vote
1
answer
57
views
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, ...
0
votes
1
answer
87
views
Turn wide format into longitudinal data format [duplicate]
I have a dataset in wide format with no time variable and I would like to create a time variable and turn it into long format for longitudinal analysis.
The original dataset looks like this:
id <- ...
0
votes
1
answer
129
views
Make ggplot connect datapoints in a scatterplot chronologically
This seems very simple but for some reason I can't make it work.
I have a dataset with 3 variables. The first variable is a measurement which is taken several times per day across two months (it can ...
1
vote
1
answer
471
views
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 ...
0
votes
2
answers
167
views
How to remove specific ID based on specific condition (e.g., different value in variable)?
I have 8 observations per subject ID. All subjects were asked to complete 8 tasks (i.e., 8 observations) in the same session, i.e., each ID should have an identical session time. However, in my ...
0
votes
0
answers
40
views
R command rmcorr CI bootstrap argument not working?
Tried using the example data provided by the package and specified the use of CI bootstrap:
rmcorr(Subject, PaCO2, pH, bland1995, CI.level=0.95, CIs=c("analytic","bootstrap"), ...
0
votes
0
answers
44
views
How do I generate the first difference for all subjects in my dataset? (R, longitudinal data) [duplicate]
Example of data set I have a dataset which contains the id number of the subjects and the year in which the data was collected (data is collected yearly). In essence, for each person, there is ...