[R] Strange problem.

Yannong.Dong-1 Yannong.Dong-1 at ou.edu
Tue Sep 2 03:20:49 CEST 2003


Hi, everyone,
    I am a new user of R. Recently, I tried the following commands, but couldn't make them work. If any one of you has some ideas about it, please help me. The commands are

>std<-1000
>mean<-8000
>prior<-function(n){1/(sqrt(2*pi)*std)*exp(-1.0*(n-mean)^2/(2*std^2))}
>plot(prior,1,15000)
>post<-function(n){
+ if(n < 9543) 
+  0
+ else
+  prior(n)/n
+ }
>plot(post,1,15000)  # This command didn't work. The error message is " x and y lengths differ "

I was really confused about it because the first function "prior" can work well. I think I must make something wrong stupidly, but could not find it. If you can help me about it, it would be very helpful. Thanx a lot in advance.

   Rgds, 
   Yannong Dong




More information about the R-help mailing list