[R] Non linear modeling
Spencer Graves
spencer.graves at pdf.com
Sun Mar 20 16:55:42 CET 2005
Another question: What do you know or assume about the distribution
of "e"? If (y-x) is always positive, the survival package, especially
the survreg function, might help you. For this, I found especially
helpful the discussion of this in Venables and Ripley (2002) Modern
Applied Statistics with S, 4th ed. (Springer). For a more thorough
treatment of the theory (but not of R), see Meeker and Escobar (1998)
Statistical Methods for Reliability Data (Wiley).
Alternatively, if you assume a distribution for "e" and assume the
different e's are independent, write a function, say, "dev" = (-2) time
the sum of the log density function of the e's, then give this to
"optim" [e.g., dnorm = density function for a normal distribution;
dweibull = density for a Weibull, etc.; help.start() -> "An
Introduction to R" covers probability functions and writing your own
functions.]
hope this helps.
spencer graves
############################
What do you want to minimize? Can you write a function to compute
eps given x, y, and a? Given that, you can then write another function
to compute the objective function you want to minimize. If "a" is a
scalar, compute the objective function for a range of values of "a" and
plot. If you want numerical precision, read the help file for "optim",
work the examples until you understand enough to see how to feed your
objective function with a starting value to "optim".
If you still can't figure it out, please make an attempt, then
read the posting guide "http://www.R-project.org/posting-guide.html",
and prepare a follow-up question as needed. (In a discussion on and off
this list earlier this week, several people confirmed that they had
solved many problems following this posting guide. It may not be as
good as Polya's famous "How to Solve It", but it's pretty good.)
hope this helps.
spencer graves
Angelo Secchi wrote:
>You are right. eps in my model is not a parameter but the error term.
>Also the linearization doesn't solve the problem, since sometimes you
>cannot take logs. Any other ideas?
>Thanks
>
>
>On Fri, 18 Mar 2005 11:21:12 -0500
>"Liaw, Andy" <andy_liaw at merck.com> wrote:
>
>
>
>>That's treating eps as a parameter in the model. If I read your question
>>right, that's not what you want.
>>
>>Andy
>>
>>
>>
>>>From: ronggui [mailto:0034058 at fudan.edu.cn]
>>>
>>>then is the nls function can deal the problem as Guillaume
>>>STORCHI mentioned in the last post? [X<-nls(y~x+exp(a*x)*eps,
>>>data=,start=list(a=,eps=))]
>>>or just can solve the problem as:log(y-x) = a*x + e?
>>>
>>>
>>>
>>>On Fri, 18 Mar 2005 08:56:38 -0500
>>>"Liaw, Andy" <andy_liaw at merck.com> wrote:
>>>
>>>
>>>
>>>>AFAIK most model fitting techniques will only deal with
>>>>
>>>>
>>>additive errors, not
>>>
>>>
>>>>multiplicative ones. You might want to try fitting:
>>>>
>>>>log(y-x) = a*x + e
>>>>
>>>>which is linear.
>>>>
>>>>Andy
>>>>
>>>>
>>>>
>>>>>From: Angelo Secchi
>>>>>
>>>>>Hi,
>>>>>is there a way in R to fit a non linear model like
>>>>>
>>>>>y=x+exp(a*x)*eps
>>>>>
>>>>>where a is the parameter and eps is the error term?
>>>>>Thanks
>>>>>Angelo
>>>>>
>>>>>______________________________________________
>>>>>R-help at stat.math.ethz.ch mailing list
>>>>>https://stat.ethz.ch/mailman/listinfo/r-help
>>>>>PLEASE do read the posting guide!
>>>>>http://www.R-project.org/posting-guide.html
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>______________________________________________
>>>>R-help at stat.math.ethz.ch mailing list
>>>>https://stat.ethz.ch/mailman/listinfo/r-help
>>>>PLEASE do read the posting guide!
>>>>
>>>>
>>>http://www.R-project.org/posting-guide.html
>>>
>>>
>>>
>>>
>>>
>>
>>------------------------------------------------------------------------------
>>Notice: This e-mail message, together with any attachment...{{dropped}}
>>
>>
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
More information about the R-help
mailing list