Jump to content

ecoli

Moderators
  • Posts

    8639
  • Joined

  • Last visited

Everything posted by ecoli

  1. if salary is related to the demand of labor, then judging by salaries in the sciences I'd say no.
  2. correction... it would work given an arbitrary number of numeric symbols to pick from.
  3. Although loops in R are much less efficient I believe my function is generalizable to any base, just replace the 3's with the desired base (or a replace with a variable for user input)
  4. A solution written in R convert.ternary <- function(int) { unit.factor <- 1 mult.factor <- 1 total <- 0 ternary <- 0 while (mult.factor <= int) { temp <- trunc((int-total)/mult.factor) %% 3 total <- total + temp ternary <- ternary + (temp * unit.factor) unit.factor <- unit.factor * 10 mult.factor <- mult.factor * 3 } return(ternary) }
  5. hint - a di-deoxy primer prevents elongation
  6. Firefly... oh yeah
  7. That's a fair point, but doesn't necessarily prove that subsidies will scale. For example, if more subsidies increases the scope of solar manufacturing in the US, it doesn't necessarily follow that labor costs would scale the same way they would in China (or wherever). Aside: I'm all for ending oil subsidies, as you may know. Forgot another potential aspect to this: if by "maintaining the economy" you mean a stable/ no net-growth economy, this could lower the standard of living/employment/etc if it means GDP per capita falls.
  8. For #1 - try setting both parts (in paranthesis) equal to zero and solve for x. Sometimes, there's more than 1 value of x which satisfies an equation.
  9. If it's not on NCBI, than maybe it hasn't been fully sequences yet. You can try: http://www.plantgdb.org/ What's the scientific name?
  10. I recommend a command line program (such as R or S) to increase your computational power. However, if you just want a graphing feature that beats excel, I've used Prism and thought it was a step up (it's not free)
  11. If you integrate over total lifetime happiness, you're more likely to have more happiness in your life if you live forever. OTOH, you don't get much utility from not being alive.
  12. But on the other hand, regulators don't really do a better job than the market at directing efficiency. Gov't subsidies aren't really helping American photo-voltaic manufacturers. Though I suppose this has somewhat do with labor costs in the US (which you can also think of as an efficiency problem... it's simply not efficient to have some types of jobs here).
  13. I've heard that you should drain a battery fully before re-charging. Also, don't run the computer while re-charging, and then recharge to full battery. If you're running low on battery and don't have a spare, take the battery out and just run off of AC (with no battery). Anyone want to confirm that this is the way to do it?
  14. The benefit is, if you have a JVM, the bytecode will work universally on any machine. For languages without a interpreter (like C++), you have to compile the source code into a machine language, which aren't generally aren't compatible between different types of machines. Especially back in the old days, if you wanted to run a C++ script on a PC or a Mac, you'd have to recompile the source code on the new machine. With Java, once you compile the source into bytecode, it'll work on any machine (with a JVM).
  15. link? edit: sorry. I'm an idiot. you meant your SFN blog.
  16. Yeah but you are right that he's estimating the probability distribution differently because he's using a histogram (fixed that problem, btw, my data points are being split up into equal bins now). That assumption probably won't work with real data though.
  17. Ahh. damn I see what's going on a bit better now, and rebinning into equal portions definitely helped.
  18. sorry i think we crossposted, but this just doesn't seem like what's going on in equation 17. He's taken N out of each k term, but adds it into the MI calculation separately.
  19. Then is equation 17 in the paper incorrect?
  20. ah shit. I hope this is the major problem I've been having. I'm looking for an easy solution in R to cut a vector into equal bins. Histogram does it, but only to plot data. weird.
  21. http://bioinformatics.oxfordjournals.org/content/18/suppl_2/S231.full.pdf I'm not sure that it matters the bins are not formed the same. For example if your comparing two lists of different types the only thing that should matter is the probability distribution, not the exact numbers. In R, the cut function creates a list that looks something that replaces an exact number with a range, like (0.43,0.616], which is not numeric type. I can create a frequency table that counts how many times each range is present in the list. I have to do a character match to find the associated frequency. in the table, which I think is the marginal distribution (divided by N). The probability of the intersection is the frequency that both ranges appear at the same time in both lists. Unless I've misunderstood. Thanks a bunch for your help so far, btw.
  22. Personally, I wouldn't drink Corona at any temperature, but probably as cold as possible to numb you tastebuds. Wait, what was the question? ...
  23. So it's because i'm taking a log of a fraction < 1, which I guess means i'm doing the calculation incorrectly.
  24. Hi all, I'm writing this code in R and it should be relative straight forward, but I keep running into negative numbers, which MI should NOT have! Not sure if the code is buggy or if I'm getting the math wrong. Am I correct in thinking there should be 1 value for MI between each number in an associated list? First the pseudocode: 1 initialize parameters 2 Generate 2 lists of random numbers btw 0,1 called x and y 3 cut number list into bins 4 create frequency table for number of counts in each bin 5 create function to calculate marginal distribution of binned x for every x find the frequency of that value in x save as ki Do the same for y and call it kj 6 create function to calculate joint distribution of x and y a. generate frequency table for every x and y combo for every x and associated y find the frequency of that combination in the data call it kij 7 calculate mutual information (mi) mi = 0 for each value taken by x { sum = 0 for each value taken by y: { kij = find freq where x and y are associated ki = find freq of x kj = find freq of y sum = sum + kij * log2(kij/(ki*kj)) } mi = mi + sum } Here's the actual code in R [font="Courier New"]#calculate MI of random variables. Notation is taken from Steuer, et al. 2002 #Set sample size & bin number N <- 30 bins <- 2 #Generate N random "data" points for x and y in the space [0,1] x <- runif(N, 0, 1) y <- runif(N, 0, 1) #Cut x and y into bins xcut <- cut(x, bins) #ai ycut <- cut(y, bins) #bj #create frequency table for counts per bin xfreq <- data.frame(table(xcut)) #table for kis yfreq <- data.frame(table(ycut)) #table for kjs #script for reading freq table into kis/kjs #b/c cutting data into bins leads to weird character types ki.find <- function(n) { #### n <- xcut[i] for (k in 1:bins) { if (as.character(n) == xfreq$xcut[k]) { ki <- xfreq$Freq[k] return(ki) } } } kj.find <- function(m) { #### n <- ycut[i] for (l in 1:bins) { if (as.character(m) == yfreq$ycut[l]) { kj <- yfreq$Freq[l] return(kj) } } } #kij is the joint prob distribution, #AKA freqency that 2 bins are associated at a (x,y) point cut.table <- as.data.frame(table(xcut,ycut)) kij.find <- function(p) { for (g in 1:(2*bins)) { if (as.character(xcut[p]) == cut.table$xcut[g] && as.character(ycut[p]) == cut.table$ycut[g]) { kij <- cut.table$Freq[g] } } return(kij) } #start with assumption of no MI #then calculate MI MI <- 0 for (i in 1:N) { sum.temp <- 0 for (j in 1:N) { ki <- ki.find(xcut[j]) kj <- kj.find(ycut[j]) kij <- kij.find(j) sum.temp <- sum.temp + (kij * log2((kij/(ki*kj)))) sum.temp2 <- (sum.temp/N) } MI <- c(MI, log2(N) + sum.temp2) } [/font] sample output is: > MI [1] 82.288187 44.607130 36.576861 28.348042 20.119224 11.890405 [7] 3.661586 -4.567232 -12.796051 -21.024870 -29.253688 Please help me!!!
  25. Human biodivesity can be interesting to study pre-recorded history, evolution and genetic diseases. For all interested, I highly recommend following Razib Khan's blog: Gene Expression: http://blogs.discovermagazine.com/gnxp/ Isn't this a good argument for studying human biodiversity/genetics? So when ignorant racists try to make argue, we have real and complete science to point out the flaws?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.