[R] multivariate distributions
Hi, How can I generate data from multivariate gamma distribution & multivariate beta distribution? I only found command for multivariate normal only. Many thanks in advance :) Regards Rofizah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] scatter plot & equation
Many thanks Duncan. I got the plot even I don't really understand the whole command.. I will study that later.. :-) Regards On Sun, Nov 22, 2009 at 4:44 PM, Duncan Murdoch wrote: > On 22/11/2009 11:27 AM, Rofizah Mohammad wrote: > >> Hi, >> >> If I have 2D data set say (x,y) and I can do scatter plot by using >> plot(x,y) >> command. >> How can I add in this scatter plot the equations curve say >> >> 2X2 + 3Y2 6X 7Y + 9 = 0. >> > > You could do it using contour(), but you should use an equation that has > some real solutions. For example, using a different equation than yours: > > x <- rnorm(100, sd=1) > y <- rnorm(100, sd=1) > xgrid <- seq(min(x), max(x), len=100) > ygrid <- seq(min(y), max(y), len=120) > grid <- expand.grid(x=xgrid, y=ygrid) > LHS <- function(x, y) x^2 + y^2 - x - y - 1 > z <- apply(grid, 1, function(x) LHS(x[1], x[2]) ) > z <- matrix(z, 100, 120) > plot(x,y) > contour(xgrid, ygrid, z, levels=0, add=TRUE) > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] scatter plot & equation
Hi, If I have 2D data set say (x,y) and I can do scatter plot by using plot(x,y) command. How can I add in this scatter plot the equations curve say 2X2 + 3Y2 6X 7Y + 9 = 0. Regards Rofizah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Plotting implicit functions in R
Hello, How can I plot several implicit functions (F(x,y)=0) on the same figure? Regards Rofizah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Creating Sub-Matrix
Many thanks David :-) I think I got that idea :-) On Sat, Jan 31, 2009 at 2:16 PM, David Winsemius wrote: > Several ways, two are shown: > > matrix(1:(4*7), 4,7) > [,1] [,2] [,3] [,4] [,5] [,6] [,7] > [1,]159 13 17 21 25 > [2,]26 10 14 18 22 26 > [3,]37 11 15 19 23 27 > [4,]48 12 16 20 24 28 > > mtx <- matrix(1:(4*7), 4,7) > > > mtx[-1,] > [,1] [,2] [,3] [,4] [,5] [,6] [,7] > [1,]26 10 14 18 22 26 > [2,]37 11 15 19 23 27 > [3,]48 12 16 20 24 28 > > mtx[2:4, ] > [,1] [,2] [,3] [,4] [,5] [,6] [,7] > [1,]26 10 14 18 22 26 > [2,]37 11 15 19 23 27 > [3,]48 12 16 20 24 28 > > Search terms: > --- at the R prompt > ?Extract > ?"[" #gets to the same page > > --- in other sites: > indexing > > -- David Winsemius > > > On Jan 31, 2009, at 8:25 AM, Rofizah Mohammad wrote: > > Hello, >> >> How do I get sub-matrix? Example, I would like to get matrix of size 3x7 >> from the matrix of size 4x7. Meaning that I try to exclude one row of the >> original matrix. >> >> Thanks >> -rofizah- >> >>[[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Creating Sub-Matrix
Hello, How do I get sub-matrix? Example, I would like to get matrix of size 3x7 from the matrix of size 4x7. Meaning that I try to exclude one row of the original matrix. Thanks -rofizah- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.