3

I have data on a variable measured in multiple longitudinal samples. I do not have the individual-level data for each sample, just the sample means and variances at each time point. The samples do not neccessarily measure the variable at the same time points.

How do I fit a single "best" curve (Y = variable, X = time) to these data?

Fitting curves to simulated individual data, and meta-regression come to mind. There are other posts about estimating a single mean value from a set of sample means, but I can't find anything specific to curve fitting.

D L Dahly
  • 3,723
  • 1
    It's not completely clear from the question exactly what you want to plot against what in your 'single "best" curve'. Is this a plot of measured variable values against time, with separate lines for each sample"? If so, how many time points, how many groups, and what distinguishes the groups? Also, without the individual data points, it's not clear to me that these really are panel data. – EdM Jun 30 '15 at 14:30
  • I would accept any answer where the number of time points is > 2 and the number of samples is > 1. Each sample is what you would refer to as panel data. – D L Dahly Jun 30 '15 at 15:54

1 Answers1

2

The ols function in the R package rms would seem to be a good candidate to meet this requirement. This function allows a spline fit (of characteristics that you can specify) with respect to time to be included as a predictor variable, along with the predictor specifying the identities of your samples, in a linear model; interactions among these predictors could be assessed. It also allows for weights, so that you could weight each mean value according to its variance. Predicted values are provided for curve plotting. There is a learning curve to using this package, but it's well worth it.

Fitting spline curves has the advantage of providing equations. If all you want is to display the data, the loess function in R can do local fitting of a smooth curve, again with the option of weighting data points.

EdM
  • 92,183
  • 10
  • 92
  • 267