Re: [R] Some Unicode symbols are missing
I think, I succeeded in doing it with Hershey fonts: plot(0,0,xlim=c(0,2),ylim=c(0,2)) text(1,1,"\\#H2380",vfont=c("serif", "plain")) This is ok now! Atte T. 14.8.2017, 9.16, Atte Tenkanen kirjoitti: Hi, I would like to draw some Unicode symbols like G- and f-clefs (used in music notation) in quartz-window. I succeed in producing sharp #,: plot(0,0,xlim=c(0,2),ylim=c(0,2)) points(1,1, pch="\u266F",cex=2) But for instance "b" (flat accidental) u266D and those clefs doesn't work. G-clef is said to be UTF-8: F0 9D 84 9E UTF-16: D834 DD1E Code point: U+1D11E I have loaded package extrafont and tried everything found in internet without success. Font issues stay mysterious to me ... My system is OSX 10.12.6, R 3.3.3. -- Atte Tenkanen, FT MuM Turun Martinseurakunnan kanttori p. 040-3417125 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Some Unicode symbols are missing
Hi, I would like to draw some Unicode symbols like G- and f-clefs (used in music notation) in quartz-window. I succeed in producing sharp #,: plot(0,0,xlim=c(0,2),ylim=c(0,2)) points(1,1, pch="\u266F",cex=2) But for instance "b" (flat accidental) u266D and those clefs doesn't work. G-clef is said to be UTF-8: F0 9D 84 9E UTF-16: D834 DD1E Code point: U+1D11E I have loaded package extrafont and tried everything found in internet without success. Font issues stay mysterious to me ... My system is OSX 10.12.6, R 3.3.3. -- Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Layer problem in DrawDensity3D (VecStatGraphs3D)
Hi, When plotting the density estimation with DrawDensity3D-function (in package VecStatGraphs3D) it often happens that the end product ie. layers are not intact , see figure in the link: https://www.dropbox.com/s/vzyaiu0vso8hjw2/20623868_1021234554853_1371245353_n.png?dl=0 Can we somehow effect on that an get intact layers? -- Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Larger rgl-images?
Hi, In package ‘VecStatGraphs3D’ is a DrawDensity3D-function in which the rgl-device size is defined as r3dDefaults$windowRect=c(0,0, WSizeWidth, WSizeHeight). To save, for instance, a png-snapshot, we can use rgl.snapshot()-function. The size of the file is dependent on the window and thus your screen and video card. Can we somehow produce larger images virtually, for example, 4k-images (3840x2160)? Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Getting scan() -command to work during the program run
Hi Bert, I tried using the function, but still the same problem. If there is something after the scan-line, scan does not let me to enter any input but the program just run forward like before. I have OSX 10.9.5. and R 3.3.2. Atte 20.12.2016, 17.19, Bert Gunter kirjoitti: ?? f <- function() {X <- scan(n =1); X} f() 1: 3 Read 1 item -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Dec 20, 2016 at 12:37 AM, Atte Tenkanen <atte...@utu.fi> wrote: Hi, How to get scan(file="") command to ask my input from the keyboard? If I put the command straight to the console it works X1 <- scan(n=1) 1: 22 Read 1 item but as a part of a program it just continues without asking my value? X1 <- scan(n=1) 1: Read 0 items Yours, Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. -- Atte Tenkanen, FT MuM Turun Martinseurakunnan kanttori p. 040-3417125 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Getting scan() -command to work during the program run
Hi, How to get scan(file="") command to ask my input from the keyboard? If I put the command straight to the console it works > X1 <- scan(n=1) 1: 22 Read 1 item but as a part of a program it just continues without asking my value? > X1 <- scan(n=1) 1: Read 0 items Yours, Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] More tube-like lines3D?
Thanks, time is no problem! Atte 13.9.2016, 15.12, Duncan Murdoch kirjoitti: On 13/09/2016 5:58 AM, Atte Tenkanen wrote: Hi, Is it possible to give 3d-like form for rgl lines3d-lines? Although I increase lwd, lines still look like lines, not like tubes. cylinder3d() should do that. It puts a substantially larger burden on the graphics system, so if you draw too many of them, things will slow down noticeably. Duncan Murdoch -- Atte Tenkanen, FT MuM Turun Martinseurakunnan kanttori p. 040-3417125 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] More tube-like lines3D?
Hi, Is it possible to give 3d-like form for rgl lines3d-lines? Although I increase lwd, lines still look like lines, not like tubes. -- Atte Tenkanen, FT MuM Turun Martinseurakunnan kanttori p. 040-3417125 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] How to set the window size in rgl for full hd resolution
Hi, How can open the window for rgl to use it in making full HD -videos, in which the resolution is 1920 x 1080? Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] About the parameters of rotationMatrix
Oh, thanks... ;-) Atte 21.6.2016, 17.30, Duncan Murdoch kirjoitti: for(i in 1: 10) { a2=i*0.1; b2=i*0.2; c2=i*0.3 print(c(a2,b2,c2)) UserMatrix = rotationMatrix(pi/4,a2,b2,c2) print(UserMatrix) } __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] About the parameters of rotationMatrix
Hi, Why does this not work? The values inside the rotationMatrix() doesn't seem to change: library(rgl) for(i in 1: 10) { a2=i*0.1; b2=i*0.2; c2=i*0.3 print(c(a2,b2,c2)) UserMatrix = rotationMatrix(pi/4,a2,b2,c2) print(UserMatrix) } Yours, Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Same sum, different sets of integers
Thanks for the suggestions, all of you! I first began to think about using somehow permutations of the gtools-package. I will continue utilizing Peter's solution. My purpose is to divide basic musical rhythm units (whole note, half note, quarter note etc durations) to meaningful entities in algorithmic composition. I use R for that. Usually, there are - in the composition algorithm - random number generators, which "composes" different versions of music. Those RNG's (sample in R) can be - for their part - conducted by using different constraints and probabilities. Here I draw rhythms. For example, if my quarter note (1/4) is 1024 ticks in MIDI format, I may like to split it into quintuples, ie. five units, using ties differently: 1024*c(1/5, 4/5), 1024*c(2/5, 3/5),... This way I can produce and output rich and still usable rhythms to music notation software, keep the rhythmic entities playable and readable over barlines. Yours, Atte 28.4.2016, 5.00, Peter Langfelder kirjoitti: I came up with this, using recursion. Short and should work for n greater than 9 :) Peter sumsToN = function(n) { if (n==1) return(1); out = lapply(1:(n-1), function(i) { s1 = sumsToN(n-i); lapply(s1, c, i) }) c(n, unlist(out, recursive = FALSE)); } sumsToN(4) [[1]] [1] 4 [[2]] [1] 3 1 [[3]] [1] 2 1 1 [[4]] [1] 1 1 1 1 [[5]] [1] 1 2 1 [[6]] [1] 2 2 [[7]] [1] 1 1 2 [[8]] [1] 1 3 sumsToN(5) [[1]] [1] 5 [[2]] [1] 4 1 [[3]] [1] 3 1 1 [[4]] [1] 2 1 1 1 [[5]] [1] 1 1 1 1 1 [[6]] [1] 1 2 1 1 [[7]] [1] 2 2 1 [[8]] [1] 1 1 2 1 [[9]] [1] 1 3 1 [[10]] [1] 3 2 [[11]] [1] 2 1 2 [[12]] [1] 1 1 1 2 [[13]] [1] 1 2 2 [[14]] [1] 2 3 [[15]] [1] 1 1 3 [[16]] [1] 1 4 On Wed, Apr 27, 2016 at 6:10 PM, jim holtman <jholt...@gmail.com> wrote: This is not the most efficient, but gets the idea across. This is the largest sum I can compute on my laptop with 16GB of memory. If I try to set N to 9, I run out of memory due to the size of the expand.grid. N <- 8 # value to add up to # create expand.grid for all combinations and convert to matrix x <- as.matrix(expand.grid(rep(list(0:(N - 1)), N))) # generate rowSums and determine which rows add to N z <- rowSums(x) # now extract those rows, sort and convert to strings to remove dups add2N <- x[z == N, ] strings <- apply( + t(apply(add2N, 1, sort)) # sort + , 1 + , toString + ) # remove dups strings <- strings[!duplicated(strings)] # remove leading zeros strings <- gsub("0, ", "", strings) # print out cat(strings, sep = '\n') 1, 7 2, 6 3, 5 4, 4 1, 1, 6 1, 2, 5 1, 3, 4 2, 2, 4 2, 3, 3 1, 1, 1, 5 1, 1, 2, 4 1, 1, 3, 3 1, 2, 2, 3 2, 2, 2, 2 1, 1, 1, 1, 4 1, 1, 1, 2, 3 1, 1, 2, 2, 2 1, 1, 1, 1, 1, 3 1, 1, 1, 1, 2, 2 1, 1, 1, 1, 1, 1, 2 1, 1, 1, 1, 1, 1, 1, 1 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Apr 27, 2016 at 11:46 AM, Atte Tenkanen <atte...@utu.fi> wrote: Hi, Do you have ideas, how to find all those different combinations of integers (>0) that produce as a sum, a certain integer. i.e.: if that sum is 3, the possibilities are c(1,1,1), c(1,2), c(2,1) 4, the possibilities are c(1,1,1,1),c(1,1,2),c(1,2,1),c(2,1,1),c(2,2),c(1,3),c(3,1) etc. Best regards, Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Same sum, different sets of integers
Hi, Do you have ideas, how to find all those different combinations of integers (>0) that produce as a sum, a certain integer. i.e.: if that sum is 3, the possibilities are c(1,1,1), c(1,2), c(2,1) 4, the possibilities are c(1,1,1,1),c(1,1,2),c(1,2,1),c(2,1,1),c(2,2),c(1,3),c(3,1) etc. Best regards, Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Mean of hexadecimal numbers
Hm..., Should these two versions produce the same solution? Unfortunately and shame to confess, I don't know much about the colors in R: myColors <- c("#FF7C00","#00BF40","#00") Colors=rgb2hsv(col2rgb(myColors)) apply(Colors,1,mean) h s v 0.2122974 1.000 0.9163399 * * * * * # Average the 1st two by taking the middle colour of a 3 colour palette x <- colorRampPalette(c("#FF7C00","#00BF40"), space = "Lab")(3)[2] # Average in the third by taking the 2nd of a 4 colour palette, so x # gets twice the weight colorRampPalette(c(x, "#00"), space = "Lab")(4)[2] rgb2hsv(col2rgb(colorRampPalette(c(x, "#00"), space = "Lab")(4)[2])) [,1] h 0.1597633 s 0.8407960 v 0.7882353 Atte T. 16.4.2016, 19.03, Duncan Murdoch kirjoitti: On 16/04/2016 8:47 AM, Atte Tenkanen wrote: Hi, How would you calculate the "mean colour" of several colours, for example c("#FF7C00","#00BF40","#00")? Bert answered your subject line question. Your text is asking something else: if those are colours, you don't want to treat each of them as a single integer. A simple-minded approach would split them into 3 hex numbers, and average those (using Bert's solution). A more sophisticated approach would take into account that they are really colours. You could probably put together something using the colorRamp or colorRampPalette functions to average in perception space. For example, # Average the 1st two by taking the middle colour of a 3 colour palette x <- colorRampPalette(c("#FF7C00","#00BF40"), space = "Lab")(3)[2] # Average in the third by taking the 2nd of a 4 colour palette, so x # gets twice the weight colorRampPalette(c(x, "#00"), space = "Lab")(4)[2] Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Mean of hexadecimal numbers
Thanks to William and Bert! Atte 16.4.2016, 18.56, William Dunlap kirjoitti: > Since these are color strings, you can use functions in the grDevices > package (other others) to manipulate them. E.g., you can convert them > to various color spaces and perhaps use the mean in one of those > spaces as your 'average color'. > > > myColors <- c(One="#FF7C00",Two="#00BF40",Three="#00") > > col2rgb(myColors) > One Two Three > red 255 0 255 > green 124 191 255 > blue0 64 0 > > rgb2hsv(col2rgb(myColors)) >One Two Three > h 0.08104575 0.3891798 0.167 > s 1. 1.000 1.000 > v 1. 0.7490196 1.000 > > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com <http://tibco.com> > > On Sat, Apr 16, 2016 at 8:27 AM, Bert Gunter <bgunter.4...@gmail.com > <mailto:bgunter.4...@gmail.com>> wrote: > > ... and if you need to convert back: ?as.hexmode > > > -- Bert > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Sat, Apr 16, 2016 at 8:20 AM, Bert Gunter > <bgunter.4...@gmail.com <mailto:bgunter.4...@gmail.com>> wrote: > > ?strtoi > > > > You'll have to remove the "#" first, e.g. via substring() > > > > -- Bert > > > > > > Bert Gunter > > > > "The trouble with having an open mind is that people keep coming > along > > and sticking things into it." > > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > > > > On Sat, Apr 16, 2016 at 5:47 AM, Atte Tenkanen <atte...@utu.fi > <mailto:atte...@utu.fi>> wrote: > >> Hi, > >> > >> How would you calculate the "mean colour" of several colours, > for example > >> c("#FF7C00","#00BF40","#00")? > >> > >> Yours, > >> > >> Atte Tenkanen > >> > >> __ > >> R-help@r-project.org <mailto:R-help@r-project.org> mailing list > -- To UNSUBSCRIBE and more, see > >> 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-help@r-project.org <mailto:R-help@r-project.org> mailing list -- > To UNSUBSCRIBE and more, see > 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. > > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Mean of hexadecimal numbers
Hi, How would you calculate the "mean colour" of several colours, for example c("#FF7C00","#00BF40","#00")? Yours, Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Question about function DrawDensity3D {VecStatGraphs3D}
Hi, Here is the function DrawDensity3D in package VecStatGraphs3D. My question is: if we use more layers than one, could we change the function in a way that in the final plot only the outmost layer is drawn (the inner layers omitted)? Best regards, Atte Tenkanen function (vectors, Div = 40, Layers = 3, DrawAxes = FALSE) { open3d(windowRect = c(100, 100, 800, 800)) bg3d("white") Cx = vectors[, 1] Cy = vectors[, 2] Cz = vectors[, 3] Cr <- kde3d(x = Cx, y = Cy, z = Cz, n = Div) th <- seq(min(Cr$d), max(Cr$d), len = Layers + 2) ramp <- colorRamp(c("white", "yellow", "red")) colo <- rgb(ramp(seq(0, 1, length = Layers)), maxColorValue = 255) al <- seq(0.1, 0.6, len = Layers) module = sqrt(Cx * Cx + Cy * Cy + Cz * Cz) spheres3d(0, 0, 0, radius = max(module), color = "black", front = "line", back = "line", lwd = 1, smooth = TRUE, lit = TRUE, line_antialias = FALSE, alpha = 0.2) x <- c(0, max(module), 0, 0) y <- c(0, 0, max(module), 0) z <- c(0, 0, 0, max(module)) labels <- c("", "X", "Y", "Z") i <- c(1, 2, 1, 3, 1, 4) text3d(x, y, z, labels, adj = 0.8, cex = 1.5, font = 2, color = "black") segments3d(x[i], y[i], z[i], lwd = 3) rgl.points(x = Cx, y = Cy, z = Cz, size = 3, color = "black") contour3d(Cr$d, level = th[c(-1, -(Layers + 2))], x = Cr$x, y = Cr$y, z = Cr$z, alpha = al, color = colo, add = TRUE, engine = "rgl", fill = TRUE, smooth = 2, material = "shiny") if (DrawAxes == TRUE) { axes3d() } } __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] From KDE-surfaces to 3d-printing format?
Hi, Is it somehow possible to produce 3D-printing data from the kernel density map produced by the "DrawDensity3D"-function of "VecStatGraphs3D"-package? I'm not an expert of KDE-technics, just can use that function to produce surfaces... Best , Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] From KDE-surfaces to 3d-printing format?
Dear Duncan, Thank you! I think, I got conversion working by putting just writeSTL() after the contour3d-function (inside DrawDensity3D()). contour3d() writeSTL("Data3D.stl") At least, the stl-file seems to open in Pleasant3D and ply-file in MeshLab. :-) Best, Atte 27.11.2015, 16.04, Duncan Murdoch kirjoitti: On 27/11/2015 7:24 AM, Atte Tenkanen wrote: Hi, Is it somehow possible to produce 3D-printing data from the kernel density map produced by the "DrawDensity3D"-function of "VecStatGraphs3D"-package? I'm not an expert of KDE-technics, just can use that function to produce surfaces... I don't know about that package, but you can certainly do so using rgl. See ?writeSTL (and the See Also links for other formats). Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Separate point sizes in rgl.points()?
Hi, DrawDensity3D-function in package VecStatGraphs3D utilizes rgl.points-function {rgl}: function (vectors, Div = 40, Layers = 3, DrawAxes = FALSE) { open3d(windowRect = c(100, 100, 800, 800)) bg3d(white) Cx = vectors[, 1] Cy = vectors[, 2] Cz = vectors[, 3] Cr - kde3d(x = Cx, y = Cy, z = Cz, n = Div) th - seq(min(Cr$d), max(Cr$d), len = Layers + 2) ramp - colorRamp(c(white, yellow, red)) colo - rgb(ramp(seq(0, 1, length = Layers)), maxColorValue = 255) al - seq(0.1, 0.6, len = Layers) module = sqrt(Cx * Cx + Cy * Cy + Cz * Cz) spheres3d(0, 0, 0, radius = max(module), color = black, front = line, back = line, lwd = 1, smooth = TRUE, lit = TRUE, line_antialias = FALSE, alpha = 0.2) x - c(0, max(module), 0, 0) y - c(0, 0, max(module), 0) z - c(0, 0, 0, max(module)) labels - c(, X, Y, Z) i - c(1, 2, 1, 3, 1, 4) text3d(x, y, z, labels, adj = 0.8, cex = 1.5, font = 2, color = black) segments3d(x[i], y[i], z[i], lwd = 3) rgl.points(x = Cx, y = Cy, z = Cz, size = 3, color = black) contour3d(Cr$d, level = th[c(-1, -(Layers + 2))], x = Cr$x, y = Cr$y, z = Cr$z, alpha = al, color = colo, add = TRUE, engine = rgl, fill = TRUE, smooth = 2, material = shiny) if (DrawAxes == TRUE) { axes3d() } } Is it somehow possible to define the sizes of the points all separately? I tried by adding ”Psize” to function arguments and changing rgl.points(x = Cx, y = Cy, z = Cz, size = Psize, color = black”), then giving individual point size to each point but this does not work. This does’t work either: for(i in 1:length(Cx)) { rgl.points(x=Cx[i], y=Cz[i], z=Cz[i], size=PSize[i], col= Colors[i]) } Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Opposite color in R
Hi, Nope. My point is that color pairs red-green, yellow-violet and blue-orange are physically on the opposite sides of the wheel. I'm not 100% satisfied with this circle, because three of greens and reds are so near each other. But this is the best solution thus far :-) The number of colors, 24, is also fixed in the application. Atte Hi I plotted the 'spectrum' and it looked a little small - spectrum colours: red orange yellow green blue indigo violet. I suppose you could go to infinite lengths to split it up but is this an improvement? I have not gone into the depths of complimentary colours library(colorspace) ColorsRYB=rbind(colorRamp(c(purple,violet))((0:4)/4)[1:4,], colorRamp(c(violet,blue))((0:4)/4)[1:4,], colorRamp(c(blue,green))((0:4)/4)[1:4,], colorRamp(c(green,yellow))((0:4)/4)[1:4,], colorRamp(c(yellow,orange))((0:4)/4)[1:4,], colorRamp(c(orange,red))((0:4)/4)[1:4,], colorRamp(c(red,purple))((0:4)/4)[1:4,]) LenCol=length(ColorsRYB[,1]) ColorsRYBhex=rep(0, LenCol) for(i in 1: LenCol) { ColorsRYBhex[i]=rgb(ColorsRYB[i,1]/255,ColorsRYB[i,2]/255,ColorsRYB[i,3]/255) } pie(rep(1, LenCol), col = ColorsRYBhex) Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home:mackay at northnet.com.au https://stat.ethz.ch/mailman/listinfo/r-help -Original Message- From: R-help [mailto:r-help-bounces at r-project.org https://stat.ethz.ch/mailman/listinfo/r-help] On Behalf Of Atte Tenkanen Sent: Tuesday, 28 July 2015 18:22 To:r-help at r-project.org https://stat.ethz.ch/mailman/listinfo/r-help Subject: [R] Opposite color in R It seems that there is no implementation for the traditional artist's color circle in R. However I'm searching for such a wheel, because my program needs it. As said, the description of complementary/opposite-function in package colortools is misleading since, for example opposite(green) produces violet, not red, but the description of complementary-function says Complementary or opposite color scheme is formed by colors that are opposite each other on the color wheel (example: red and green). So, there must be just a lapse in the text. I constrained such kind of a color wheel, which is enough near of what I need: library(colorspace) ColorsRYB=rbind(colorRamp(c(red, violet))((0:4)/4)[1:4,],colorRamp(c(violet, blue))((0:4)/4)[1:4,],colorRamp(c(blue, green))((0:4)/4)[1:4,],colorRamp(c(green, yellow))((0:4)/4)[1:4,],colorRamp(c(yellow, orange))((0:4)/4)[1:4,],colorRamp(c(orange, red))((0:4)/4)[1:4,]) LenCol=length(ColorsRYB[,1]) ColorsRYBhex=rep(0, LenCol) for(i in 1: LenCol) { ColorsRYBhex[i]=rgb(ColorsRYB[i,1]/255,ColorsRYB[i,2]/255,ColorsRYB[i,3]/255) } pie(rep(1, 24), col = ColorsRYBhex) Atte T. 28.7.2015, 2.23, Steve Taylor kirjoitti: / I wonder if the hcl colour space is useful? Varying hue while keeping chroma and luminosity constant should give varying colours of perceptually the same colourness and brightness. // // ?hcl // pie(rep(1,12),col=hcl((1:12)*30,c=70),border=NA) // // // -Original Message- // From: R-help [mailto:r-help-bounces at r-project.org https://stat.ethz.ch/mailman/listinfo/r-help] On Behalf Of Atte Tenkanen // Sent: Sunday, 26 July 2015 7:50a // To:r-help at r-project.org https://stat.ethz.ch/mailman/listinfo/r-help // Subject: [R] Opposite color in R // // Hi, // // I have tried to find a way to find opposite or complementary colors in R. // // I would like to form a color circle with R like this one: // http://nobetty.net/dandls/colorwheel/complementary_colors.jpg // // If you just make a basic color wheel in R, the colors do not form // complementary color circle: // // palette(rainbow(24)) // Colors=palette() // pie(rep(1, 24), col = Colors) // // There is a package ”colortools” where you can find function opposite(), // but it doesn’t work as is said. I tried // // library(colortools) // opposite(violet) and got green instead of yellow and // // opposite(blue) and got yellow instead of orange. // // Do you know any solutions? // // Atte Tenkanen / [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Opposite color in R
It seems that there is no implementation for the traditional artist's color circle in R. However I'm searching for such a wheel, because my program needs it. As said, the description of complementary/opposite-function in package colortools is misleading since, for example opposite(green) produces violet, not red, but the description of complementary-function says Complementary or opposite color scheme is formed by colors that are opposite each other on the color wheel (example: red and green). So, there must be just a lapse in the text. I constrained such kind of a color wheel, which is enough near of what I need: library(colorspace) ColorsRYB=rbind(colorRamp(c(red, violet))((0:4)/4)[1:4,],colorRamp(c(violet, blue))((0:4)/4)[1:4,],colorRamp(c(blue, green))((0:4)/4)[1:4,],colorRamp(c(green, yellow))((0:4)/4)[1:4,],colorRamp(c(yellow, orange))((0:4)/4)[1:4,],colorRamp(c(orange, red))((0:4)/4)[1:4,]) LenCol=length(ColorsRYB[,1]) ColorsRYBhex=rep(0, LenCol) for(i in 1: LenCol) { ColorsRYBhex[i]=rgb(ColorsRYB[i,1]/255,ColorsRYB[i,2]/255,ColorsRYB[i,3]/255) } pie(rep(1, 24), col = ColorsRYBhex) Atte T. 28.7.2015, 2.23, Steve Taylor kirjoitti: I wonder if the hcl colour space is useful? Varying hue while keeping chroma and luminosity constant should give varying colours of perceptually the same colourness and brightness. ?hcl pie(rep(1,12),col=hcl((1:12)*30,c=70),border=NA) -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Atte Tenkanen Sent: Sunday, 26 July 2015 7:50a To: r-help@r-project.org Subject: [R] Opposite color in R Hi, I have tried to find a way to find opposite or complementary colors in R. I would like to form a color circle with R like this one: http://nobetty.net/dandls/colorwheel/complementary_colors.jpg If you just make a basic color wheel in R, the colors do not form complementary color circle: palette(rainbow(24)) Colors=palette() pie(rep(1, 24), col = Colors) There is a package ”colortools” where you can find function opposite(), but it doesn’t work as is said. I tried library(colortools) opposite(violet) and got green instead of yellow and opposite(blue) and got yellow instead of orange. Do you know any solutions? Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Opposite color in R
Thanks, This helps me going on. The description in complementary {colortools} was/is somehow misleading: Complementary or opposite color scheme is formed by colors that are opposite each other on the color wheel (example: red and green). Atte T. / On 25 Jul 2015, at 21:49 , Atte Tenkanen attenka at utu.fi https://stat.ethz.ch/mailman/listinfo/r-help wrote: // // Hi, // // I have tried to find a way to find opposite or complementary colors in R. // // I would like to form a color circle with R like this one:http://nobetty.net/dandls/colorwheel/complementary_colors.jpg // // If you just make a basic color wheel in R, the colors do not form complementary color circle: // // palette(rainbow(24)) // Colors=palette() // pie(rep(1, 24), col = Colors) // // There is a package ”colortools” where you can find function opposite(), but it doesn’t work as is said. I tried // // library(colortools) // opposite(violet) and got green instead of yellow and // // opposite(blue) and got yellow instead of orange. // // Do you know any solutions? / Not directly, but a few hints: First read up on complementary colors in Wikipedia. In particular, note that the traditional color circle does not satisfy the modern definition of opposite-ness. E.g. red paint mixed with green paint is brown, not black or grey. The construction of the color circle is simple in principle: red, blue, yellow go at 0, 120, 240 degrees, the other colors on the circle are formed by mixing two primaries in varying proportions: green (at 180 deg) is an equal mixture of blue and yellow, violet (at 60 deg) of blue and red, orange (at 300 deg) of red and yellow. Blue-green (at 150 deg) would be half blue, half green, alias three quarter blue, one quarter yellow. Etc. The tricky bit is that the above mixtures are subtractive mixtures (mixing paint rather than light beams) and I don't know how to make a subtractive color mixture in the additive RGB space that we usually work in. Maybe there are tools in the colortools package? -pd / // Atte Tenkanen // // __ // R-help at r-project.org https://stat.ethz.ch/mailman/listinfo/r-help mailing list -- To UNSUBSCRIBE and more, see // https://stat.ethz.ch/mailman/listinfo/r-help // PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html // and provide commented, minimal, self-contained, reproducible code. / -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email:pd.mes at cbs.dk https://stat.ethz.ch/mailman/listinfo/r-help Priv:PDalgd at gmail.com https://stat.ethz.ch/mailman/listinfo/r-help [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Opposite color in R
Hi, I have tried to find a way to find opposite or complementary colors in R. I would like to form a color circle with R like this one: http://nobetty.net/dandls/colorwheel/complementary_colors.jpg If you just make a basic color wheel in R, the colors do not form complementary color circle: palette(rainbow(24)) Colors=palette() pie(rep(1, 24), col = Colors) There is a package ”colortools” where you can find function opposite(), but it doesn’t work as is said. I tried library(colortools) opposite(violet) and got green instead of yellow and opposite(blue) and got yellow instead of orange. Do you know any solutions? Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] How to test whether is.element() returns only TRUE's
Hi, How can I test, whether all the values that is.element() -function returns are TRUE's Eg. (is.element(c(1,4,2),c(1,2,3))) [1] TRUE FALSE TRUE This doesn't work: (is.element(c(1,4,2),c(1,2,3)))==TRUE [1] TRUE FALSE TRUE Best, Atte Tenkanen, FT, MuM http://users.utu.fi/attenka/ __ 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] How to test whether is.element() returns only TRUE's
I found one: sum(is.element(c(1,4,2),c(1,2,3)))==length(c(1,4,2)) Are there others and perhaps more elegant ways? Atte Tenkanen, FT, MuM http://users.utu.fi/attenka/ Lähettäjä: Atte Tenkanen Lähetetty: 17. joulukuuta 2012 22:24 Vastaanottaja: r-help@r-project.org Aihe: How to test whether is.element() returns only TRUE's Hi, How can I test, whether all the values that is.element() -function returns are TRUE's Eg. (is.element(c(1,4,2),c(1,2,3))) [1] TRUE FALSE TRUE This doesn't work: (is.element(c(1,4,2),c(1,2,3)))==TRUE [1] TRUE FALSE TRUE Best, Atte Tenkanen, FT, MuM http://users.utu.fi/attenka/ __ 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] How to test if there is a subvector in a longer vector
Thank you! ___ Lähettäjä: Berend Hasselman [b...@xs4all.nl] Lähetetty: 28. syyskuuta 2012 10:47 Vastaanottaja: Atte Tenkanen Cc: R help Aihe: Re: [R] How to test if there is a subvector in a longer vector On 28-09-2012, at 07:41, Atte Tenkanen atte...@utu.fi wrote: Sorry. I should have mentioned that the order of the components is important. So c(1,4,6) is accepted as a subvector of c(2,1,1,4,6,3), but not of c(2,1,1,6,4,3). How to test this? See this discussion for a variety of solutions. http://r.789695.n4.nabble.com/matching-a-sequence-in-a-vector-td4389523.html#a4393453 Berend __ 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] How to test if there is a subvector in a longer vector
Hi, There are certainly several ways to test, whether a longer vector includes a subvector. For instance, c(1,4,6) is included in c(2,1,1,4,6,3). How to test this and which would be the fastest way to do it? Best, Atte Tenkanen, FT, MuM http://users.utu.fi/attenka/ __ 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] How to test if there is a subvector in a longer vector
Sorry. I should have mentioned that the order of the components is important. So c(1,4,6) is accepted as a subvector of c(2,1,1,4,6,3), but not of c(2,1,1,6,4,3). How to test this? Cc: R help Aihe: Re: [R] How to test if there is a subvector in a longer vector Hi, Try this: Not sure whether this is the fastest: set.seed(932) vec1-sample(1:10,6,replace=TRUE) vec2-sample(1:7,3,replace=TRUE) vec2[vec2%in%vec1] #[1] 5 library(rbenchmark) benchmark(isTRUE(all(vec2%in%vec1)),replications=1e4) # test replications elapsed relative user.self sys.self #1 isTRUE(all(vec2 %in% vec1))1 0.2951 0.2720 # user.child sys.child #1 0 0 A.K. - Original Message - From: Atte Tenkanen atte...@utu.fi To: r-help@r-project.org r-help@r-project.org Cc: Sent: Thursday, September 27, 2012 5:00 PM Subject: [R] How to test if there is a subvector in a longer vector Hi, There are certainly several ways to test, whether a longer vector includes a subvector. For instance, c(1,4,6) is included in c(2,1,1,4,6,3). How to test this and which would be the fastest way to do it? Best, Atte Tenkanen, FT, MuM http://users.utu.fi/attenka/ __ 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-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] Wilcoxon signed rank test and its requirements
Greg Snow kirjoitti 25.6.2010 kello 21.55: Let me see if I understand. You actually have the data for the whole population (the entire piece) but you have some pre-defined sections that you want to see if they differ from the population, or more meaningfully they are different from a randomly selected set of measures. Is that correct? Exactly. If so, since you have the entire population of interest you can create the actual sampling distribution (or a good approximation of it). Just take random samples from the population of the given size (matching the subset you are interested in) and calculate the means (or other value of interest), probably 10,000 to 1,000,000 samples. Now compare the value from your predefined subset to the set of random values you generated to see if it is in the tail or not. Thank you! I will do this. Is this kind of !Monte Carlo -evaluation (?) often used in statistics.If it is, do you know any reference for ti? Atte -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Atte Tenkanen Sent: Thursday, June 24, 2010 11:04 PM To: David Winsemius Cc: R mailing list Subject: Re: [R] Wilcoxon signed rank test and its requirements The values come from this kind of process: The musical composition is segmented into so-called 'pitch-class segments' and these segments are compared with one reference set with a distance function. Only some distance values are possible. These distance values can be averaged over music bars which produces smoother distribution and the 'comparison curve' that illustrates the distances according to the reference set through a musical piece result in more readable curve (see e.g. http://users.utu.fi/attenka/with6.jpg ), but I would prefer to use original values. then, I want to pick only some regions from the piece and compare those values of those regions, whether they are higher than the mean of all values. Atte On Jun 24, 2010, at 6:58 PM, Atte Tenkanen wrote: Is there anything for me? There is a lot of data, n=2418, but there are also a lot of ties. My sample nÅ250-300 I do not understand why there should be so many ties. You have not described the measurement process or units. ( ... although you offer a glipmse without much background later.) i would like to test, whether the mean of the sample differ significantly from the population mean. Why? What is the purpose of this investigation? Why should the mean of a sample be that important? The histogram of the population looks like in attached histogram, what test should I use? No choices? This distribution comes from a musical piece and the values are 'tonal distances'. http://users.utu.fi/attenka/Hist.png That picture does not offer much insidght into the features of that measurement. It appears to have much more structure than I would expect for a sample from a smooth unimodal underlying population. -- David. Atte On 06/24/2010 12:40 PM, David Winsemius wrote: On Jun 23, 2010, at 9:58 PM, Atte Tenkanen wrote: Thanks. What I have had to ask is that how do you test that the data is symmetric enough? If it is not, is it ok to use some data transformation? when it is said: The Wilcoxon signed rank test does not assume that the data are sampled from a Gaussian distribution. However it does assume that the data are distributed symmetrically around the median. If the distribution is asymmetrical, the P value will not tell you much about whether the median is different than the hypothetical value. You are being misled. Simply finding a statement on a statistics software website, even one as reputable as Graphpad (???), does not mean that it is necessarily true. My understanding (confirmed reviewing Nonparametric statistical methods for complete and censored data by M. M. Desu, Damaraju Raghavarao, is that the Wilcoxon signed-rank test does not require that the underlying distributions be symmetric. The above quotation is highly inaccurate. To add to what David and others have said, look at the kernel that the U-statistic associated with the WSR test uses: the indicator (0/1) of xi + xj 0. So WSR tests H0:p=0.5 where p = the probability that the average of a randomly chosen pair of values is positive. [If there are ties this probably needs to be worded as P[xi + xj 0] = P[xi + xj 0], i neq j. Frank -- Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University __ 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
Re: [R] Wilcoxon signed rank test and its requirements
Greg Snow kirjoitti 25.6.2010 kello 21.55: Let me see if I understand. You actually have the data for the whole population (the entire piece) but you have some pre-defined sections that you want to see if they differ from the population, or more meaningfully they are different from a randomly selected set of measures. Is that correct? If so, since you have the entire population of interest you can create the actual sampling distribution (or a good approximation of it). Just take random samples from the population of the given size (matching the subset you are interested in) and calculate the means (or other value of interest), probably 10,000 to 1,000,000 samples. Now compare the value from your predefined subset to the set of random values you generated to see if it is in the tail or not. I check, so you mean doing it this way: t.test(sample(POPUL, length(SAMPLE), replace = FALSE), mu=mean (SAMPLE), alt = less) Atte -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Atte Tenkanen Sent: Thursday, June 24, 2010 11:04 PM To: David Winsemius Cc: R mailing list Subject: Re: [R] Wilcoxon signed rank test and its requirements The values come from this kind of process: The musical composition is segmented into so-called 'pitch-class segments' and these segments are compared with one reference set with a distance function. Only some distance values are possible. These distance values can be averaged over music bars which produces smoother distribution and the 'comparison curve' that illustrates the distances according to the reference set through a musical piece result in more readable curve (see e.g. http://users.utu.fi/attenka/with6.jpg ), but I would prefer to use original values. then, I want to pick only some regions from the piece and compare those values of those regions, whether they are higher than the mean of all values. Atte On Jun 24, 2010, at 6:58 PM, Atte Tenkanen wrote: Is there anything for me? There is a lot of data, n=2418, but there are also a lot of ties. My sample nÅ250-300 I do not understand why there should be so many ties. You have not described the measurement process or units. ( ... although you offer a glipmse without much background later.) i would like to test, whether the mean of the sample differ significantly from the population mean. Why? What is the purpose of this investigation? Why should the mean of a sample be that important? The histogram of the population looks like in attached histogram, what test should I use? No choices? This distribution comes from a musical piece and the values are 'tonal distances'. http://users.utu.fi/attenka/Hist.png That picture does not offer much insidght into the features of that measurement. It appears to have much more structure than I would expect for a sample from a smooth unimodal underlying population. -- David. Atte On 06/24/2010 12:40 PM, David Winsemius wrote: On Jun 23, 2010, at 9:58 PM, Atte Tenkanen wrote: Thanks. What I have had to ask is that how do you test that the data is symmetric enough? If it is not, is it ok to use some data transformation? when it is said: The Wilcoxon signed rank test does not assume that the data are sampled from a Gaussian distribution. However it does assume that the data are distributed symmetrically around the median. If the distribution is asymmetrical, the P value will not tell you much about whether the median is different than the hypothetical value. You are being misled. Simply finding a statement on a statistics software website, even one as reputable as Graphpad (???), does not mean that it is necessarily true. My understanding (confirmed reviewing Nonparametric statistical methods for complete and censored data by M. M. Desu, Damaraju Raghavarao, is that the Wilcoxon signed-rank test does not require that the underlying distributions be symmetric. The above quotation is highly inaccurate. To add to what David and others have said, look at the kernel that the U-statistic associated with the WSR test uses: the indicator (0/1) of xi + xj 0. So WSR tests H0:p=0.5 where p = the probability that the average of a randomly chosen pair of values is positive. [If there are ties this probably needs to be worded as P[xi + xj 0] = P[xi + xj 0], i neq j. Frank -- Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University __ 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
Re: [R] Wilcoxon signed rank test and its requirements
Atte Tenkanen kirjoitti 26.6.2010 kello 5.15: Greg Snow kirjoitti 25.6.2010 kello 21.55: Let me see if I understand. You actually have the data for the whole population (the entire piece) but you have some pre-defined sections that you want to see if they differ from the population, or more meaningfully they are different from a randomly selected set of measures. Is that correct? If so, since you have the entire population of interest you can create the actual sampling distribution (or a good approximation of it). Just take random samples from the population of the given size (matching the subset you are interested in) and calculate the means (or other value of interest), probably 10,000 to 1,000,000 samples. Now compare the value from your predefined subset to the set of random values you generated to see if it is in the tail or not. I check, so you mean doing it this way: t.test(sample(POPUL, length(SAMPLE), replace = FALSE), mu=mean (SAMPLE), alt = less) NO, this way: t.test(POPUL[sample(1:length(POPUL), length(SAMPLE), replace = FALSE)], mu=mean(SAMPLE), alt = less) Atte Atte -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Atte Tenkanen Sent: Thursday, June 24, 2010 11:04 PM To: David Winsemius Cc: R mailing list Subject: Re: [R] Wilcoxon signed rank test and its requirements The values come from this kind of process: The musical composition is segmented into so-called 'pitch-class segments' and these segments are compared with one reference set with a distance function. Only some distance values are possible. These distance values can be averaged over music bars which produces smoother distribution and the 'comparison curve' that illustrates the distances according to the reference set through a musical piece result in more readable curve (see e.g. http://users.utu.fi/attenka/with6.jpg ), but I would prefer to use original values. then, I want to pick only some regions from the piece and compare those values of those regions, whether they are higher than the mean of all values. Atte On Jun 24, 2010, at 6:58 PM, Atte Tenkanen wrote: Is there anything for me? There is a lot of data, n=2418, but there are also a lot of ties. My sample nÅ250-300 I do not understand why there should be so many ties. You have not described the measurement process or units. ( ... although you offer a glipmse without much background later.) i would like to test, whether the mean of the sample differ significantly from the population mean. Why? What is the purpose of this investigation? Why should the mean of a sample be that important? The histogram of the population looks like in attached histogram, what test should I use? No choices? This distribution comes from a musical piece and the values are 'tonal distances'. http://users.utu.fi/attenka/Hist.png That picture does not offer much insidght into the features of that measurement. It appears to have much more structure than I would expect for a sample from a smooth unimodal underlying population. -- David. Atte On 06/24/2010 12:40 PM, David Winsemius wrote: On Jun 23, 2010, at 9:58 PM, Atte Tenkanen wrote: Thanks. What I have had to ask is that how do you test that the data is symmetric enough? If it is not, is it ok to use some data transformation? when it is said: The Wilcoxon signed rank test does not assume that the data are sampled from a Gaussian distribution. However it does assume that the data are distributed symmetrically around the median. If the distribution is asymmetrical, the P value will not tell you much about whether the median is different than the hypothetical value. You are being misled. Simply finding a statement on a statistics software website, even one as reputable as Graphpad (???), does not mean that it is necessarily true. My understanding (confirmed reviewing Nonparametric statistical methods for complete and censored data by M. M. Desu, Damaraju Raghavarao, is that the Wilcoxon signed-rank test does not require that the underlying distributions be symmetric. The above quotation is highly inaccurate. To add to what David and others have said, look at the kernel that the U-statistic associated with the WSR test uses: the indicator (0/1) of xi + xj 0. So WSR tests H0:p=0.5 where p = the probability that the average of a randomly chosen pair of values is positive. [If there are ties this probably needs to be worded as P[xi + xj 0] = P[xi + xj 0], i neq j. Frank -- Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University
Re: [R] Wilcoxon signed rank test and its requirements
Thanks! The results were similar to the t.test p-values show (I have four samples). Thank you also for using that replicate-function which i didn't know. Till now I have just used for-loops that are not so beautiful... i don't know about the speed. Have to test that. Atte Greg Snow kirjoitti 26.6.2010 kello 23.30: No I mean something like this, assuming that the iris dataset contains the full population and we want to see if Setaso have a different mean than the population (the null would be that there is no difference in sepal width between species, or that species tells nothing about sepal width): out1 - replicate( 10, mean(sample(iris$Sepal.Width, 50)) ) obs1 - mean( iris$Sepal.Width[1:50] ) hist(out1, xlim=range(out1,obs1)) abline(v=obs1) mean( out1 obs1 ) I donÕt have a reference (other than a text book that defines sampling distributions). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 From: Atte Tenkanen [mailto:atte...@utu.fi] Sent: Friday, June 25, 2010 10:08 PM To: Atte Tenkanen Cc: Greg Snow; David Winsemius; R mailing list Subject: Re: [R] Wilcoxon signed rank test and its requirements Atte Tenkanen kirjoitti 26.6.2010 kello 5.15: Greg Snow kirjoitti 25.6.2010 kello 21.55: Let me see if I understand. You actually have the data for the whole population (the entire piece) but you have some pre-defined sections that you want to see if they differ from the population, or more meaningfully they are different from a randomly selected set of measures. Is that correct? If so, since you have the entire population of interest you can create the actual sampling distribution (or a good approximation of it). Just take random samples from the population of the given size (matching the subset you are interested in) and calculate the means (or other value of interest), probably 10,000 to 1,000,000 samples. Now compare the value from your predefined subset to the set of random values you generated to see if it is in the tail or not. I check, so you mean doing it this way: t.test(sample(POPUL, length(SAMPLE), replace = FALSE), mu=mean (SAMPLE), alt = less) NO, this way: t.test(POPUL[sample(1:length(POPUL), length(SAMPLE), replace = FALSE)], mu=mean(SAMPLE), alt = less) Atte Atte -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Atte Tenkanen Sent: Thursday, June 24, 2010 11:04 PM To: David Winsemius Cc: R mailing list Subject: Re: [R] Wilcoxon signed rank test and its requirements The values come from this kind of process: The musical composition is segmented into so-called 'pitch-class segments' and these segments are compared with one reference set with a distance function. Only some distance values are possible. These distance values can be averaged over music bars which produces smoother distribution and the 'comparison curve' that illustrates the distances according to the reference set through a musical piece result in more readable curve (see e.g. http://users.utu.fi/attenka/with6.jpg ), but I would prefer to use original values. then, I want to pick only some regions from the piece and compare those values of those regions, whether they are higher than the mean of all values. Atte On Jun 24, 2010, at 6:58 PM, Atte Tenkanen wrote: Is there anything for me? There is a lot of data, n=2418, but there are also a lot of ties. My sample nÅ250-300 I do not understand why there should be so many ties. You have not described the measurement process or units. ( ... although you offer a glipmse without much background later.) i would like to test, whether the mean of the sample differ significantly from the population mean. Why? What is the purpose of this investigation? Why should the mean of a sample be that important? The histogram of the population looks like in attached histogram, what test should I use? No choices? This distribution comes from a musical piece and the values are 'tonal distances'. http://users.utu.fi/attenka/Hist.png That picture does not offer much insidght into the features of that measurement. It appears to have much more structure than I would expect for a sample from a smooth unimodal underlying population. -- David. Atte On 06/24/2010 12:40 PM, David Winsemius wrote: On Jun 23, 2010, at 9:58 PM, Atte Tenkanen wrote: Thanks. What I have had to ask is that how do you test that the data is symmetric enough? If it is not, is it ok to use some data transformation? when it is said: The Wilcoxon signed rank test does not assume that the data are sampled from a Gaussian distribution. However it does assume that the data
Re: [R] Wilcoxon signed rank test and its requirements
The values come from this kind of process: The musical composition is segmented into so-called 'pitch-class segments' and these segments are compared with one reference set with a distance function. Only some distance values are possible. These distance values can be averaged over music bars which produces smoother distribution and the 'comparison curve' that illustrates the distances according to the reference set through a musical piece result in more readable curve (see e.g. http://users.utu.fi/attenka/with6.jpg ), but I would prefer to use original values. then, I want to pick only some regions from the piece and compare those values of those regions, whether they are higher than the mean of all values. Atte On Jun 24, 2010, at 6:58 PM, Atte Tenkanen wrote: Is there anything for me? There is a lot of data, n=2418, but there are also a lot of ties. My sample n≈250-300 I do not understand why there should be so many ties. You have not described the measurement process or units. ( ... although you offer a glipmse without much background later.) i would like to test, whether the mean of the sample differ significantly from the population mean. Why? What is the purpose of this investigation? Why should the mean of a sample be that important? The histogram of the population looks like in attached histogram, what test should I use? No choices? This distribution comes from a musical piece and the values are 'tonal distances'. http://users.utu.fi/attenka/Hist.png That picture does not offer much insidght into the features of that measurement. It appears to have much more structure than I would expect for a sample from a smooth unimodal underlying population. -- David. Atte On 06/24/2010 12:40 PM, David Winsemius wrote: On Jun 23, 2010, at 9:58 PM, Atte Tenkanen wrote: Thanks. What I have had to ask is that how do you test that the data is symmetric enough? If it is not, is it ok to use some data transformation? when it is said: The Wilcoxon signed rank test does not assume that the data are sampled from a Gaussian distribution. However it does assume that the data are distributed symmetrically around the median. If the distribution is asymmetrical, the P value will not tell you much about whether the median is different than the hypothetical value. You are being misled. Simply finding a statement on a statistics software website, even one as reputable as Graphpad (???), does not mean that it is necessarily true. My understanding (confirmed reviewing Nonparametric statistical methods for complete and censored data by M. M. Desu, Damaraju Raghavarao, is that the Wilcoxon signed-rank test does not require that the underlying distributions be symmetric. The above quotation is highly inaccurate. To add to what David and others have said, look at the kernel that the U-statistic associated with the WSR test uses: the indicator (0/1) of xi + xj 0. So WSR tests H0:p=0.5 where p = the probability that the average of a randomly chosen pair of values is positive. [If there are ties this probably needs to be worded as P[xi + xj 0] = P[xi + xj 0], i neq j. Frank -- Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University __ 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] Wilcoxon signed rank test and its requirements
BTW. If there is not so weak test that would be suitable for my purpose (because of the ties and the shape of the data), could I proceed this way: It is also worth of comparing different samples taken from the data. Since the mean and sd of the data are available, could I approximate p-values using z- or t-test, just to compare several different samples? Atte On Jun 24, 2010, at 6:58 PM, Atte Tenkanen wrote: Is there anything for me? There is a lot of data, n=2418, but there are also a lot of ties. My sample n≈250-300 I do not understand why there should be so many ties. You have not described the measurement process or units. ( ... although you offer a glipmse without much background later.) i would like to test, whether the mean of the sample differ significantly from the population mean. Why? What is the purpose of this investigation? Why should the mean of a sample be that important? The histogram of the population looks like in attached histogram, what test should I use? No choices? This distribution comes from a musical piece and the values are 'tonal distances'. http://users.utu.fi/attenka/Hist.png That picture does not offer much insidght into the features of that measurement. It appears to have much more structure than I would expect for a sample from a smooth unimodal underlying population. -- David. Atte On 06/24/2010 12:40 PM, David Winsemius wrote: On Jun 23, 2010, at 9:58 PM, Atte Tenkanen wrote: Thanks. What I have had to ask is that how do you test that the data is symmetric enough? If it is not, is it ok to use some data transformation? when it is said: The Wilcoxon signed rank test does not assume that the data are sampled from a Gaussian distribution. However it does assume that the data are distributed symmetrically around the median. If the distribution is asymmetrical, the P value will not tell you much about whether the median is different than the hypothetical value. You are being misled. Simply finding a statement on a statistics software website, even one as reputable as Graphpad (???), does not mean that it is necessarily true. My understanding (confirmed reviewing Nonparametric statistical methods for complete and censored data by M. M. Desu, Damaraju Raghavarao, is that the Wilcoxon signed-rank test does not require that the underlying distributions be symmetric. The above quotation is highly inaccurate. To add to what David and others have said, look at the kernel that the U-statistic associated with the WSR test uses: the indicator (0/1) of xi + xj 0. So WSR tests H0:p=0.5 where p = the probability that the average of a randomly chosen pair of values is positive. [If there are ties this probably needs to be worded as P[xi + xj 0] = P[xi + xj 0], i neq j. Frank -- Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University __ 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] Wilcoxon signed rank test and its requirements
PS. Mayby I can somehow try to transform data and check it, for example, using the skewness-function of timeDate-package? Thanks. What I have had to ask is that how do you test that the data is symmetric enough? If it is not, is it ok to use some data transformation? when it is said: The Wilcoxon signed rank test does not assume that the data are sampled from a Gaussian distribution. However it does assume that the data are distributed symmetrically around the median. If the distribution is asymmetrical, the P value will not tell you much about whether the median is different than the hypothetical value. On Wed, Jun 23, 2010 at 10:27 PM, Atte Tenkanen atte...@utu.fi wrote: Hi all, I have a distribution, and take a sample of it. Then I compare that sample with the mean of the population like here in Wilcoxon signed rank test with continuity correction: wilcox.test(Sample,mu=mean(All), alt=two.sided) Wilcoxon signed rank test with continuity correction data: AlphaNoteOnsetDists V = 63855, p-value = 0.0002093 alternative hypothesis: true location is not equal to 0.4115136 wilcox.test(Sample,mu=mean(All), alt = greater) Wilcoxon signed rank test with continuity correction data: AlphaNoteOnsetDists V = 63855, p-value = 0.0001047 alternative hypothesis: true location is greater than 0.4115136 What assumptions are needed for the population? wikipedia says: The Wilcoxon signed-rank test is a _non-parametric_ statistical hypothesis test for... it also talks about the assumptions. What can we say according these results? p-value for the less is 0.999. That the p-value for less and greater seem to sum up to one, and that the p-value of greater is half of that for two-sided. You shouldn't ask what we can say. You should ask yourself What was the question and is this test giving me an answer on that question? Cheers Joris -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ 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] Wilcoxon signed rank test and its requirements
Thanks. What I have had to ask is that how do you test that the data is symmetric enough? If it is not, is it ok to use some data transformation? when it is said: The Wilcoxon signed rank test does not assume that the data are sampled from a Gaussian distribution. However it does assume that the data are distributed symmetrically around the median. If the distribution is asymmetrical, the P value will not tell you much about whether the median is different than the hypothetical value. On Wed, Jun 23, 2010 at 10:27 PM, Atte Tenkanen atte...@utu.fi wrote: Hi all, I have a distribution, and take a sample of it. Then I compare that sample with the mean of the population like here in Wilcoxon signed rank test with continuity correction: wilcox.test(Sample,mu=mean(All), alt=two.sided) Wilcoxon signed rank test with continuity correction data: AlphaNoteOnsetDists V = 63855, p-value = 0.0002093 alternative hypothesis: true location is not equal to 0.4115136 wilcox.test(Sample,mu=mean(All), alt = greater) Wilcoxon signed rank test with continuity correction data: AlphaNoteOnsetDists V = 63855, p-value = 0.0001047 alternative hypothesis: true location is greater than 0.4115136 What assumptions are needed for the population? wikipedia says: The Wilcoxon signed-rank test is a _non-parametric_ statistical hypothesis test for... it also talks about the assumptions. What can we say according these results? p-value for the less is 0.999. That the p-value for less and greater seem to sum up to one, and that the p-value of greater is half of that for two-sided. You shouldn't ask what we can say. You should ask yourself What was the question and is this test giving me an answer on that question? Cheers Joris -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ 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] Wilcoxon signed rank test and its requirements
On Jun 23, 2010, at 9:58 PM, Atte Tenkanen wrote: Thanks. What I have had to ask is that how do you test that the data is symmetric enough? If it is not, is it ok to use some data transformation? when it is said: The Wilcoxon signed rank test does not assume that the data are sampled from a Gaussian distribution. However it does assume that the data are distributed symmetrically around the median. If the distribution is asymmetrical, the P value will not tell you much about whether the median is different than the hypothetical value. You are being misled. Simply finding a statement on a statistics software website, even one as reputable as Graphpad (???), does not mean that it is necessarily true. My understanding (confirmed reviewing Nonparametric statistical methods for complete and censored data by M. M. Desu, Damaraju Raghavarao, is that the Wilcoxon signed- rank test does not require that the underlying distributions be symmetric. The above quotation is highly inaccurate. -- David. Thanks. Unfortunately, I can't follow the reference at all, but I read this in that way that I can be carefree as far as the underlying distribution is concerned? Is there any other authoritative reference where that is just stated in a way test does not require that the underlying distributions be symmetric or normal. Atte On Wed, Jun 23, 2010 at 10:27 PM, Atte Tenkanen atte...@utu.fi wrote: Hi all, I have a distribution, and take a sample of it. Then I compare that sample with the mean of the population like here in Wilcoxon signed rank test with continuity correction: wilcox.test(Sample,mu=mean(All), alt=two.sided) Wilcoxon signed rank test with continuity correction data: AlphaNoteOnsetDists V = 63855, p-value = 0.0002093 alternative hypothesis: true location is not equal to 0.4115136 wilcox.test(Sample,mu=mean(All), alt = greater) Wilcoxon signed rank test with continuity correction data: AlphaNoteOnsetDists V = 63855, p-value = 0.0001047 alternative hypothesis: true location is greater than 0.4115136 What assumptions are needed for the population? wikipedia says: The Wilcoxon signed-rank test is a _non-parametric_ statistical hypothesis test for... it also talks about the assumptions. What can we say according these results? p-value for the less is 0.999. That the p-value for less and greater seem to sum up to one, and that the p-value of greater is half of that for two-sided. You shouldn't ask what we can say. You should ask yourself What was the question and is this test giving me an answer on that question? Cheers Joris -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ 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-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] Wilcoxon signed rank test and its requirements
Is there anything for me? There is a lot of data, n=2418, but there are also a lot of ties. My sample n≈250-300 i would like to test, whether the mean of the sample differ significantly from the population mean. The histogram of the population looks like in attached histogram, what test should I use? No choices? This distribution comes from a musical piece and the values are 'tonal distances'. http://users.utu.fi/attenka/Hist.png Atte On 06/24/2010 12:40 PM, David Winsemius wrote: On Jun 23, 2010, at 9:58 PM, Atte Tenkanen wrote: Thanks. What I have had to ask is that how do you test that the data is symmetric enough? If it is not, is it ok to use some data transformation? when it is said: The Wilcoxon signed rank test does not assume that the data are sampled from a Gaussian distribution. However it does assume that the data are distributed symmetrically around the median. If the distribution is asymmetrical, the P value will not tell you much about whether the median is different than the hypothetical value. You are being misled. Simply finding a statement on a statistics software website, even one as reputable as Graphpad (???), does not mean that it is necessarily true. My understanding (confirmed reviewing Nonparametric statistical methods for complete and censored data by M. M. Desu, Damaraju Raghavarao, is that the Wilcoxon signed-rank test does not require that the underlying distributions be symmetric. The above quotation is highly inaccurate. To add to what David and others have said, look at the kernel that the U-statistic associated with the WSR test uses: the indicator (0/1) of xi + xj 0. So WSR tests H0:p=0.5 where p = the probability that the average of a randomly chosen pair of values is positive. [If there are ties this probably needs to be worded as P[xi + xj 0] = P[xi + xj 0], i neq j. Frank -- Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University __ 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] Wilcoxon signed rank test and its requirements
Hi all, I have a distribution, and take a sample of it. Then I compare that sample with the mean of the population like here in Wilcoxon signed rank test with continuity correction: wilcox.test(Sample,mu=mean(All), alt=two.sided) Wilcoxon signed rank test with continuity correction data: AlphaNoteOnsetDists V = 63855, p-value = 0.0002093 alternative hypothesis: true location is not equal to 0.4115136 wilcox.test(Sample,mu=mean(All), alt = greater) Wilcoxon signed rank test with continuity correction data: AlphaNoteOnsetDists V = 63855, p-value = 0.0001047 alternative hypothesis: true location is greater than 0.4115136 What assumptions are needed for the population? What can we say according these results? p-value for the less is 0.999. Thanks in advance, Atte Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ __ 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] prcomp() and the lenght of PC:s
Hi, I would like to know whether there is some deeper rationale behind or is it just an established practice that the lenghts of principal components, giving for example by prcomp-function, are normalised to 1? Best regards, Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ __ 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] glm-test?
Dear R-users, I would like to test, whether a sample distribution differs significantly from a population distribution. They are not normally distributed. How should I proceed? Using somehow glm-models? How? The population and the sample data are here. They can be loaded using the load-command. http://users.utu.fi/attenka/D_Pop http://users.utu.fi/attenka/D_Samp Best regards, Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ __ 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] glm-test?
I would have tried z-test (n=67) but since the distribution is not normally distributed, but positive skew, I should somehow transform the data? Values are between 0 and 1. atte Which test do you want to use? Once you know that, tell us and we'll tell you where to find it in R. Cheers Joris On Fri, Jun 11, 2010 at 1:50 PM, Atte Tenkanen atte...@utu.fi wrote: Dear R-users, I would like to test, whether a sample distribution differs significantly from a population distribution. They are not normally distributed. How should I proceed? Using somehow glm-models? How? The population and the sample data are here. They can be loaded using the load-command. http://users.utu.fi/attenka/D_Pop http://users.utu.fi/attenka/D_Samp Best regards, Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ __ 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. -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ 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] glm-test?
Thanks! Atte Take a look at this document: http://cran.r-project.org/doc/contrib/Ricci-distributions-en.pdf All information you need is in there. Cheers Joris On Fri, Jun 11, 2010 at 2:50 PM, Atte Tenkanen atte...@utu.fi wrote: I would have tried z-test (n=67) but since the distribution is not normally distributed, but positive skew, I should somehow transform the data? Values are between 0 and 1. atte Which test do you want to use? Once you know that, tell us and we'll tell you where to find it in R. Cheers Joris On Fri, Jun 11, 2010 at 1:50 PM, Atte Tenkanen atte...@utu.fi wrote: Dear R-users, I would like to test, whether a sample distribution differs significantly from a population distribution. They are not normally distributed. How should I proceed? Using somehow glm-models? How? The population and the sample data are here. They can be loaded using the load-command. http://users.utu.fi/attenka/D_Pop http://users.utu.fi/attenka/D_Samp Best regards, Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ __ 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. -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ 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] Is it ok to apply the z.test this way?
Hi, I thank you all who answered to my question. I think I learned a lot although there still remain things and concepts I have to ruminate. To the questions about the plots: In this case, I have segmented music into so-called pitch-class sets and further transformed them to 'set classes', equivalence classes, a concept which comes from the musical set theory. These classes have been compared to some comparison set class using a similarity function. Let's think that this csc is the diatonic scale (similar to white keys in the piano), if there is a diatonic segment in the piece under study, this segment gets the value of 1. Those segments which are very different in their nature (according to the similarity function) get values nearer to 0. I can detect rhythms, tonalities etc, and their combinations as well. I call this method Comparison Structure Analysis or C. Set A. I have used R for many years as a programming environment in my research but not its statistical capabilies. Henceforth, I have to focus more on statistics. Atte It would help if you could give more detail on what you are trying to accomplish. You can get boundaries from a dataset using the quantile function, but it is not clear if that is really what you want or not. Asking about a sample size of 30 implies that you want to do some normal based inference using your data, but you don't say what your ultimate question/goal is. (and 30 is just a rule of thumb, in some cases too conservative, in others too liberal). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: Atte Tenkanen [mailto:atte...@utu.fi] Sent: Friday, April 16, 2010 1:22 PM To: Greg Snow Cc: r-help@r-project.org Subject: Re: RE: [R] Is it ok to apply the z.test this way? Thanks, OK. My question is if there is any reasonable way to find p=0.05 boundaries for such a random distribution? Unfortunately I'm not statistician and thus I'm not sure, if even this question makes sense... Should we always consider samples of, say, more than 30 individuals? Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ - Original Message - From: Greg Snow greg.s...@imail.org Date: Friday, April 16, 2010 10:07 pm Subject: RE: [R] Is it ok to apply the z.test this way? To: Atte Tenkanen atte...@utu.fi, r-help@r-project.org r-h...@r- project.org Several points: 1. The Shapiro test does not tell you that something is normal or highly normal, only that you don't have enough evidence to disprove that the data came from a normal population (powered for a certain type of deviation from normality). 2. The z.test function is intended to be used as a stepping stone in learning for students, a simple test with unrealistic assumptions to get the ideas, then relax the assumptions and learn about t tests and others. 3. The z test is only used when the population standard deviation is known, you calculate the sd from the data, that is what t tests are for. 4. Calculating the hypothesized mean from the data is backwards. 5. using a sample size of 1 is questionable, doing this 1,000 times without correction is even more questionable. 6. Your code is equivalent to: tmp - seq(0,1, by=0.001) tmp2 - tmp[ abs(tmp-mean(Distribution))/sd(Distribution) 1.96 ] just slower and less memory efficient. 7. None of this establishes what is from an unknown distribution. If you can tell us what your real question is, then maybe we can help with a real solution. So to answer your question of if it is ok to use z.test in that way: Leagally the license says you can use it anyway you want, ethically/morally/aesthetically/or following the intent of the author, No! -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Atte Tenkanen Sent: Friday, April 16, 2010 10:11 AM To: r-help@r-project.org Subject: [R] Is it ok to apply the z.test this way? Dear R-users, I want to check if certain values are from random distribution, that includes values between 0-1. So, it is not really normal even though shapiro.test says it is highly normal... Can I do something like this and think that the values given are right. z.test is from package TeachingDemos. --- SelectedVals=c() for(i in seq(0,1,by=0.001)) { if((z.test(i, mu=mean(Distribution), stdev=sd(Distribution))$p.value)=0.05) SelectedVals=c
[R] Is it ok to apply the z.test this way?
Dear R-users, I want to check if certain values are from random distribution, that includes values between 0-1. So, it is not really normal even though shapiro.test says it is highly normal... Can I do something like this and think that the values given are right. z.test is from package TeachingDemos. --- SelectedVals=c() for(i in seq(0,1,by=0.001)) { if((z.test(i, mu=mean(Distribution), stdev=sd(Distribution))$p.value)=0.05) SelectedVals=c(SelectedVals,i) } --- I have marked the border values given by this script to the histogram of the original random distribution: http://www.ag.fimug.fi/~Atte/62Hist100410.pdf Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ __ 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] Is it ok to apply the z.test this way?
Thanks, OK. My question is if there is any reasonable way to find p=0.05 boundaries for such a random distribution? Unfortunately I'm not statistician and thus I'm not sure, if even this question makes sense... Should we always consider samples of, say, more than 30 individuals? Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ - Original Message - From: Greg Snow greg.s...@imail.org Date: Friday, April 16, 2010 10:07 pm Subject: RE: [R] Is it ok to apply the z.test this way? To: Atte Tenkanen atte...@utu.fi, r-help@r-project.org r-help@r-project.org Several points: 1. The Shapiro test does not tell you that something is normal or highly normal, only that you don't have enough evidence to disprove that the data came from a normal population (powered for a certain type of deviation from normality). 2. The z.test function is intended to be used as a stepping stone in learning for students, a simple test with unrealistic assumptions to get the ideas, then relax the assumptions and learn about t tests and others. 3. The z test is only used when the population standard deviation is known, you calculate the sd from the data, that is what t tests are for. 4. Calculating the hypothesized mean from the data is backwards. 5. using a sample size of 1 is questionable, doing this 1,000 times without correction is even more questionable. 6. Your code is equivalent to: tmp - seq(0,1, by=0.001) tmp2 - tmp[ abs(tmp-mean(Distribution))/sd(Distribution) 1.96 ] just slower and less memory efficient. 7. None of this establishes what is from an unknown distribution. If you can tell us what your real question is, then maybe we can help with a real solution. So to answer your question of if it is ok to use z.test in that way: Leagally the license says you can use it anyway you want, ethically/morally/aesthetically/or following the intent of the author, No! -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Atte Tenkanen Sent: Friday, April 16, 2010 10:11 AM To: r-help@r-project.org Subject: [R] Is it ok to apply the z.test this way? Dear R-users, I want to check if certain values are from random distribution, that includes values between 0-1. So, it is not really normal even though shapiro.test says it is highly normal... Can I do something like this and think that the values given are right. z.test is from package TeachingDemos. --- SelectedVals=c() for(i in seq(0,1,by=0.001)) { if((z.test(i, mu=mean(Distribution), stdev=sd(Distribution))$p.value)=0.05) SelectedVals=c(SelectedVals,i) } --- I have marked the border values given by this script to the histogram of the original random distribution: http://www.ag.fimug.fi/~Atte/62Hist100410.pdf Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ __ 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-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] Is it ok to apply the z.test this way?
Hi, In fact, my original intention is to show that the measurings of the musical data are not random. Here I have a measurement from a composition. http://www.ag.fimug.fi/~Atte/Comp.pdf and here one random composition which I have used, among many others, in order to produce that 'Distribution'. http://www.ag.fimug.fi/~Atte/RandomComp.pdf All the values are averaged over the bars. That's why the curves are so smooth. Is there any way to find such boundaries? Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ - Original Message - From: Christos Argyropoulos argch...@hotmail.com Date: Friday, April 16, 2010 10:24 pm Subject: RE: [R] Is it ok to apply the z.test this way? To: atte...@utu.fi, r-help@r-project.org So .. are you trying to figure out whether your data hasa substantial number of outliers that call into question the adequacy of the normal distro fro your data? If this is the case, note that you cannot individually check the values (as you are doing) without taking into account of the Bonferoni fallacy i.e. small p-values will be found with a respectable frequency as the size of the dataset grows (C Robert discusses this in a preprint in arxiv see http://arxiv.org/PS_cache/arxiv/pdf/1002/1002.2080v1.pdf ) So even though you could check each individual point for normality, testing the whole dataset requires that you apply a Bonferoni correction to your z.tests or use outlier.test from package car to reduce the amount of code you have to write. Regards, Christos Date: Fri, 16 Apr 2010 19:11:19 +0300 From: atte...@utu.fi To: r-help@r-project.org Subject: [R] Is it ok to apply the z.test this way? Dear R-users, I want to check if certain values are from random distribution, that includes values between 0-1. So, it is not really normal even though shapiro.test says it is highly normal... Can I do something like this and think that the values given are right. z.test is from package TeachingDemos. --- SelectedVals=c() for(i in seq(0,1,by=0.001)) { if((z.test(i, mu=mean(Distribution), stdev=sd(Distribution))$p.value)=0.05) SelectedVals=c(SelectedVals,i) } --- I have marked the border values given by this script to the histogram of the original random distribution: http://www.ag.fimug.fi/~Atte/62Hist100410.pdf Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ __ 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. _ Hotmail: Powerful Free email with security by Microsoft. https://signup.live.com/signup.aspx?id=60969 __ 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] Which one is the right test?
Hi, I have a population. Then I have picked one relatively small sub-sample of it using a particular criterion. The means of the whole population and that of the sample seems to differ significantly. The distributions are not normal. What is the right test? Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ __ 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] The greatest common divisor between more than two integers
Hi, Do somebody know if there is a function in R which computes the greatest common divisor between several (more than two) integers? Best, Atte Atte Tenkanen University of Turku, Finland Department of Musicology +35823335278 http://users.utu.fi/attenka/ __ 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] The greatest common divisor between more than two integers
Thanks! I try that. There is in some packege such a function. Atte On Wed, Jul 15, 2009 at 8:55 AM, Atte Tenkanenatte...@utu.fi wrote: Do somebody know if there is a function in R which computes the greatest common divisor between several (more than two) integers? Is there a function for computing the greatest common divisor of *two* numbers? I can't find one, but assume that there is such a function, and call it gcd. Then you could define a recursive function to do the job. Something like new_gcd = function(v) { if (length(v)==2) return(gcd(v)) else return (new_gcd(v[1],new_gcd(v[2:length(v)])) } where v is a vector containing the numbers you want to calculate the greatest common divisor of. -- Michael Knudsen micknud...@gmail.com http://lifeofknudsen.blogspot.com/ __ 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] Saving a big table or matrix
Dear R-users, How do you save a big table or matrix as an independent object and attach it to your Rdata-project when needed? Atte Tenkanen University of Turku, Finland Department of Musicology +023335278 __ 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] Saving a big table or matrix
I had a problem: I saved a matrix: save(Tondistmatrix1, file=/Users/atte/Skriptit/Tondistmatrix1) then I tried to open it with R: Tondistmatrix1=load(/Users/atte/Skriptit/Tondistmatrix1) Tondistmatrix1[1:10,] Error in Tondistmatrix1[1:10, ] : incorrect number of dimensions dim(Tondistmatrix1) NULL So, this didn't work but then I noticed that this is enough load(/Users/atte/Skriptit/Tondistmatrix1) dim(Tondistmatrix1) [1] 3938 3938 No problems any more... Atte Tenkanen University of Turku, Finland Department of Musicology +023335278 - Original Message - From: Gabor Csardi [EMAIL PROTECTED] Date: Friday, February 1, 2008 1:43 pm Subject: Re: [R] Saving a big table or matrix ?save ?load Gabor ps. although i'm not sure what an Rdata-project means, so maybe you need something else On Fri, Feb 01, 2008 at 08:24:32AM +0200, Atte Tenkanen wrote: Dear R-users, How do you save a big table or matrix as an independent object and attach it to your Rdata-project when needed? Atte Tenkanen University of Turku, Finland Department of Musicology +023335278 __ 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. -- Csardi Gabor [EMAIL PROTECTED]UNIL DGM __ 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] Asymmetrically dependent variables to 2D-map?
Hello, I'm searching for a method which maps variables of this kind of table, see below, to 2-dimensional space, like in multidimensional scaling. However, this table is asymmetric: for example, variable T1 affects T2 more than T2 affects T1(0.41 vs. 0.21). DEPTABLE T1T2 T3T4 T1 0.00 0.41 0.24 1.18 T2 0.21 0.00 0.46 0.12 T3 0.80 0.89 0.00 0.20 T4 0.09 1.04 0.17 0.00 Any suggestions? Something like gplot+mds+weighted arrays? Atte Tenkanen University of Turku, Finland __ 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.