Estimating parameters of exponential decay model where DVs are dependent on sum of different time-series in R

Viewed 277

I would like to know how to proceed with the following non linear regression analysis, which is a simplified version of my real problem.

5 Participants where asked to observe the speed of three different cars: Audis, VWs and Porsches over a ten second time frame. This gives me the following data set:

S_t_c <- read.table(text = "
 time     S_c_1  S_c_2     S_c_3 
     1      20    15         40 
     2      45    30         50 
     3      60    45         60 
     4      75    60         60 
     5      90    70         60 
     6     105    70         90 
     7     120    70        120 
     8     125    70        140 
     9     130    70        160 
    10     145    70        180 
           ",header = T)

After observing the last 10 seconds, the 5 participants where then asked to guess how fast the car would go in t=11. This gives me this data:

S_11_i_c <-read.table(text = "
             i     c_1    c_2       c_3 
             1     150    70        190 
             2     155    70        200 
             3     150    75        195 
             4     160    80        190 
             5     150    75        180 
               ",header = T)

I now want to execute a non linear regression to estimate the free parameters of the following model:

The indices stand for the following:

i= participant
c=car brand
s=time

My problems are the sums as well as the fact that I have to estimate the parameters based on three different observations sets (for each car one). So I do not know how to code sums into a regression and I have problems with the facts that my DVs are dependent on different time-series IVs. I would like to learn how to do this in R.

EDIT: Attempt at solving the problem.

What I managed to do so far is write w_s and Sum_S:

function (x) {
    x = 0
    for (j in 0:9) {
    x <- x+ x^j
    }
}


w_s = beta_2^s / function(beta_2)

Sum_S_t_c <- data.frame(
    s = seq(1:9),
    c_1 = rnorm(9)  
    c_2 = rnorm(9)
    c_3 = rnorm(9)

)

Sum_S_t_c = 0
for (c in 2:4) {
    for (s in 0:9) {  
    Sum_S_t_c[s,c] <- Sum_S_t_c + S_t_c[10-s, c] 
    Sum_S_t_c = Sum_S_t_c[s,c]
    }
}

Now, I somehow need to fit these variables into a non-linear regression. This would be my dummy code for it:

For (c in 2:4) {
    for (i in 1:5) {
        for (s in 0:9) {    

        S_11_i_c ~ beta_0 +  beta_1 * Sum_S_t_c[s,c] * beta_2^s / function(beta_2)

        }
    }
}

I also need to set an upper and lower limit for beta_2, which I do not know how to do. I also wonder, if it even possible to use a function within a regression?

Edit:

Should I possibly group the DV and IVS somehow? If so, is it possible to group variables of two different data tables together?

0 Answers
Related