473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Normal Distribution Table and Graph

I have a query in my database that calculates '# of Days' based on a
start and end date and displays it amongst other fields. What i need to

do now is develop another query that will give me the following 2
columns:
#ofDays Normal Distribution
I have a function that calculates the normal distribution only when
there is a static table/query that holds the mean and stddev of the
#ofDays field. What i wish to do is have a function that uses the
original query with the '# of Days' , calculates the mean and stddev
storing it in a variable and then gives me the normal distribution
values for each value of '#ofDays'.
Any suggestions?

Nov 13 '05 #1
1 6979
atahim wrote:
I have a query in my database that calculates '# of Days' based on a
start and end date and displays it amongst other fields. What i need to

do now is develop another query that will give me the following 2
columns:
#ofDays Normal Distribution
I have a function that calculates the normal distribution only when
there is a static table/query that holds the mean and stddev of the
#ofDays field. What i wish to do is have a function that uses the
original query with the '# of Days' , calculates the mean and stddev
storing it in a variable and then gives me the normal distribution
values for each value of '#ofDays'.
Any suggestions?


If your table is called tblStartStop with a field called NumberOfDays
(or say qryStartStop that calculates NumberOfDays used everywhere
instead) then:

Create a public function:

Public Function P(X As Double, Mu As Double, Sigma As Double) As Double
P = Your function
End Function

then

qryNormalized:
SELECT NumberOfDays, (SELECT Avg(NumberOfDays) FROM tblStartStop) As
Mean, (SELECT StDev(NumberOfDays) FROM tblStartStop) As StdDev,
P([NumberOfDays], [Mean], [StdDev]) AS Px FROM tblStartStop;

Example:

tblStartStop
ID NumberOfDays
1 3
2 5
3 2
4 6
5 3

!qryNormalized:
NumberOfDays Mean StdDev Px
3 3.8 1.6431676725155 0.744
5 3.8 1.6431676725155 0.382
2 3.8 1.6431676725155 0.848
6 3.8 1.6431676725155 0.253
3 3.8 1.6431676725155 0.744

Px values shown are made up. You will likely want to round Px. Note
that Avg and StDev can use expressions, so calculations could actually
be made using the start and stop values themselves if you prefer. I
hope I understood what you wanted. You can also code your own standard
deviation function if you need to adjust n by one because of the
population versus sample degrees of freedom. I didn't look at how
StDev was defined and I was also too lazy to look for other standard
deviation functions in Access.

James A. Fortune

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Christian | last post by:
Hi NG I need to get a normal distribution based on a mean and variance. How do I do that in Java? Is there a standart packet to use? Christian
3
by: Tan Thuan Seah | last post by:
Hi all, I am looking for a way to generate a random number given the variance of a gaussian distribution(or normal distribution). The mean is 0 but the variance will be a user input. Does C++...
5
by: Yudan YI \(OSU\) | last post by:
I want to generate random data from a normal distribution, while I checked the functions, and I found rand(), which returns a pseudorandom integer between zero and RAND_MAX. I am not sure how to...
7
by: Wolfgang Kreuzer | last post by:
Hello all, I have two tables - Projects and ProjectStruct Table Projects contains master records of the projects, ProjectStruct allows to define a project herarchie and contains the fields...
1
by: mahnovetsky | last post by:
Does anybody know of a way to set the format property for a date field in VBA?? I need to set the property to medium so I can display display aussie dates on a graph.. Here is what Im doing: ...
3
by: littlecharva | last post by:
Hi I need to convert a complicated Excel document that's been created by some Maths boffin into a program in C#. I've been doing really well (despite my Mathematical handicap) until I hit the...
2
by: bartsimpson8882002 | last post by:
I was wondering if scipy/numpy has the inverse cumulative normal function, ie the function f in this expression f(scipy.stats.norm.cdf(1.2)) = 1.2 or more generally, a function f which fits...
3
by: ravindarjobs | last post by:
hello friends, i have a table. the table columns change from time to time. i.e they are not constant. colums may increase or decrease. i want to show the values of these table on a Area graph....
8
by: James Kimble | last post by:
Yeah I'm sure this is a stupid question. I've got a javascript source file with functions (creates a bar graph) I want to call from inside an html table cell so that the graph appears in the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.