[R] How to generate a matrix of Beta or Binomial distribution

2012-08-27 Thread JeffND
Hi folks, I have a question about how to efficiently produce random numbers from Beta and Binomial distributions. For Beta distribution, suppose we have two shape vectors shape1 and shape2. I hope to generate a 1 x 2 matrix X whose i th rwo is a sample from reta(2,shape1[i]mshape2[i]). Of

Re: [R] How to generate a matrix of Beta or Binomial distribution

2012-08-27 Thread JeffND
Dear Michael, Thanks very much for your explicit explanation! That makes much sense. Best wishes, Jeff -- View this message in context: http://r.789695.n4.nabble.com/How-to-generate-a-matrix-of-Beta-or-Binomial-distribution-tp4641422p4641472.html Sent from the R help mailing list archive

Re: [R] how to add a variable to a graph title

2012-07-13 Thread JeffND
Thank you for this useful code! -- View this message in context: http://r.789695.n4.nabble.com/how-to-add-a-variable-to-a-graph-title-tp4636364p4636405.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] how to add a variable to a graph title

2012-07-12 Thread JeffND
Hi folks, To simplify my question, consider an example: x=runif(1,0,1) plot(1:5,1:5) Now I want to add a title to the above plot showing the vaue of x, so if the generated x is 0.3, graphically the tile should be like Figure 1: x=0.3. How do I achieve this in R? Thanks. Jeff -- View this

Re: [R] Local linear regression

2012-06-21 Thread JeffND
locpoly() might be useful -- View this message in context: http://r.789695.n4.nabble.com/Local-linear-regression-tp4512566p4634166.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] How to find eigenfunctions and eigenvalues of a fourth order ODE

2012-04-27 Thread JeffND
Dear all, I am having trouble with the following problem. Suppose we have the fourth order ODE with boundary conditions: http://r.789695.n4.nabble.com/file/n4591748/problem.jpg problem.jpg where q(t) is a known function. Note here the lambda parameter is changing, so essentially we have a

Re: [R] efficiently finding the integrals of a sequence of functions

2011-12-11 Thread JeffND
Thanks,Hans! I agree that this is a good way of solving this problem. Here is another way. Instead of defining a vector of uni-dimensional functions and trying to integrating each component (a uni-dimensional function), we can do something below my.integrand-function(x,k) { return(f[x,k]) ##

[R] efficiently finding the integrals of a sequence of functions

2011-12-10 Thread JeffND
Hi folks, I am having a question about efficiently finding the integrals of a list of functions. To be specific, here is a simple example showing my question. Suppose we have a function f defined by f-function(x,y,z) c(x,y^2,z^3) Thus, f is actually corresponding to three uni-dimensional

Re: [R] Overlaying density plot on forest plot

2011-12-10 Thread JeffND
Frank, Have you tried the R function overlay(), it is exactly applying to your question. Jeff -- View this message in context: http://r.789695.n4.nabble.com/Overlaying-density-plot-on-forest-plot-tp4179654p4180430.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Regression Models

2011-12-10 Thread JeffND
So your question is about fitting a regression model for all the subsets of predictors? Then there would be 2^13 submodesl? Probably leaps() does what you want. This function does a all-subset regresion. -- View this message in context:

Re: [R] A question about R image function

2011-11-23 Thread JeffND
Hi Sarah, Thanks a lot! You are right, my data is not over a regular grid cell locations. One advantage of image() is that it can produce continuous color change for the data value. When the data value is over a large range, this will make it more convenient. Thanks! Jeff -- View this message

Re: [R] Using GIS data in R

2011-11-20 Thread JeffND
Hi Rolf, I have a similar question. I want to test whether a point with certain coordinates is inside a state, say Texas. It seems that inside.owin() only works for testing if a point lies in a regular region, say a polygon. Since Texas has irregular boundary, how do we achieve this? Or there is

[R] how to use quadrature to integrate some complicated functions

2011-11-06 Thread JeffND
Hello to all, I am having trouble with intregrating a complicated uni-dimensional function of the following form Phi(x-a_1)*Phi(x-a_2)*...*Phi(x-a_{n-1})*phi(x-a_n). Here n is about 5000, Phi is the cumulative distribution function of standard normal, phi is the density function of standard

[R] ploting pie charts centered at given points

2011-10-12 Thread JeffND
Hi to all, Suppose we have a group of points on the plane, at each point, we want to draw a pie chart centered at that point. I have found that pie.labels() function might be useful. This function allows us to achieve my goal, but before using the function, we have to use the function plot(),

[R] A question about R image function

2011-10-05 Thread JeffND
Dear folks, I have a question about the image() function in R. I found the following link talking about this but the replies didn't help with my situations. http://r.789695.n4.nabble.com/question-on-image-function-td839275.html#a839276 To be simple, I will keep using the example in the above