Prev: whats wrong with this code ?!
Next: color legend
From: François Blumenfeld on 19 Jun 2010 07:47 Thanks Sjoerd! This works very well. I was indeed hoping to return the binning method as well, but this is not so important. The fitting is no problem now that I can build a frequency table from the histogram data. (And, yes, I always want to put an uppercase "L" in "NonlinearModelFit"!) To sum up: Data is imported into Mathematica as a list of time values and a matching list of amplitudes; then I apply {g, {binCounts}} == Reap[ Histogram[ listOfAmplitudesInPa, Automatic, Function[ {bins, counts}, Sow[{bins, counts}]; counts]]] which gives me the frequency table for the raw data using Mathematica's automatic bin width determination (bin width is, e.g., binCounts[[1, 1, 2]] - binCounts[[1, 1, 1]] ). Along with fitting of a curve to this data, this is equivalent to the procedure we use on raw data with Clampfit and Origin. Thanks again, Francois On Jun 18, 2010, at 12:24 AM, Sjoerd C. de Vries wrote: > Hi Fran==E7ois, > > You could use something like > > Reap[Histogram[RandomReal[NormalDistribution[0, 1], 200], > Automatic, (Sow[{#1, #2}]; #2) &]] > > to get at binning and count data. Don't know about binning method, but > you could use one of the named binning methods instead of Automatic > used here if you want to be sure about the method used. > > About NonLinearModelFit. If you don't say what you're doing it's hard > to say what you're doing wrong. One thing I can tell you: > NonLinearModelFit should be spelled with lowercase L. Perhaps that's > your problem? > > Third question: see first question's answer. Counts are included. > > Cheers -- Sjoerd > > > On Jun 16, 11:38 am, Fran==E7ois Blumenfeld <hypotypo...(a)me.com> wrote: >> Hi, >> >> I'm playing around with Mathematica to analyze some electrophysiology >> data; this is on my recreation time, so apologies if the following >> questions are very basic. >> >> I've imported data (pairs of time points and amplitudes) from pClamp >> into Mathematica as lists. The lists are pretty huge (around 150,000 >> elements per list-I've separated times and amplitudes in two lists). >> I've created a histogram of the amplitudes list, letting Mathematica >> decide which binning method to use and the width of the bin. Without >> user input, it actually did a great job at picking bin width and >> binning method; but I don't know how to retrieve that information: >> i.e. what bin width was picked and what binning method used for a >> particular histogram? >> >> My second question is about fitting a multivariate Gaussian >> distribution to a multimodal (usually bimodal) histogram. I've payed >> around with NonLinearModelFit, but for some reason I don't think I'm >> doing it correctly. My third question is related to this: how do I >> retrieve the processed data from the histogram to construct a >> frequency table? I'm guessing that this might in fact be the >> intermediate step I need to complete before being able to fit a curve >> to the histogram data. >> >> Any suggestions welcome! >> >> Francois Blumenfeld-Kouchner > >
|
Pages: 1 Prev: whats wrong with this code ?! Next: color legend |