Displaying 18 results from an estimated 18 matches similar to: "non-linear fitting (nls) and confidence limits"
2007 Aug 23
0
weighted nls and confidence intervals
for unweighted fits using `nls' I compute confidence intervals for the
fitted model function by using:
#-------------------
se.fit <- sqrt(apply(rr$m$gradient(), 1, function(x) sum(vcov(rr)*outer(x,x))))
luconf <- yfit + outer(se.fit, qnorm(c(probex, 1 - probex)))
#-------------------
where `rr' contains an `nls' object, `x' is the independent variable vector,
`yfit'
2007 Aug 31
0
non-linear fitting (nls) and confidence limits
dear list members,
I apologize in advance for posting a second time, but probably after one
week chances are, the first try went down the sink..
my question concerns computation of confidence intervals in nonlinear fits
with `nls' when weigthing the fit. the seemingly correct procedure does not
work as expected, as is detailed in my original post below.
any remarks appreciated.
greetings
2010 Jan 18
5
errors appears in my time Series regression fomula
Dear all,
I found really difficult with the time series questions, please help me with this monthly airline series!
I have run the following r code, and there is an error appeared at the end. The data files was enclosed in the email.
I'm sorry the errors message appeared in chinese, but it says "plot.xy(xy.coords(x, y), type = type, ...) :
errors in argument has more than 3
2006 Jul 03
0
Questions concerning function 'svm' in e1071 package
Greetings everyone,
I have the following problem (illustrating R-code at bottom of mail):
Given a training sample with binary outcomes (-1/+1), I train a linear
Support Vector Machine to separate them. Afterwards, I compute the
weight vector w in the usual way, and obtain the fitted values as
w'x + b > 0 ==> yfitted = 1, otherwise -1.
However, upon verifying with the
1999 Dec 09
1
nlm() problem or MLE problem?
I am trying to do a MLE fit of the weibull to some data, which I attach.
fitweibull<-function()
{
rt<-scan("r/rt/data2/triam1.dat")
rt<-sort(rt)
plot(rt,ppoints(rt))
a<-9
b<-.27
fn<-function(p) -sum( log(dweibull(rt,p[1],p[2])) )
cat("starting -log like=",fn(c(a,b)),"\n")
out<-nlm(fn,p=c(a,b), hessian=TRUE)
2012 Jul 10
1
RGL 3D curvilinear shapes
Dear useRs,
I'm trying to simply fill in the area under a curve using RGL. Here' the set
up:
x <- c(0.75,75.75,150.75,225.75,300.75,375.75,450.75,525.75,600.75,675.75,
0.5,50.5,100.5,150.5,200.5,250.5,300.5,350.5,400.5,450.5,
0.25,25.25,50.25,75.25,100.25,125.25,150.25,175.25,200.25,225.25)
y <- c(0.05,4.91,9.78,14.64,19.51,24.38,29.24,34.11,38.97,43.84,
2004 Aug 25
3
Beginners Question: Make nlm work
Hello,
I'm new to this and am trying to teach myself some R by plotting
biological data. The growth curve in question is supposed to be fitted
to the Verhulst equation, which may be transcribed as follows:
f(x)=a/(1+((a-0.008)/0.008)*exp(-(b*x)))
- for a known population density (0.008) at t(0).
I am trying to rework the example from "An Introduction to R" (p. 72)
for my case and
2010 Apr 30
1
How to generate a distance matrix?
Hi,
I'm trying to generate a distance matrix between sample pairs (example
below). I'm not very familiar with the loop command which I expect I will
need for this. The example below demosntrates what I'd like to get out of
the data - essentially, to calculate the proportion of positions where two
samples differ.
Any help much appreciated! Also, any notes on how the functions work
2009 Oct 09
1
Substituting the extracted coefficients into the formula, exctracted from the result of nls()
Dear all,
Here I come with another stupid question. Suppose I want to use nls()
to fit a series of data (here modelled by generated points), then plot
the points and the fitting curve. I figured out some way of doing it:
x <- runif(1:20, 0, 10)
y <- 0.1*x^2 - rep(3, length(x)) + rnorm(length(x), sd = 0.5)
yfit <- nls(y ~ a*x^2 + b*x + c,
start = list(a = 1, b = 1, c = 1),
2010 Nov 10
1
par mfrow in "function" problem
Hi all,
I defined the following
#############################
myhist=function(x){
hist(x,xlab="",main="")
h=hist(x)
xfit=seq(min(x),max(x),length=100)
yfit=dnorm(xfit,mean(x),sd=sd(x))
yfit=yfit*diff(h$mids[1:2])*length(x)
lines(xfit, yfit, col="blue", lwd=2)
}
#############################
individually, it worked fine
however, if I used
par(mfrow=c(2,2))
2009 Jun 21
2
Help on qpcR package
I am using R on a Windows XP professional platform.
The following code is part of a bigger one
CODE
press=function(y,x){
library(qpcR)
models.press=numeric(0)
cat("\n")
dep=y
print(dep)
indep=log(x)
print(indep)
yfit=dep-PRESS(lm(dep~indep))[[2]]
cat("\n yfit\n")
print(yfit)
yfit.orig=yfit
presid=y-yfit.orig
press=sum(presid^2)
2009 Sep 02
2
Howto fit normal curve into histogram using GGPLOT2
Currently, I am doing it this way.
x <- mtcars$mpg
h<-hist(x, breaks=10, col="red", xlab="Miles Per Gallon",
main="Histogram with Normal Curve")
xfit<-seq(min(x),max(x),length=40)
yfit<-dnorm(xfit,mean=mean(x),sd=sd(x))
yfit <- yfit*diff(h$mids[1:2])*length(x)
lines(xfit, yfit, col="blue", lwd=2)
But since, ggplot2 has more appealing
2012 Aug 24
0
A question about GRAMMAR calculations in the FAM_MDR algorithm
Dear R developers:
I am a PHD candidate student in the school of public health of Peking
University and my major is genetic epidemiology. I am learning the FAM-MDR
algorithm, which is used to detect the gene-gene and gene-environment
interactions in the data of pedigree. The codes were written by Tom
Cattaert of the University of Liege. The algorithms and the sample datasets
are available at
2004 Aug 24
0
additional examples for R-intro.texi (PR#7195)
Here are some patches to expand some of the examples in R-intro.texi.
--
Brian Gough
Network Theory Ltd,
Publishing the R Reference Manuals --- http://www.network-theory.co.uk/R/
--- R-intro.texi~ Tue Aug 24 11:21:37 2004
+++ R-intro.texi Tue Aug 24 11:21:37 2004
@@ -6288,6 +6288,21 @@
use
@example
+> help(package = "@var{name}")
+@end example
+
+A complete list of the
2005 Oct 14
1
lattice with predicted values
Dear lattice wizards,
I am trying to figure out how to plot predicted values in xyplot,
where the intercept, but not the slope, varies among conditioning
factor levels. I am sure it involves the groups, but I have been
unsuccessful in my search in Pinhiero and Bate, in the help files, or
in the archive, or in my attempts on my own.
My example follows:
FACT is a factor with levels a,b,c
2010 Feb 19
1
"Legend" question
Hi,
I want to get a histogram with the legend for my data. I drew a normal density curve and kernel density curve in the histogram, and I also label mean and median in the X axis. From the code, I got two legend: One shows "Normal Density" and "Kernel Density" and their corresponding lines, the other shows "Mean = value" and "Median = value" and their
2011 Oct 21
2
Arima Models - Error and jump error
Hi people,
I´m trying to development a simple routine to run many Arima models result
from some parâmeters combination.
My data test have one year and daily level.
A part of routine is:
for ( d in 0:1 )
{ for ( p in 0:3 )
{ for ( q in 0:3 )
{ for ( sd in 0:1 )
{ for ( sp in 0:3 )
{ for ( sq in 0:3 )
{
2007 Jun 07
2
Nonlinear Regression
Hello
I followed the example in page 59, chapter 11 of the 'Introduction to R'
manual. I entered my own x,y data. I used the least squares. My function has
5 parameters: p[1], p[2], p[3], p[4], p[5]. I plotted the x-y data. Then I
used lines(spline(xfit,yfit)) to overlay best curves on the data while
changing the parameters. My question is how do I calculate the residual sum
of squares.