1
$\begingroup$

The basic thing I am trying to do is model a person's income over time, using copula functions in R. The data that I have is a bunch of person-level data, which tells us someone's age, their income in 2018, and their income in 2019. From what I understand, the copula function models the joint distribution of two variables—-for example, the income of 30 year olds in 2018 vs. the income of those same people in 2019. I have successfully fit a bunch of copula functions for each "age transition:" i.e. 23 -> 24, 24 -> 25, and so on. Each of these should model the joint distribution between those ages. My question: Suppose I have a 23-year-old, and I know her income. How can I use these joint distributions to simulate her income over time? i.e. sample her income at 24 given her income at 23, then sample her income at 25 given her income at 24, and so on. (It seems like the thing to do is get the conditional distribution and then sample from it, but I don't know how to do this.) Code for fitting the copula functions is below:

copulas <- list()

for (i in 23:78) {
  filtered <- subset(data.main, AGE_18 == i)
  t.cop <- tCopula(dim=2)

  set.seed(235)

  m <- pobs(as.matrix(cbind(filtered$AGI_PCT_18, filtered$AGI_PCT_19)))

  fit <- fitCopula(t.cop,m,method='itau')

  # Set the parameter
  rho <- coef(fit)[1]

  mu2018 <- mean(filtered$AGI_PCT_18)
  sd2018 <- sd(filtered$AGI_PCT_18)
  mu2019 <- mean(filtered$AGI_PCT_19)
  sd2019 <- sd(filtered$AGI_PCT_19)

  copulas[[i]] <- mvdc(copula=tCopula(rho,dim=2), margins=c("norm","norm"),

                    paramMargins=list(list(mean=mu2018, sd=sd2018),

                                      list(mean=mu2019, sd=sd2019)))
}
$\endgroup$
1
  • $\begingroup$ Welcome to CV. Questions about simulating from a copula arise frequently here: check out the linked posts. A general account is given at stats.stackexchange.com/questions/124865. But details matter: in particular, there are several fitCopula functions out there--what package are you using and what capabilities does it offer for characterizing the copula it fits? For instance, the "copula" package offers an rCopula function for random number generation, reducing your question potentially to one line of code. $\endgroup$
    – whuber
    Mar 5 '20 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.