similar to: Need help with self-defined function to perform nonlinear regression and get prediction interval

Displaying 20 results from an estimated 600 matches similar to: "Need help with self-defined function to perform nonlinear regression and get prediction interval"

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
2010 May 11
1
nls() and nls2() behavior?
first, apologies for so many posts yesterday and today. I am wrestling with nls() and nls2(). I have tried to whittle it down to a simple example that still has my problem, yet can be cut-and-pasted into R. here it is: library(nls2) options(digits=12); y= c(0.4334,0.3200,0.5848,0.6214,0.3890,0.5233,0.4753,0.2104,0.3240,0.2827,0.3847,0.5571,0.5432,0.1326,0.3481) x=
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
2008 May 23
3
nls diagnostics?
Hi, All: What tools exist for diagnosing singular gradient problems with 'nls'? Consider the following toy example: DF1 <- data.frame(y=1:9, one=rep(1,9)) nlsToyProblem <- nls(y~(a+2*b)*one, DF1, start=list(a=1, b=1), control=nls.control(warnOnly=TRUE)) Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial
2010 Sep 02
1
How using the weights argument in nls2?
Good morning gentlemen! How using a weighted model in nls2? Values with the nls are logical since values with nls2 are not. I believe that this discrepancy is due to I did not include the weights argument in nls2. Here's an example: MOISTURE <- c(28.41640, 28.47340, 29.05821, 28.52201, 30.92055, 31.07901, 31.35840, 31.69617, 32.07168, 31.87296, 31.35525, 32.66118, 33.23385,
2011 May 11
1
Problem with constrained optimization with maxBFGS
Dear all, I need to maximize the v: v= D' W D D is a column vector ( n , 1) W is a given matrix (n, n) subject to: sum D= 1 (BTW, n is less than 300) I´ve tried to use maxBFGS, as follows: ##################################### objectiveFunction<-function(x) { return(t(D)%*%W%*%D) } Amat<-diag(nrow(D)) Amat<-rbind((rep(-1, nrow(D))), Amat) bvec<-matrix( c(0), nrow(D)+1,
2010 Nov 24
1
The nls2 function automatically prints the object!
Good morning gentlemen! When I use the function nls2, and store it in an object, that object is automatically printed, without the summary or to draw the object. For example. model <- nls2 (...) Number of iterations to convergence: ... Achieved convergence tolerance: ... Nonlinear regression model model: ... ~ ... Date: NULL The B k ... ... ... residual sum-of-squares: ... Number
2005 Mar 09
2
Structural equation models with R
Hello useRs, I`m running structural equation models with R, but for one of my models the below error message apears. I`m trying to change startvalues but without success. The manual for sem package did not help me. Does anyone knows how to change startvalues for iteration in sem package? Or it can be another problem with the model? Error in startvalues(S, ram, debug = debug, tol = start.tol)
2010 Jan 13
1
Problem fitting a non-linear regression model with nls
Hi, I'm trying to make a regression of the form : formula <- y ~ Asym_inf + Asym_sup * ( (1 / (1 + (n1 * (exp( (tmid1-x) / scal1) )^(1/n1) ) ) ) - (1 / (1 + (n2 * (exp( (tmid2-x) / scal2) )^(1/n2) ) ) ) ) which is a sum of the generalized logistic model proposed by richards. with data such as these: x <- c(88,113,128,143,157,172,184,198,210,226,240,249,263,284,302,340) y <-
2009 Jun 11
1
Error in 1:p : NA/NaN argument when running model comparisons
Hi there, I am trying to compare nonlinear least squares regression with AIC and anova. The simplest model is one nonlinear curve, and in the more complex model I have a categorical variable (producing parameter estimates for four curves). Both models run fine, but when I try to produce an AIC value for the second model I get the error: > AIC(pow.nls1) [1] 114408.3 > AIC(pow.nls2) Error in
2004 Jul 22
1
package nls2 for windows
Dear Madam or sir, Does anyone know if there is a pre-compiled version of package nls2 for windows, please? Thank you. Souleymane
2011 Dec 28
2
convert variable types when creating data frame from cor.test results
Dear list, The below dataset and code creates a new dataset with the results from the function cor.test being performed on each individual ('Individual_ID') from my original dataset. How do I convert each variable from the cor.test results to a numeric data type, as it is passed into the new dataframe? For example, 'estimate', 'p.value', and 'conf.int' should be
2004 Jan 02
2
SEM help!!!
I have just started using the SEM package in R, so I'm not sure I'm doing everything right, but I keep getting an error concerning startvalues and I can't figure out how to fix it. Is anyone willing to read over my code and help me out??? Please email me if you are willing to look at my code and I will send it to you. Thank you so much, and Happy New Year! cathy
2004 Sep 29
2
optim "a log-likelihood function"
Hello, i know that i have to use optim, but i'm confused how its possible maximize the sum over all l[i] and get the optimized max(LL), r and alpha? LL <- function(trans,time){ for(i in 1:length(trans){ l[i] <- log(lgamma(r+trans[i] - gamma(r+1)*(alpha/alpha+t[i]))**r)*(t[i]/alpha+t[i]))**trans[i] } return(sum(l)) } i'm confused how i have to set r and alpha and i
2005 Mar 08
4
Non-linear minimization
hello, I have got some trouble with R functions nlm(), nls() or optim() : I would like to fit 3 parameters which must stay in a precise interval. For exemple with nlm() : fn<-function(p) sum((dN-estdata(p[1],p[2],p[3]))^2) out<-nlm(fn, p=c(4, 17, 5), hessian=TRUE,print.level=2) with estdata() a function which returns value to fit with dN (observed data vactor) My problem is that only
2010 Jul 06
1
nls + quasi-poisson distribution
Hello R-helpers, I would like to fit a non-linear function to data (Discrete X axis, over-dispersed Poisson values on the Y axis). I found the functions gnlr in the gnlm package from Jim Lindsey: this can handle nonlinear regression equations for the parameters of Poisson and negative binomial distributions, among others. I also found the function nls2 in the software package
2008 Apr 26
1
integration error when I use "optim" and "integrate" simultaneously
Dear R users, When I use two functions, 'optim' and 'integrate', simultaneously, I always get an error like this -------------------------------------------------------------------------- numint = function(z) { dlnorm(z,mu[1],sqrt(exp(g[1]))) * dnorm((z-mu[2])/sqrt(exp(g[2])))/sqrt(exp(g[2])) } integrate(numint,lower=0,upper=Inf)$value Error in integrate(numint, lower = 0,
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) >
2004 May 12
1
Sem error - subscript out of bounds
What??s happening with this following code: require(sem) Celpe.Mod.RAM <- matrix(c( # path parametro Inicio "Produ????o -> T1", "gamma.11", NA, "Produ????o -> T2", "gamma.12", NA,
2005 Jun 01
1
nls(() and trace
hi everybody, is there a canonical way to get hold of the "trace=TRUE" output from nls, i.e. to copy it to a R variable (or at least to an external log file)? I have only found the possibility to "fix(nlsModel)" (and than the correct copy of that: namespace function ...) within the R-session by modifying the trace() definition within nlsModel. not really good for everyday