[R] plotting gaussian data

2006-06-13 Thread H. Paul Benton
Ok I guess it's time to ask. 
So I want to plot my data. It's my data from a frequency table, temp. My
formula is just a Gaussian eq. I have done the nls function to get my
parameters and now I want to do the whole plot (...) and then lines(..)
This is what I have done. 

 temp
bin   x
1  -4.0   0
2  -3.9   0
3  -3.8   0
4  -3.7   0
5  -3.6   0
6  -3.5   0  and so on
 fo
x ~ (A/(sig * sqrt(2 * pi))) * exp(-1 * ((bin - mu)^2/(2 * sig^2)))
 fo.v
x ~ (335.48/(0.174 * sqrt(2 * pi))) * exp(-1 * ((bin - (-0.0786))^2/(2 * 
0.174^2)))
 coef
$A
[1] 335.4812

$mu
[1] -0.07863746

$sig
[1] 0.1746473

plot(fo, temp, coef)
Error in eval(expr, envir, enclos) : object sig not found
 plot(fo, coef, temp)
Error in eval(expr, envir, enclos) : object x not found
 plot(fo, temp, list=coef)


If someone could point me in the right direction I would be very grateful. 

Cheers,

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] plotting gaussian data

2006-06-13 Thread Jacques VESLOT
curve(coef$A * dnorm(x, coef$mu, coef$sig), -4, 4)

---
Jacques VESLOT

CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex

Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31

http://www-good.ibl.fr
---


H. Paul Benton a écrit :
 Ok I guess it's time to ask. 
 So I want to plot my data. It's my data from a frequency table, temp. My
 formula is just a Gaussian eq. I have done the nls function to get my
 parameters and now I want to do the whole plot (...) and then lines(..)
 This is what I have done. 
 
 
temp
 
 bin   x
 1  -4.0   0
 2  -3.9   0
 3  -3.8   0
 4  -3.7   0
 5  -3.6   0
 6  -3.5   0  and so on
 
fo
 
 x ~ (A/(sig * sqrt(2 * pi))) * exp(-1 * ((bin - mu)^2/(2 * sig^2)))
 
fo.v
 
 x ~ (335.48/(0.174 * sqrt(2 * pi))) * exp(-1 * ((bin - (-0.0786))^2/(2 * 
 0.174^2)))
 
coef
 
 $A
 [1] 335.4812
 
 $mu
 [1] -0.07863746
 
 $sig
 [1] 0.1746473
 
 plot(fo, temp, coef)
 Error in eval(expr, envir, enclos) : object sig not found
 
plot(fo, coef, temp)
 
 Error in eval(expr, envir, enclos) : object x not found
 
plot(fo, temp, list=coef)

 
 
 If someone could point me in the right direction I would be very grateful. 
 
 Cheers,
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html