similar to: How to use nls when [selfStart] function returns NA or Inf??

Displaying 20 results from an estimated 2000 matches similar to: "How to use nls when [selfStart] function returns NA or Inf??"

2009 Sep 04
1
How should a SelfStart function handle illegal parameter values?
Hi Everyone, I'm trying to write selfStart non-linear models for use with nls. In these models some combinations of parameter values are illegal; the function value is undefined. That's OK when calling the function directly [e.g. SSmodel(x, pars...)]; I return an appropriate non-value such as NA or Inf. However, when called from nls [e.g. nls(y~SSmodel(x, pars...), ...)] those
2008 Aug 18
1
"nested" getInitial calls; variable scoping problems
Hi All, Another nls related problem (for background, I'm migrating a complicated modelling package from S-plus to R). Below I've reduced this to the minimum necessary to demonstrate my problem (I think); the real situation is more complicated. Two similar selfStart functions, ssA and ssB. The 'initial' function for ssB modifies its arguments a little and then calls getInital
2009 Oct 17
1
custom selfStart model works with getInitial but not nls
Hello, I'm having problems creating and using a selfStart model with nlme. Briefly, I've defined the model, a selfStart object, and then combined them to make a selfStart.default model. If I apply getInitial to the selfStart model, I get results. However, if I try usint it with nls or nlsList, these routines complain about a lack of initial conditions. If someone could point out
2002 Jul 19
1
selfStart function problem
Hello, list, I am making a self-starting nonlinear function to model the relation of tree height (H) and diameter (D) in a forest stand. The function I am trying is H=a*exp[b*(D+5.8)^(-c)]. To calculate the initial estimates of the parameters, I linearized the formula by taking logarithms and fixing the parameter c=1. Then I calculated the initial estimates of a and b using lm() on the
2006 May 24
1
problem-nlme
Hi, I have great problems with my work in R. I look for to model the growth of fish. I have "Longitudinal data", a serie of repeated measures for each individual. Using the corresponding packages "nlme" in R. I treat to fit to the data different growth functions, wich were entered by me. Unfortunately for no it was arrived at the convergence, several error messages appeared. I
2009 Nov 12
0
writing selfStart models that can deal with treatment effects
Hello, I'm trying to do some non-linear regression with 2 cell types and 4 tissue type treatments using selfStart models Following Ritz and Streibig (2009), I wrote the following routines: ##Selfstart expDecayAndConstantInflowModel <- function(Tb0, time, aL, aN, T0){ exp(-time*aL)*(T0*aL+(-1+exp(time * aL))*Tb0 * aN)/aL } expDecayAndConstantInflowModelInit <- function(mCall, LHS,
2008 Aug 29
1
nls() fails on a simple exponential fit, when lm() gets it right?
Dear R-help, Here's a simple example of nonlinear curve fitting where nls seems to get the answer wrong on a very simple exponential fit (my R version 2.7.2). Look at this code below for a very basic curve fit using nls to fit to (a) a logarithmic and (b) an exponential curve. I did the fits using self-start functions and I compared the results with a more simple fit using a straight lm()
2017 Jul 30
0
Kalman filter for a time series
> structSSM Is no longer part of KFAS. All you needed to do was: library(KFAS) ?KFAS and you would have seen that if you went to the index. A structural state space model is now built up from its components, much like in LM. Look at; ?SSModel -Roy > On Jul 29, 2017, at 9:26 PM, Staff <rbertematti at gmail.com> wrote: > > I found an example at >
2007 Apr 20
1
nlme trouble
I am not certain how nlme works so I followed an example from the web ( http://www.menne-biomed.de/gastempt/gastempt1.html). I was able to successfully reproduce the example. However, when I modified my the example to use my data and with my formula, I get a set of errors having to do with the log() function. I get 10 of them (all exactly the same) and there are 10 levels in my factor variable.
2017 Jul 30
4
Kalman filter for a time series
I found an example at http://www.bearcave.com/finance/random_r_hacks/kalman_smooth.html shown below. But it seems the structSSM function has been removed from KFAS library so it won't run. Does anyone know how to fix the code so that it runs? library(KFAS) library(tseries) library(timeSeries) library(zoo) library(quantmod) getDailyPrices = function( tickerSym, startDate, endDate ) {
2009 Jun 09
1
Non-linear regression/Quantile regression
Hi, I'm relatively new to R and need to do a quantile regression. Linear quantile regression works, but for my data I need some quadratic function. So I guess, I have to use a nonlinear quantile regression. I tried the example on the help page for nlrq with my data and it worked. But the example there was with a SSlogis model. Trying to write dat.nlrq <- nlrq(BM ~ I(Regen100^2),
2006 Feb 12
1
lme, nlsList, nlsList.selfStart
Dear listers, I am trying to fit a model using nlsList() using alternately a SSfol() selfstart function or its developped equivalent formulae. This preliminary trial works well mydata<-groupedData(Conc~Tps|Organ,data=mydata) mymod1<-nls(Conc~SSfol(Dose,Tps,lKe,lKa,lCl),data=mydata) as well as a developped form: mymod2<-nls(Conc~Dose * exp(lKe+lKa-lCl) *
2006 Nov 13
2
notepad selfstart on login
hi all; I'm starting in PDC and need some help, i'm using samba for pdc but without ldap, and all time that a user make login, open a notepad with the content: [.ShellClassInfo] LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21787 or [DeleteOnCopy] Owner=cesar Personalized=5 PersonalizedName=My documents and all folder have a document Desktop.ini... someone can say me why
2008 Aug 04
0
Unexpected nls behaviour: Solved
Hi Everyone, I'd omitted the non-optional 'parameters' argument to selfStart. Making this change to SSbatch gives the same (successful) result from the two calls to nls. SSbatch<-selfStart( model=function(Batch, Coeffs) { Coeffs[Batch] } ,initial=function(mCall, data, LHS) { # Estimate coefficients as mean of each batch xy <- sortedXyData(mCall[["Batch"]],
2011 Jun 17
2
Non-linear Regression best-fit line
I am trying to fit a curve to a cumulative mortality curve (logistic) where y is the cumulative proportion of mortalities, and t is the time in hours (see below). Asym. at 0 and 1 > y [1] 0.00000000 0.04853859 0.08303777 0.15201970 0.40995074 0.46444992 0.62862069 0.95885057 1.00000000 [10] 1.00000000 1.00000000 > t [1] 0 13 20 24 37 42 48 61 72 86 90 I tried to find starting values for
2008 Jul 29
4
Graphics function question
Hello I have created a graph using the following commands: <<< startBReP3O1T <- diffs$BReP3O1T - diffs$diff_BReP3O1T endBReP3O1T <- diffs$BReP3O1T x <- seq(47,89, length = 10) ymin <- min(min(startBReP3O1T), min(endBReP3O1T)) ymax <- max(max(startBReP3O1T), max(endBReP3O1T)) y <- seq(ymin, ymax, length = 10) plot(x,y, type = 'n', xlab = 'Age', ylab =
2007 Nov 28
0
Plotting Vector Fields
Plotting vector fields as we know it from Wolfram Mathematica's PlotVectorField[{f1(x1), f2(x2)}, {x1, min, max}, {x2, ymin, ymax}, PlotPoints -> ...] ### FUNCTION DEFINITION #! Outer product with vector function ### # expand.outer joins functionality of "expand.grid" and "outer", so that # a vector function can be applied, values of which are then stored in
2008 Sep 26
0
The 'data' argument and scoping in nls
Hi Everyone, I seek guidance to avoid wasting a lot of time and doing things badly. Several times I've solved my problems, only to find that my solutions were clumsy and not robust. (see "nested" getInitial calls; variable scoping problems: Solved?? http://finzi.psych.upenn.edu/R/Rhelp02a/archive/139943.html for one truly horrible approach). I'm sure that I'm not the
2008 Aug 01
0
Unexpected nls behaviour
Hi everyone, I thought that for a selfStart function, these two should be exactly equivalent > nls(Aform, DF) > nls(Aform, DF, start=getInitial(Aform, DF)) but in this example that is not the case in R (although it is in S-plus V6.2) ------------------------------ SSbatch<-selfStart( model=function(Batch, Coeffs) { Coeffs[Batch] } ,initial=function(mCall, data, LHS) { # Estimate
2000 Jul 24
1
How to use groupedData() within a function?
Dear Group: I have been trying to write an R function within which the function groupedData() would be used. The following is a sample program: ####################### sid<-rep(1:6,times=2) time<-c(1:12) trt<-rep(letters[1:3],times=4) tem<-data.frame(sid,time,trt) test1.fun<- function(dat=dat) { groupedData(time ~ trt|sid, data=dat) } test1.fun(dat=tem)