Displaying 8 results from an estimated 8 matches for "nlsfit".
Did you mean:
lsfit
2011 Aug 02
1
How to 'mute' a function (like confint())
Dear R-helpers,
I am using confint() within a function, and I want to turn off the message
it prints:
x <- rnorm(100)
y <- x^1.1+rnorm(100)
nlsfit <- nls(y ~ g0*x^g1, start=list(g0=1,g1=1))
> confint(nlsfit)
Waiting for profiling to be done...
2.5% 97.5%
g0 0.4484198 1.143761
g1 1.0380479 2.370057
I cannot find any way to turn off 'Waiting for. .."
I tried
options(max.print=0)
and even
sink(tempfile())
confin...
2012 Jun 28
1
add constraints to nls or use another function
...-------------------------------------------------------
#The experimental data :
http://r.789695.n4.nabble.com/file/n4634705/nlstest_data.txt
nlstest_data.txt
#The script
library(lattice)
dftest<-read.table("nlstest_data.txt", sep=";", dec=".", as.is=T, header=T)
nlsfit<-coefficients(nls(y ~
F+A*(x-1)+B*log(x)+C*(x-1)*(x-1)+D*log(x)*log(x), data=dftest, start =
list(A=-0.06,B=0.48,C=0.89,D=0.03,F=1), control=list(maxiter=200,
tol=0.01)))
# Coefficients :
# A B C
D F
# -...
2012 Jul 11
2
nls problem: singular gradient
...######
# define some constants
smallc <- 0.0001
t <- seq(0,1,0.001)
t0 <- 0.5
tau1 <- 0.02
# generate yy(t)
yy <- 1/2 * ( 1- tanh((t - t0)/smallc) * exp(-t / tau1) ) + rnorm(length(t))*0.01
# show the curve
plot(x=t, y=yy, pch=18)
# prepare data
dd <- data.frame(y=yy, x=t)
nlsfit <- nls(data=dd, y ~ 1/2 * ( 1- tanh((x - ttt)/smallc) * exp(-x / tau2) ), start=list(ttt=0.4, tau2=0.1) , trace=TRUE)
# get error:
# Error in nls(data = dd, y ~ 1/2 * (1 - tanh((x - ttt)/smallc) * exp(-x/tau2)), :
# singular gradient
--
Jonas Stein <news at jonasstein.de>
2003 Nov 25
5
Parameter estimation in nls
...ta.
This is my data set:
y <- c(37047647,27083970,23944887,22536157,20133224,
20088720,18774883,18415648,17103717,13580739,12350767,
8682289,7496355,7248810,7022120,6396495,6262477,6005496,
5065887,4594147,2853307,2745322,454572,448397,275136,268771)
and this is the fit I'm trying to do:
nlsfit <- nls(y ~ a * x^k * b^x, start=list(a=5,k=1,b=3))
(It's a Yule distribution.)
However, I keep getting:
"Error in nls(y ~ a * x^k * b^x, start = list(a = 5, k = 1, b = 3)) :
singular gradient"
I guess this has something to do with the parameter start values.
I was wondering,...
2000 Nov 28
4
random number generator
I have an inquire about the RNG in R
It is known that when we use the " rnorm " function , we pass the
arguments :
1- number of variables to be generated
2- mean vector of the normal random errors.
3- standard deviation vector of the normal random errors.
my question is the following
Is the a way (a function) in R that we could specify the covariance
matrix in step 3, instead of the
2011 May 01
1
Urgent: conditional formula for nls
I have data vectors x and y both with 179 observations. I'm trying to
fit a nonlinear model with five parameters using nls. The formula is
only defined within a range of x-values, it should be zero otherwise,
thus my attempted use of ifelse:
> df<-data.frame(x,y)
> nlsfit<-nls(y~ifelse(x>m&x<m+abs(s),abs(a)*d*abs(s)*exp(-(1/2)*(g+d*log((x-m)/(-x+m+abs(s)))^2))/(sqrt(2*pi)*(x-m)*(-x+m+abs(s))),0),data=df,start=list(a=0.37,g=0,d=1,m=0.42,s=0.24))
Error in nlsModel(formula, mf, start, wts) :
singular gradient matrix at initial parameter estimates
In addi...
2011 Oct 11
1
singular gradient error in nls
...#convert to seconds
b2 <- 1-(0.196/(0.06/0.01131)) #relationship between soil moisture and the
size of the ring infiltrometer (6 cm radius by 113.1 cm2 cross sectional
area)
theta <- 0.196 #difference in residual soil water and field capacity
Here is the formula:
#Where a = K_fs and b=psi_f
nlsfit <-
nls(time.s~(theta/a*b2)*((cumul.m/theta)-(((0.16-b)/b2)*log(1+((cumul.m*b2)/(theta*(0.16-b)))))),
data = df, start=list (a=1, b=0.5), trace=TRUE)
-----
I am likely "over parameterizing", but I must admit, that I am not entirely
sure what that means. Any help offered would be great...
2002 Oct 30
0
extracting Std. Error value from lm/nls
...d coefficient,
its standard error, t-statistic and corresponding (two-
sided) p-value.
so try summary(fit.lm)$coefficients[,1:2] to get the coefficients and their
SEs.
For nls, it takes a bit more digging, as the documentation is a bit sparse.
Something like:
summary(nlsfit)$parameters[,1:2]
will give what you want.
Cheers,
Andy
-----Original Message-----
From: Antonio Olinto [mailto:aolinto at bignet.com.br]
Sent: Wednesday, October 30, 2002 11:05 AM
To: R-Help
Subject: [R] extracting Std. Error value from lm/nls
Hi,
How to extract Std. Error values from a lm o...