473,395 Members | 1,558 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,395 software developers and data experts.

Finding optimal values using vba/queries

Hi,

I am currently trying to automate a process that I have been studying
the manual results from for a while. The process simply identifies
events that meet certain criteria and at the moment it then requires
human interaction to decide what to do next (is a seperate process run
or not). I have set up the process to do this automatically based on a
couple of variables calculated but I am having a few problems
optimising the data to find these variables.

In order to increase the 'correctness' of the system I need to run an
optimisation weekly to take into account any new data collected. The
collected data takes the following form:
x Value Result
6 37 A
6 19 A
7 25 A
8 9 N
9 15 A
11 18 A
What I need to do is find a formula that calculates a value for each
x, above which the secondary process is run (A) and below which it
isn't (N). This isn't as simple as fitting a best fit line as in this
example the best fit line would take the form y=134.63x^-0.9706 which
would only be correct 50% of the time. If we instead use y = x^1.125
then it is correct 100% of the time. The underlying thing is that it
doesn't matter if I am 0.1 or 50 above the line, it will be actioned
and likewise, it won't be no matter how far below the line.

At the moment I run a series of queries that take each row and combine
it with a selection of m and c value (y=mx^c) and decide if for that
selection of values if that row would be correctly predicted or not.
When it has done this for every row (about 100x100 combinations) it
looks for the combination that is most accurate. This is obviously
time consuming and, as there are upwards of 90 datasets, it creates
loads of 'ghost' tables that bloat the database and can only be
removed by compacting.

What I am hoping is that someone has done something similar before or
has an idea how I could speed up the process without losing accuracy
or resolution (indeed I hope to increase this). I have tried exporting
data to excel to use solver but that can't deal with the non-linearity
and I can't afford Premium Solver (although having used the trial
version, that does work). I have also tried looping through a vba code
but can't help but create temp tables.

If anything written isn't clear or you need more data please ask.

Mike

ps. I'm using Office 2003 on Windows XP Professional

Feb 7 '07 #1
1 2308
On Feb 7, 6:30 am, "Mike Heywood" <michael.heyw...@easyjet.comwrote:
Hi,

I am currently trying to automate a process that I have been studying
the manual results from for a while. The process simply identifies
events that meet certain criteria and at the moment it then requires
human interaction to decide what to do next (is a seperate process run
or not). I have set up the process to do this automatically based on a
couple of variables calculated but I am having a few problems
optimising the data to find these variables.

In order to increase the 'correctness' of the system I need to run an
optimisation weekly to take into account any new data collected. The
collected data takes the following form:
x Value Result
6 37 A
6 19 A
7 25 A
8 9 N
9 15 A
11 18 A
What I need to do is find a formula that calculates a value for each
x, above which the secondary process is run (A) and below which it
isn't (N). This isn't as simple as fitting a best fit line as in this
example the best fit line would take the form y=134.63x^-0.9706 which
would only be correct 50% of the time. If we instead use y = x^1.125
then it is correct 100% of the time. The underlying thing is that it
doesn't matter if I am 0.1 or 50 above the line, it will be actioned
and likewise, it won't be no matter how far below the line.

At the moment I run a series of queries that take each row and combine
it with a selection of m and c value (y=mx^c) and decide if for that
selection of values if that row would be correctly predicted or not.
When it has done this for every row (about 100x100 combinations) it
looks for the combination that is most accurate. This is obviously
time consuming and, as there are upwards of 90 datasets, it creates
loads of 'ghost' tables that bloat the database and can only be
removed by compacting.

What I am hoping is that someone has done something similar before or
has an idea how I could speed up the process without losing accuracy
or resolution (indeed I hope to increase this). I have tried exporting
data to excel to use solver but that can't deal with the non-linearity
and I can't afford Premium Solver (although having used the trial
version, that does work). I have also tried looping through a vba code
but can't help but create temp tables.

If anything written isn't clear or you need more data please ask.

Mike

ps. I'm using Office 2003 on Windows XP Professional
I might be able to help. Let me give my perspective about it so that
you can help me understand the problem. I had a little trouble
following you in a few spots.

Equations of the form y = m x ^ c were called power curves in my
engineering classes. Finding m and c is a problem that comes up in
engineering quite often because many empirical relationships have this
form. If the data creates a straight line on a logarithmic or semi-
logarithmic plot it's possible to adjust a least-squares best fit line
to the situation:

Y = m X ^ c

log Y = m + c * log X (log can be any convenient base; suitable X and
Y values)

Thus the logarithms of the data points (Xi, Yi) can be used with the
basic equations to find m and c by using log Y in place of Y and log X
in place of X. Note that a correlation coefficient should be used to
determine how well the curve fit. Then for a given value you can use:

Sgn(Ys - m Xs ^ c)

to determine whether a newly sampled point (Xs, Ys) is above (1), on
(0) or below the best fit curve (-1).

I show the basic equations here:

http://groups.google.com/group/comp....f7af5f9a498f39

James A. Fortune
CD********@FortuneJames.com

Feb 7 '07 #2

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

Similar topics

2
by: Gary | last post by:
I am working with a report generator that is based on SQL Server 2000 and uses ASP as the UI. Basically we have a set of reports that end users can execute through a web browser. In general the...
10
by: M Bourgon | last post by:
I'm trying to figure out how to find the last whitespace character in a varchar string. To complicate things, it's not just spaces that I'm looking for, but certain ascii characters (otherwise,...
6
by: GSpiggle | last post by:
I have a database with records that should have a consecutive number ID (Check Register). Also has other records (deposits and adjusting entries) that don't fit in the number range so...
1
by: JM | last post by:
Hello, Using Access 2000 queries, you can reference(pass) form values directly using syntax like Forms!frmPaint!txtColor. I want to do a pass through query to SQL Server 2000, but I don't know...
2
by: User 2084 | last post by:
Hello all. I'm an access newbie trying to learn how to do basic database data manipulations. I had a hard time searching the archives on this question as I don't really know what I'm looking for in...
1
by: sk | last post by:
I have the following table CREATE TABLE Readings ( ReadingTime DATETIME NOT NULL DEFAULT(GETDATE()) PRIMARY KEY, Reading int NOT NULL ) INSERT INTO Readings (ReadingTime, Reading)...
2
by: ElkGroveR | last post by:
Hi there! I'm using PHP to create a simple, dynamic MySQL SELECT query. The user chooses a selection from a HTML Form SELECT element's many options and submits the form via a POST action. ...
1
by: kenny Ajram | last post by:
hi everybody, i have a rather short and possibly easy question: i have two tables and want to find all unequal datasets. for instance like this: i have a table A holding fields id and x and a...
1
by: Rudolf Bargholz | last post by:
Hi, We have created triggers to log modifications to tables in our application. The triggers work fine, just on one of the tables in our database the triggers fail with the error message...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.