similar to: Formula aruguments with NLS and model.frame()

Displaying 20 results from an estimated 2000 matches similar to: "Formula aruguments with NLS and model.frame()"

2006 Sep 07
0
Help understanding how nls parses the formula argument to estimate the model
I could use some help understanding how nls parses the formula argument to a model.frame and estimates the model. I am trying to utilize the functionality of the nls formula argument to modify garchFit() to handle other variables in the mean equation besides just an arma(u,v) specification. My nonlinear model is y<-nls(t~a*sin(w*2*pi/365*id+p)+b*id+int,data=t1,
2006 Sep 21
0
Help understanding how nls parses the formula argument to estimate the model
I could use some help understanding how nls parses the formula argument to a model.frame and estimates the model. I am trying to utilize the functionality of the nls formula argument to modify garchFit() to handle other variables in the mean equation besides just an arma(u,v) specification. My nonlinear model is y<-nls(t~a*sin(w*2*pi/365*id+p)+b*id+int,data=t1,
2012 Jul 03
1
nls problem
hi list, used versions: 2.12.1 and 2.14.0 under ubuntu and macosx. I recently stumbled over a problem with `nls', which occurs if the model is not specified explicitly but via an evaluation of a 'call' object. simple example: 8<-------------------------------------------------------------------------------------- nlsProblem <- function (len = 5) {
2001 Feb 19
2
problems sourcing in vs interactive
If I source in the function (see below) calib(), I get: > source("papers/helle/threshold.r") > calib() Error in eval(expr, envir, enclos) : Object "energy" not found But if I cut and paste the code for calib() one line at a time into the R window it works fine. calib<-function() { contrast<-c(.01,.02,.0325,.055,.0775,.1,.125,.15,.175,.2)
2008 Jun 26
3
bug in nls?
Dear all Nobody responded to my previous post so far so I try with more offending subject. I just encountered a strange problem with nls formula. I tried to use nls in cycle but I was not successful. I traced the problem to some parse command. Here is an example DF<-data.frame(x=1:10, y=3*(1:10)^.5+rnorm(10)) coef(lm(log(DF[,2])~log(DF[,1]))) (Intercept) log(DF[, 1]) 0.7437320
2008 Aug 05
1
Fix for nls bug???
Hi All, I've hit a problem using nls. I think it may be a restriction in the applicability of nls and I may have found a fix, but I've been wrong before. This example is simplified to the essentials. My real application is much more complicated. Take a function of matrix 'x' with additional arguments: matrix 'aMat' whose values are _not_ to be determined by nls vector
2009 Dec 18
2
NLS-Weibull-ERROR
Hello I was trying to estimate the weibull model using nls after putting OLS values as the initial inputs to NLS. I tried multiple times but still i m getting the same error of Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates. The Program is as below > vel <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14) > df <- data.frame(conc, vel) >
2003 Aug 07
2
model.frame() call from inside a function (PR#3671)
R version: 1.7.1 OS: Red Hat Linux 7.2 Hi all, The formula object in model.frame() is not retrieved properly when model.frame() is called from within a function and the "subset" argument is supplied. foo <- function(formula,data,subset=NULL) { cat("\n*****Does formula[-3] == ~y ?**** TRUE *****\n") print(formula[-3] == ~y) cat("\n*****Result of model.frame()
2012 Jan 19
3
fitting an exp model
Hello there, I am trying to fit an exponential model using nls to some data. #data t <- c(0,15,30,60,90,120,240,360,480) var <- c(0.36,9.72,15.50,23.50,31.44,40.66,59.81,73.11,81.65) df <- data.frame(t, var) # model # var ~ a+b*(1-exp(-k*t)) # I'm looking for values of a,b and k # formula # mod <- nls(formula = var ~ a+b *(1-exp((-k)*t)), start=list(a=0, b=10,
2008 Aug 13
1
Arguments to lm() within a function - object not found
Hi all, I'm having some difficulty passing arguments into lm() from within a function, and I was hoping someone wiser in the ways of R could tell me what I'm doing wrong. I have the following: lmwrap <- function(...) { wts <- somefunction() print(wts) # This works, wts has the values I expect fit <- lm(weights=wts,...) return(fit) } If I call my function lmwrap, I get
2011 Nov 30
2
nls help
Hello, I have data like the following: datum <- structure(list(Y = c(415.5, 3847.83333325, 1942.833333325, 1215.22222233333, 950.142857325, 2399.5833335, 804.75, 579.5, 841.708333325, 494.053571425 ), X = c(1.081818182, 0.492727273, 0.756363636, 0.896363636, 1.518181818, 0.499166667, 1.354545455, 1.61, 1.706363636, 1.063636364 )), .Names = c("Y", "X"), row.names = c(NA,
2007 Jul 15
1
NNET re-building the model
Hello, I've been working with "nnet" and now I'd like to use the weigths, from the fitted model, to iterpret some of variables impornatce. I used the following command: mts <- nnet(y=Y,x=X,size =4, rang = 0.1, decay = 5e-4, maxit = 5000,linout=TRUE) X is (m x n) Y is (m x 1) And then I get the coeficients by: Wts<-coef(mts) b->h1 i1->h1
2007 Jul 23
1
replacing double for loops with apply's
Hi, I am doing double for loops to calculate SDs with some weights and wondering if I can get rid of the outer for loop as well. I made a simple examples which is essentially what I am doing. Thanks for your help! -Young #------------------------------------------------------ # wtd.var is Hmisc package # you can replace the 3 lines inside for loop as # sdx[i,] =
2009 Aug 25
3
Covariates in NLS (Multiple nonlinear regression)
Dear R-users, I am trying to create a model using the NLS function, such that: Y = f(X) + q + e Where f is a nonlinear (Weibull: a*(1-exp(-b*X^c)) function of X and q is a covariate (continous variable) and e is an error term. I know that you can create multiple nonlinear regressions where x is polynomial for example, but is it possible to do this kind of thing when x is a function with unknown
2013 Mar 14
2
question about nls
Hi,all: I met a problem of nls. My data: x y 60 0.8 80 6.5 100 20.5 120 45.9 I want to fit exp curve of data. My code: > nls(y ~ exp(a + b*x)+d,start=list(a=0,b=0,d=1)) Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates I can't find out the reason for the error. Any suggesions are welcome. Many thanks. [[alternative HTML
2011 Jun 30
1
Error "singular gradient matrix at initial parameter estimates" in nls
Greetings, I am struggling a bit with a non-linear regression. The problem is described below with the known values r and D inidcated. I tried to alter the start values but get always following error message: Error in nlsModel(formula, mf, start, wts): singular gradient matrix at initial parameter estimates Calls: nls -> switch -> nlsModel I might be missing something with regard to the
2010 Mar 30
6
Error "singular gradient matrix at initial parameter estimates" in nls
I am using nls to fit a non linear function to some data. The non linear function is: y= 1- exp(-(k0+k1*p1+ .... + kn*pn)) I have chosen algorithm "port", with lower boundary is 0 for all of the ki parameters, and I have tried many start values for the parameters ki (including generating them at random). If I fit the non linear function to the same data using an external
2005 Apr 12
1
calling svydesign function that uses model.frame
I need help on calling the svydesign function in the survey package (although this error appears not to be specific to svydesign). I am passing parameters incorrectly but am not sure how to correct the problem. ## Call the main function PS.sim (one of mine). The dots are parameters I omitted to simplify the question. ## y.col, str.col, clus.id, and PS.col are names of columns in the object pop.
2012 Dec 19
1
Non-linear regression analysis in R‏
Hey all, I'm trying to fit a non-linear model y ~ a * constant ^ b * x ^ c and estimates the paramaters a, b and c. Using the nls function, I'm getting following error message: Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates If I logarithmize the whole equation log(y) ~ log (a) + b * log(constant) + c * log(x) and fit the
2010 Apr 28
1
NLS "Singular Gradient" Error
Hello, I am trying to model a type II functional response of number of prey eaten (Ne) against number supplied (No) with a non-linear least squares regression (nls). I am using a modification of Holling's (1959) disc equation to account for non-replacement of prey; Ne=No{1-exp[a(bNe-T)]} where a is the attack rate, b is the handling time, and T is the experimental period. My script is as