Displaying 20 results from an estimated 1100 matches similar to: ""Legend" question"
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 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
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
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.
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
2001 Oct 13
2
hist and normal curve
Dear R people:
I would like to superimpose a normal curve on a histogram.
I've seen this example in a book, somewhere.
I know that you draw the hist, get the mean and sd
of the data set, but then I'm stuck.
Could you help, please?
Thanks!
Erin
hodgess at uhddx01.dt.uh.edu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
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)
2005 Sep 25
4
hist(x, ...) with normal distribution curve
.
I am looking for a histogram or box plot with the adding normal
distribution curve
I think that must be possible, but I am not able to find out how to do.
Regards Knut
2000 Nov 09
2
simple mixture
Dear All,
I am trying to do some simple mixture analyses. For instance, I have a
sample of n observations and I suspect they come from two different
exponential distributions with parameters rate1 and rate2, respectively.
So, I want to estimate rate1, rate2, and the proportions of both kinds of
individuals in the sample. I had a look at the packages mda and mclust, but
they do not seem to do this
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),
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)
2005 Oct 14
2
Help with lattice, regressions and respective lines
# Dear R list,
#
# I'm needing help with lattice, regression and respective lines.
# My data is below:
bra = gl(2, 24, label = c('c', 's'))
em = rep(gl(3, 8, label = c('po', 'pov', 'ce')), 2)
tem = rep(c(0, 0, 30, 30, 60, 60, 90, 90), 6)
tem2 = tem^2
r = rep(1:2, 24)
y = c(40.58, 44.85, 32.55, 35.68, 64.86, 51.95, 42.52, 52.21,
2005 Aug 12
6
evaluating string variables
Hello!!!
I have a folder (C:/R/) with matrix files, named by number, i.e.
0.mat, 1.mat,...,1250.mat. In this case, they are 5x5 simetric
matrices. I would like to compute a property for each matrix and put
calculated values into a data frame for posterior ploting and
printing. Below there is an example for 7 matrices (0.mat..6.mat)
#define data frame
L <- data.frame(frame=numeric(7),
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 )
{
2009 Jan 13
0
[Re: CDR Rewrite -- Questions to the users]
Benny--
Thanks for the response! I've inserted comments in the following:
PS. Pardon the HTML format; my email editor splits lines at an
unadjustably
small number of columns, but in HTML, no line length limits, and better
looking examples!
On Tue, 2009-01-13 at 14:16 +0100, Benny Amorsen wrote:
> Steve Murphy <murf at digium.com> writes:
>
> > Which of the two would
2012 Jan 02
1
sm.density.compare - a lot of curves
Dear all,
Let say I have a sets of numbers:
rno1 = rnorm(1000)
rno2 = rnorm(1000)
If I write request as follow:
sm.density.compare (rno, rno3, xfit=min(rno), max(rno2))
why I receive a lot of curves in my plot, while I have only two data sets?
regards
Przemek
--
View this message in context: http://r.789695.n4.nabble.com/sm-density-compare-a-lot-of-curves-tp4253039p4253039.html
Sent from the
2013 Jun 19
1
nls singular gradient ..as always..
Hi all. Sorry for posting again such a topic but I went through previous
posts but couldn't find a solution.
I use the following code to fit an exponential model to my data. I have 4
different datasets. For 3 datasets nls seems to work fine and I have no
error messages. But for 1 dataset I am getting the "world known" singular
gradient error.
xfit.dNEE <-
2009 Jan 12
6
CDR Rewrite -- Questions to the users
Hello!
Most are probably bored seeing another letter about this,
but I've put in a fair amount work on a spec for rewriting
the CDR system in Asterisk, and I have some questions:
First, please look at what I've written so far:
svn co http://svn.digium.com/svn/asterisk/team/murf/RFCs
and look at the file "CDRfix2.rfc.txt" in the RFCs dir.
The spec SIGNIFICANTLY alters the way
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
2009 Oct 25
1
lsfit residuals
I'm trying to extract the points above and below a particular lsfit. I
can only get the residuals from the original fit though.
x = runif(100, 0, 10)
plot(x)
abline(lsfit(1:100, test))
abline(lsfit(1:100, test + sd(test))) #I want the points above THIS
line.
Is there a way to use the coefficients from the fit to do this?
Thanks for any help.