longitudinal

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

坚强是说给别人听的谎言 提交于 2021-01-27 14:35:57
问题 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 clogit. model1 <- glm(chldwork~lag_aspgrade_binned+age+as.factor(childid), data=finaletdtlag, family='binomial') GLM Output: Call: glm(formula = chldwork ~ lag_aspgrade_binned + age + as.factor(childid), family = "binomial", data = finaletdtlag)

estimate a repeated measures random effects model with a nested structure using `plm()`

允我心安 提交于 2020-07-08 20:39:06
问题 Is it possible to estimate a repeated measures random effects model with a nested structure using plm() from the plm package? I know it is possible with lmer() from the lme4 package. However, lmer() rely on a likelihood framework and I am curious to do it with plm() . Here's my minimal working example , inspired by this question. First some required packages and data, # install.packages(c("plm", "lme4", "texreg", "mlmRev"), dependencies = TRUE) data(egsingle, package = "mlmRev") the data-set

estimate a repeated measures random effects model with a nested structure using `plm()`

北战南征 提交于 2020-07-08 20:38:14
问题 Is it possible to estimate a repeated measures random effects model with a nested structure using plm() from the plm package? I know it is possible with lmer() from the lme4 package. However, lmer() rely on a likelihood framework and I am curious to do it with plm() . Here's my minimal working example , inspired by this question. First some required packages and data, # install.packages(c("plm", "lme4", "texreg", "mlmRev"), dependencies = TRUE) data(egsingle, package = "mlmRev") the data-set

estimate a repeated measures random effects model with a nested structure using `plm()`

南楼画角 提交于 2020-07-08 20:38:05
问题 Is it possible to estimate a repeated measures random effects model with a nested structure using plm() from the plm package? I know it is possible with lmer() from the lme4 package. However, lmer() rely on a likelihood framework and I am curious to do it with plm() . Here's my minimal working example , inspired by this question. First some required packages and data, # install.packages(c("plm", "lme4", "texreg", "mlmRev"), dependencies = TRUE) data(egsingle, package = "mlmRev") the data-set

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

孤街醉人 提交于 2020-05-13 22:55:10
问题 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 clusterLongData function..): library(kml) traj <- matrix(c(1,2,3,1,4, 3,6,1,8,10, 1,2,1,3,2, 4,2,5,6,3, 4,3,4,4,4, 7,6,5,5,4),6) myCld <- clusterLongData( traj=traj, idAll=as.character(c(100,102,103,109,115,123)), time=c(1,2,4,8,15), varNames="P", maxNA=3

How to choose and plot the quality criterion in `kml` function?

只愿长相守 提交于 2020-04-30 06:38:46
问题 I just started working with the kml package to perform longitudinal k-means clustering in R . By default the kml function uses the Calinski Harabatz Sorted criterion to choose the 'best' clustering. So by accessing the 'best' clustering you will always see the Calinski Harabatz Sorted criterion. How can we choose another quality criterion ? A minimal example: library(kml) # some data cld <- generateArtificialLongData(25) # perform clustering kml(cold) # choose the 'best' clustering: choice

How to choose and plot the quality criterion in `kml` function?

断了今生、忘了曾经 提交于 2020-04-30 06:38:45
问题 I just started working with the kml package to perform longitudinal k-means clustering in R . By default the kml function uses the Calinski Harabatz Sorted criterion to choose the 'best' clustering. So by accessing the 'best' clustering you will always see the Calinski Harabatz Sorted criterion. How can we choose another quality criterion ? A minimal example: library(kml) # some data cld <- generateArtificialLongData(25) # perform clustering kml(cold) # choose the 'best' clustering: choice

R Ordering of LME covariates for level 1 and level 2 variables?

半世苍凉 提交于 2019-12-25 09:00:33
问题 I have longitudinal data with level 1 and level 2 variables in R my dataframe (df) : ID Year Gender Race MathScore DepressionScore MemoryScore 1 1999 M C 80 15 80 1 2000 M C 81 25 60 1 2001 M C 70 50 75 2 1999 F C 65 15 99 2 2000 F C 70 31 98 2 2001 F C 71 30 99 3 1999 F AA 92 10 90 3 2000 F AA 89 10 91 3 2001 F AA 85 26 80 I've tried these: summary(fix <- lme(MathScore ~ Gender+Race+DepressionScore+MemoryScore, random= Year|ID, data=df, na.action="na.omit") summary(fix2 <- lme(MathScore ~ 1