On Mon, 1 Sep 2003, Yannong.Dong-1 wrote: > >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 "
Try replacing the post() function with something like: post<-function(n){ ifelse(n < 9543, 0, prior(n) / n) } -- Cheers, Kevin ------------------------------------------------------------------------------ "On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." -- Charles Babbage (1791-1871) ---- From Computer Stupidities: http://rinkworks.com/stupid/ -- Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki) ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help