tag:blogger.com,1999:blog-21748302513152722532014-10-04T20:31:18.758-07:00necessarytesselationTau Centralhttp://www.blogger.com/profile/04639944664204798442noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-2174830251315272253.post-8024152685334969942008-10-05T17:20:00.000-07:002008-10-05T17:27:48.983-07:00Mean-Median Map paperI am SO tired of trying to keep track of pieces of paper.<br /><br /><img src="http://www.wykiwyk.com/images/meanMedianMap_p01.jpg"><br/><br /><img src="http://www.wykiwyk.com/images/meanMedianMap_p02.jpg"><br/><br /><img src="http://www.wykiwyk.com/images/meanMedianMap_p03.jpg"><br/><br /><img src="http://www.wykiwyk.com/images/meanMedianMap_p04.jpg"><br/><br /><img src="http://www.wykiwyk.com/images/meanMedianMap_p05.jpg"><br/><br /><img src="http://www.wykiwyk.com/images/meanMedianMap_p06.jpg"><br/><br /><img src="http://www.wykiwyk.com/images/meanMedianMap_p07.jpg"><br/><br /><img src="http://www.wykiwyk.com/images/meanMedianMap_p08.jpg"><br/><br /><img src="http://www.wykiwyk.com/images/meanMedianMap_p09.jpg"><br/><br /><img src="http://www.wykiwyk.com/images/meanMedianMap_p10.jpg"><br/>Tau Centralhttp://www.blogger.com/profile/04639944664204798442noreply@blogger.com0tag:blogger.com,1999:blog-2174830251315272253.post-48527054156695110752008-05-18T15:54:00.000-07:002008-05-18T16:31:15.812-07:00The Mean-Median MapThis is a review of a paper I obtained at a MAA conference in August of 2007 at the Fairmont in San Jose.<br /><br /><br />authors: Marc Chamberland and Mario Martelli<br />published: Journal of Difference Equations and Applications, Volume 13, Issue 7 July 2007, pages 577 - 583<br /><br />This was trivial, but I just want to have it for reference. Median-maps can be constructed in R with very simple code:<br /><br /><pre><br />> <br />> nums = c(3,4,11)<br />> <br />> for (idx in 1:100) {<br />+ nextTerm = ( median(nums) * ( length(nums)+1 ) ) - sum(nums);<br />+ nums[length(nums)+1] = nextTerm;<br />+ }<br />> plot(nums, type="l")<br />> <br /></pre><br /><br /><img src="http://www.wykiwyk.com/sjsu/math265/medianMap-3-4-11.png">Tau Centralhttp://www.blogger.com/profile/04639944664204798442noreply@blogger.com0tag:blogger.com,1999:blog-2174830251315272253.post-16588918434198976202007-12-04T23:12:00.000-08:002007-12-04T23:21:58.522-08:00Math Resources at SJSU, Part 1I would think that one of the benefits of being a faculty at SJSU would be that one can talk to other colleagues. I find a lot of people using math in general, or statistics in particular, and they do not talk to each other.<br /><br />Various things occur to me, but the most innocuous thing I can do is to collect some information. So, here is a start.<br /><br /><a href="http://www.sjsu.edu/faculty/gerstman/">Bud Gerstman</a><br /> <a href="http://www.sjsu.edu/faculty/gerstman/eks/index.htm">Epidemiology Kept Simple</a><br /> <a href="http://docs.google.com/View?docid=dhk5wtxj_10fvngvv">Supplementary (Unofficial) Web Site for Basic Biostatistics Statistics for Public Health Practice</a><br /> <a href="http://www.sjsu.edu/faculty/gerstman/StatPrimer/">StatPrimer 6.4</a><br /> <a href="http://www.sjsu.edu/faculty/gerstman/EpiInfo/">Data Analysis With EpiInfo and EpiData Analysis</a><br /><br />bus2 090 - Business Statistics (7 sections * 45 students)<br />hs 167 - Biostatistics (5 sections, 1 * 50 and 4 * 24 students)<br />ise 130 - engineering statistics (1 section, 75 students)<br />ise 131 - statistical process control (1 section, 60 students)Tau Centralhttp://www.blogger.com/profile/04639944664204798442noreply@blogger.com0tag:blogger.com,1999:blog-2174830251315272253.post-63590261156322287882007-09-13T11:03:00.000-07:002007-09-13T11:08:29.011-07:00I have been playing with R for one of the classes I am taking this semester. I thought it would be interesting to model a covariant coin in R. It is certainly not trivial. It should not be hard, but R is a quirky environment and a lot of things seem way to complicated in it.<br /><br />For example, right now, I am trying to figure out how to get the number of items in a vector. Heaven forbid there should be a function like count(). Would that just be too easy? Well, I'll figure it out and it will probably seem about as obvious as using "scalar(@list)" in perl.<br /><br />Anyway.<br /><br />So, here are some random things I have found. I do not know the best way to find them, but I found them somehow. So, here they are.<br /><br />* How does one flip a fair coin?<br/><br />* How can one flip a uniformly unfair coin?<br/><br />* How can one flip two coins and have a covariance occur?<br/><br /><br /><h3>How does one flip a fair coin?</h3><br /><pre><br /># I tried variations of rnorm, such as:<br />> rnorm(50)<br /> [1] -0.33805550 -0.86197178 -1.12771806 0.72742962 0.03927931 1.38426924 0.92175284 0.79204301 -0.69652307 1.03105752<br />[11] 1.69153791 -1.74026417 -0.01350978 0.21599462 -0.08565426 -0.26373930 -1.10840322 0.59548152 2.24852825 -0.21409398<br />[21] -0.28769993 -0.83067256 -1.11048383 -1.46584158 -1.67773248 -1.22302638 -0.23192819 -0.58792094 0.58878786 0.32494373<br />[31] 0.61243277 -0.64834829 -0.85173197 -0.04764028 0.77408856 0.07826967 -1.18135820 0.15234143 0.50881794 0.47849280<br />[41] -0.71861064 -0.28603871 1.58796660 -1.47128448 0.79252309 -0.23991624 0.66082809 -2.06752866 0.26841476 -0.36200074<br /><br /># Maybe I can test each of these values? Use some complicated code to test whether it is greater than or less than 0? It turns<br /># out to be simpler than that.<br />#<br />> round(runif(1))<br />[1] 1<br />> round(runif(1))<br />[1] 1<br />> round(runif(1))<br />[1] 0<br />> round(runif(1))<br />[1] 0<br /><br /># This is flipping a coin each time.<br />#<br /># runif generates a random number or a uniform distribution between two numbers. The first parameter is the number of numbers<br /># The second is the min, defaults to 0, and the third is the max, defaults to 1.<br />#<br /># The round() functions rounds, as you would expect.<br />#<br /># This is flipping a coin 1000 times.<br />#<br />sum(round(runif(1000)))<br />[1] 491<br />sum(round(runif(1000)))<br />[1] 526<br /><br /># There is another way to flip a coin also.<br />#<br />> sample(c(0,1), 50, replace=TRUE)<br /> [1] 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 1 0 0 1 0 1 1 1 0 1 1 1 1 1 1 0 0 0 0 1 1 0 0 1 1<br /><br /># This takes 50 samples from the vector = (0,1). This works especially well for dice with different numbers of sides.<br />#<br /># First, 50 rolls of a 6-sided die, and then 50 rolls of an 8-sided die.<br />#<br />> sample(c(1:6), 50, replace=TRUE)<br /> [1] 4 6 1 6 1 4 1 2 5 6 4 1 4 4 5 4 4 2 4 1 2 6 3 2 5 3 4 2 4 4 2 6 4 6 5 5 5 1 3 4 5 5 3 5 1 2 3 5 2 6<br />> sample(c(1:8), 50, replace=TRUE)<br /> [1] 7 1 8 8 8 8 4 4 8 8 1 3 6 1 5 7 2 7 5 8 7 2 5 2 3 7 4 2 7 6 8 8 7 1 8 4 6 3 2 1 3 5 7 2 3 6 5 6 2 8<br /></pre><br /><br />With thanks to: http://homepage.psy.utexas.edu/Homepage/Class/Psy394U/Cormack/DYIStats/readings/ChXcounting4.pdf<br /><hr><br /><br /><h3>How can one flip a uniformly unfair coin?</h3><br /><pre><br /># One can give a vector of probability to the sample. One gives a probability to each choice for the sample. The probabilities<br /># do not need to add up to 1, but it would be good if they did. They at least need to be non-negative.<br />#<br /># Throw an unfair coin weighted for heads, which is 0.<br />#<br />> sample(c(0,1), 50, replace=TRUE, prob=c(0.75, 0.25))<br /> [1] 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0<br /><br /># Throw an unfair die, weighted on 6. If 6 is most likely, 1 is least likely, with the others in between.<br />#<br />> myprobs = c(1/6-13/100, 1/6-3/100, 1/6-3/100, 1/6-3/100, 1/6-3/100, 1/6+25/100)<br />> <br />> sample(c(1:6), 50, replace=TRUE, prob=myprobs)<br /> [1] 2 3 6 1 6 5 2 6 6 6 3 6 6 4 6 6 5 5 2 3 6 3 1 4 6 6 6 6 4 2 3 6 6 2 6 6 6 3 6 2 5 6 6 3 3 2 4 4 6 6<br />> sample(c(1:6), 50, replace=TRUE, prob=myprobs)<br /> [1] 6 5 3 4 4 2 4 6 5 6 6 6 6 5 6 5 6 3 1 5 6 6 4 6 6 6 6 6 2 3 6 4 2 5 1 3 3 6 6 6 6 6 6 4 6 5 4 6 6 2<br />> sample(c(1:6), 50, replace=TRUE, prob=myprobs)<br /> [1] 1 6 2 4 3 6 2 5 6 6 6 4 6 6 4 6 6 6 2 2 2 3 4 2 5 1 6 6 6 3 6 6 4 6 6 5 5 6 4 6 6 6 4 1 6 3 2 6 4 6<br /></pre><br /><br /><br />Again, a thank you to http://homepage.psy.utexas.edu/Homepage/Class/Psy394U/Cormack/DYIStats/readings/ChXcounting4.pdf<br /><hr><br /><br /><h3>How can one flip two coins and have a covariance occur?</h3><br /><br />This can happen if one coin "admires" the other and follows it. Imagine you are throwing a quarter and a nickel. The quarter is true. But about 50% of the<br />time, the nickel is able to follow the quarter. The other 50% of the time, the coin is true. There should be a covariance. How can one do this in R?<br /><br /><pre><br /># Flip a quarter 100 times.<br />#<br />quarters = round(runif(100))<br />#<br /># Flip a coin to see if the nickel "wins". If it wins, it follows the quarter. If it loses, it flips and takes that value.<br />#<br />> nickels = numeric()<br />> for (tails in quarters) {<br />+ if (round(runif(1))) {<br />+ nickels = c( nickels, round(runif(1)) )<br />+ } else {<br />+ nickels = c( nickels, tails )<br />+ }<br />+ }<br />> cov(quarters, nickels)<br />[1] 0.1278288<br /></pre>Tau Centralhttp://www.blogger.com/profile/04639944664204798442noreply@blogger.com0