Arne Jonas Warnke
2011-Mar-10 22:07 UTC
[R] Sample or Probability Weights in LM4, NLME (and PLM) package
Dear all, First, I would like to thank you for your immense work. My question is about a frequent topic which I am not able to solve - even after hours of search in the mailing lisy. I would like to analyse random-effects (and fixed-effects)models of longitudinal / panel data with sampling weights. I have an unbalanced panel of different individuals in 5 years and income data as well as their age and I would like to analyse age-earnings profiles with longitudinal data to controll for cohort effects. In an earlier post Millo Giovanni kindly helped and said that this is not possible to use weights in the plm package. He suggested to apply a pre-treatment to the data but I wanted to try the existing packages in R first. So next, I tried the lme4 package but it seems to be the case that the weighting function in lmer does not work. This has been discussed several times in the mailing list and I cannot discern any effect of adding weights to lmer too. Next, I tried to work with the nlme package but I have some problems with the structure of the package. I ran un-weighted random-effects regressions and I read about the varFunc objects but I really stuck here. I would like to ask you if you could help me briefly. How can use the weighting function in the lme function for my purpose? My variables are id for each individual, year, age (and age squared to age quartic) and (to begin with) constant weights for each individual. I would prefer to use yearly changing weights per individual to capture better attrition. Do my weights have to be constant in nlme for every individual (just as in xtreg in Stata)? My main variables: id year income age cross-sectional weight longitudinal weight Are you aware of any other packages in R which provide the opportunity to examine longitudinal data with sample weights? Kind regards, Arne [[alternative HTML version deleted]]
Thomas Lumley
2011-Mar-10 22:58 UTC
[R] Sample or Probability Weights in LM4, NLME (and PLM) package
On Fri, Mar 11, 2011 at 11:07 AM, Arne Jonas Warnke <arne.warnke at googlemail.com> wrote:> Dear all, > > > > First, I would like to thank you for your immense work. My question is > about a frequent topic which I am not able to solve - even after hours > of search in the mailing lisy. > > I would like to analyse random-effects (and fixed-effects)models of > longitudinal / panel data with sampling weights. I have an unbalanced > panel of different individuals in 5 years and income data as well as > their age and I would like to analyse age-earnings profiles with > longitudinal data to controll for cohort effects.This is doable in theory, since the random effects structure is nested in the sampling design, but not in any R package I am aware of. The problem is that you can't just put in one set of weights -- in order to get the variance components correct, you need to put in separate weights for each level of sampling and random effect. So whatever lme() does can't be correct for sampling weights, since it allows for only one set of weights <snip>> Are you aware of any other packages in R which provide the opportunity > to examine longitudinal data with sample weights?If you aren't specifically interested in estimating the variance components, just in using longitudinal data to estimate the regression, you can just use design-based inference for a linear regression model, with svyglm() in the 'survey' package. If you want estimates of the variance components you may be out of luck. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland
Maybe Matching Threads
- Longitudinal Weights in PLM package
- how do I build panel data/longitudinal data models with AR terms using the plm package or any other package
- Question of "Quantile Regression for Longitudinal Data"
- package to do inverse probability weighting in longitudinal data
- Variable selection in NLME or LME4