Dear R folks,

having simulation data in a vector n2off, I know that they should be
similar to a power function f [1], f(n) = n^(-1/r), r ∈ ℕ\{0}, and I
want to find the value for r best fitting the simulation data.
Furthermore I know that this is only true for big n, that means n2off(n)
~ f(n) ⇔ n2off(n)/f(n) → 1 for n → ∞. (The vector n2off is considered a
function n2off(n).)

I came up with the following example where I artificially munch(?) the
values of a known function, n^(-½), and the fit should hopefully return
r = 2, that means n^(-½).

        > n <- 1:10 # Should be more data points, but not useful for including 
into an email.
        > n
         [1]  1  2  3  4  5  6  7  8  9 10
        > n2 <- n**(-0.5)
        > n2
         [1] 1.0000000 0.7071068 0.5773503 0.5000000 0.4472136 0.4082483 
0.3779645
         [8] 0.3535534 0.3333333 0.3162278
        > set.seed(1); n2off <- n2 + runif(1)/100 # for greater n the divisor 
should also be increased I guess.
        > n2off
         [1] 1.0026551 0.7097619 0.5800054 0.5026551 0.4498687 0.4109034 
0.3806196
         [8] 0.3562085 0.3359884 0.3188829

Weighting fits(?) larger n higher or only from certain n on, for example
n ≥ 100, is not considered in this example. And probably the data points
are too small in this function.

I have to admit that I am new to this topic and I am just overwhelmed
what I have found when searching for »gafit« in the r-help archive [2]
and »curve parameter fitting« in rseek.org [3].

Reading ?nlm, ?nlminb, ?opitimze and ?optim there are just too many
options there. Reading about gafit [4] it says that it is not
maintained.

Additionally I am not sure if this could be turned into a linear model
using log(n^(-1/r)) = -1/r log(n). Somewhere it said that linear
regression models have to fulfill certain assumptions.

So if somebody of you experienced users could point me to the “best”
function or package to use here and some literature regarding this issue
(fit only for big n) that would be much appreciated.


Thank you in advance,

Paul


PS: Is that question too long for sending to the list and should I be
less elaborate for further problems?


[1] https://secure.wikimedia.org/wikipedia/en/wiki/Power_function
[2] http://tolstoy.newcastle.edu.au/~rking/R/
[3] http://www.rseek.org/
[4] http://cran.r-project.org/web/packages/gafit/gafit.pdf

Attachment: signature.asc
Description: This is a digitally signed message part

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to