Estimate variable of difficult isolation

Asked

Viewed 73 times

6

Good afternoon collaborators. I am having difficulty estimating a parameter via R programming to complete my processing routine. The equation I am using is the one described below, where I have all the values, except the value of the variable k

razao2 = (razao1)^((idade2/idade)^k)

where, I have the vectors

razao2<-c(1.0331279, 1.0416188, 1.0167619, 0.0000000, 0.9638364, 0.9668588)
razao1<-c(1.0151796, 1.0331279, 1.0416188, 1.0167619, 0.9822768, 0.9638364)
idade<-c(2.580833, 3.594167, 4.608333, 2.580833, 3.594167, 4.608333)
idade2<-c(3.594167, 4.608333, 5.625000, 3.594167, 4.608333, 5.625000)

razao1[1] is the respective razao2[1], respective to idade[1] and the idade2[1]

therefore for each position i of the vectors, I will have a calculated value of k that promotes equality

I tried to do the following way, but I did not succeed, I have difficulties in creating a logic q isole k to be estimated, or that from some other means promote estimates of a value k to home combinations of values of a given position i of vectors

kcalculado <- function(razao1, idade2, idade, k){
  razao2 <- razao1^((idade2/idade)^(k)) 
  razao2
}

optimise(kcalculado, razao2)

thanks in advance for the help

2 answers

6


Using the formula prior to the final formula of reply from Marcelo Shiniti Uchimura, we can adjust a linear model.

#ln(ln(razao2) = ln(ln(razao1)) + ln(idade2/idade1)*k

log.log.razao1 <- log(log(razao1))
log.log.razao2 <- log(log(razao2))
log.id2.id <- log(idade2/idade)

modelo <- lm(log.log.razao2 ~ log.id2.id)

r1 <- exp(exp(coef(modelo)[1]))
k <- exp(coef(modelo)[2])

In this result, r1 is the calculated value of razao1, that is not far from the average value of the data.

mean(razao1)
#[1] 1.0088

r1
#(Intercept) 
#   1.009239

And the value of k will be the following.

k
#log.id2.id 
#  73.33412 

If these names are annoying, you can do unname(r1) and unname(k).

3

Below is the algebra.

razao2 = (razao1)^((idade2/idade1)^k)

ln(razao2) = (idade2/idade1)^k * ln(razao1)

ln(ln(razao2)) = k * ln(idade2/idade1) + ln(ln(razao1))

k = (ln(ln(razao2)) - ln(ln(razao1))) / (ln(idade2) - ln(idade1))

Browser other questions tagged

You are not signed in. Login or sign up in order to post.