Dynamic Correlation Matrices

Sep 15, 2014

I have a table that I add rows to via a macro. I am trying to add correlation matrices that find the last row of the table, and include a certain number of rows above that to create a rolling correlation. For example, if I want the 2 week correlation, I would like the last 10 rows of data, but if I add another row, this formula should move down to incorporate the new row and deselect the now 11th day preceding. I do this manually but it is very time consuming.

View 9 Replies


ADVERTISEMENT

Dynamic Ranges For Correlation

Nov 18, 2009

I have a particular issue - i am trying to create a rolling correlation.

lets say you have two variables for 3 different months:

Month1 a x
Month2 b y
Month3 c z

correlation will correlate a-c with t-v

however, come next month - i have to manually drag the ranges for a rolling three month correlation:

Month1 a t
Month2 b u
Month3 c v
Month4 d w

correlation will now correlate b-d with u-w for a the last three months.

I want to automate this as I know what the month is, I can't seem to return the last three months and correlate the data.

I have tried to do this with the database functions, but I think that they break the array relationship of b-d and u-w in the correlation function.

View 9 Replies View Related

Inverse And Multiplication Of Matrices In VBA

Nov 30, 2008

1) I have declared:

Mtrx(20,20) as Integer, where i have a Matrix

1 2 3
1 2 3

How can I do an inverse of this matrix using only VBA commands?

2) I have :
Mtrx(20,20) as Integer, for example :

3 1
2 0

and Mtrx1(20,20) as Integer :
1 2 0
0 1 1

How to multiply these matrices using only VBA ?

View 9 Replies View Related

Multiply Two Matrices With MMULT Macro

Apr 4, 2008

I have two ranges: A1:F1 and A5:A10, 6 elements in each range. When I multiply one by the other I have to enter a formular in some cell (let's say, A14 - we will put the result there): "=MMULT(A1:F1, A5:A10)" and then press Ctrl-Shift-Enter. Very simple.

Question is this: suppose I do not know in advance that I will have 6 elements in each vector, it might be more than 6 or less than six. I will introduce an integer "n", which is the number of elements. Now I have to write a Sub that will perform multiplication. I wrote smth that does not work and I was wondering if someone has ever done this already and can give me a guidance what I am doing wrong. I HAVE ONE CONSTRAINT: I HAVE TO TYPE IN THE FORMULA INTO THE SPREADSHEET VIA VBA (as this will be used further in Solver, which requires formulas to be present in cells).

Y
Sub test()
Dim n
n = 2
Range("A14").Formula = "=MMULT(A1: & Chr(64+n-1)& 1, A5:A & 5+n-1)"
End Sub

I thought it would be equivalent to MMULT(A1:B1, A5:A6).

View 2 Replies View Related

Solving Multiplication Of Two Matrices With Entries Decimal

Mar 16, 2014

Problem solving multiplication of two matrices with entries decimal in vba code:

Code:
Option Explicit

Public MatrixA(30, 30) As Long
Public MatrixB(30, 30) As Long
Public MatrixC(30, 30) As Long
Public RowA As Integer
Public ColA As Integer
Public RowB As Integer
Public ColB As Integer

Function ProperMaticesSizes() As Boolean

[Code] .........

View 1 Replies View Related

Using Matrices In Formulas, Using Letters As Input In Userforms

May 27, 2006

I have a matrix with default probabilities. I have this matrix in my worksheet. The user will give the number of periods to be calculated with and it will result in a new matrix with default periods over time of choice.

Private Sub UserForm_Click()
Dim numberof_text_Change As Single
Dim initial_text_Change As Single

Range("U36:AC44").Select
Selection.FormulaArray = "=matrixpower(R[-10]C:R[-2]C[8],numberof_text.value)"
End Sub

matrixpower is a function that works perfectly well. It takes one matrix as an argument and the number of periods to use. It then simply computes the chosen number of powers of my matrix. I have a userform that has an inputbox called numberof_text which specifies the number of periods that the user wishes to use in calculating the chance of default. Hence I would like to use this variable as an argument in the formulaarray. This doesn't seem to work! I only get "#VALUE!" in every cell. If I replace "numberof_text.value" in the matrixpower function with a number it works fine. What to do?

What the function needs to do is take an argument which is the matrix I have on my spreadsheet. Take the number of times to take powers of the matrix and print it on a pre-specified place on the worksheet. If I cannot use variables with FormulaArrays, then is there another good way of choosing the matrix to use with "powermatrix"?

View 2 Replies View Related

How To Use Correlation In Vba

Feb 25, 2008

concerning the use of correlation in vba. What are my options when i want to calculate a correlation within vba. The variables are all still within vba.

Who knows what formula's i could use to keep everything within vba.

If you don't understand my question please ask so i can try to make it more clear.

View 9 Replies View Related

Correlation Matrix In VBA

Jan 16, 2006

I have code to create a correlation matrix (NxN, where N is the number of columns). This is done by selecting an area that is NxN, entering the function and range, then hitting ctrl +shift + enter (array formula).

However, I want to convert this to accept VBA arrays, rather than a data range, and give the output in form of an array as well.

VB:
Function CorrmatK(dataRange As Object) As Variant
On Error Goto 20
Dim r As Integer, n As Integer, rr As Integer, i As Integer, j As Integer, k As Integer, doit As Integer
Dim x() As Variant, mc() As Double, ss() As Double, m() As Double, ob As Object
r = dataRange.Rows.Count
n = dataRange.Columns.Count

[Code] ......

View 7 Replies View Related

Significance Of Correlation

Oct 30, 2006

I am in the unfortunate position of having to run about 900 correlations with Excel as my only option. Normally this would be fine, but in this case, I need the Pearson's test of significance. The only way I know how to obtain this in Excel is through using a regression, which is incredibly time-consuming. Does anyone have a suggestion how to make the best use of time?

View 11 Replies View Related

Correlation Between Two Different Distributions

Mar 11, 2014

I am using excel to do a monte carlo analysis of a process. Until now, all my distributions have been uncorrelated, but from now I would like to produce distributions with a given correlation. This is a fairly easy process for normal distribution, but in this case one of the distributions is Weibull and the other lognormal. I don't have a stats background, so how to implement this. Producing the two distributions is no problem, but I would now like to be able to alter them or the original formulae so they are correlated properly. If it would greatly simplify the process, the lognormal distribution could be replaced by a normal, but not the weibull.

The formulae I'm using for each is:

View 4 Replies View Related

Correlation Matrix

Jul 25, 2006

I wasn't able to attach the file because it was too big, but you can download it from here www.easygcc.com/correl.rar. On the sheet called " Correlation" there is matrix, I am baiscally trying to fill in the correlation formula into every cell so the matrix is filled out. The data for the correlation calculation comes from the sheet called "Tech Data". I have filled in the correlation formula into a few of the cells as an example, but I don't want to continue doing this manually but rather have a macro do it for me. Otherwise this will take for ever. My macro is also a part of the file, if you would liek to look at it and maybe fix what I already have.

View 4 Replies View Related

Correlation Between Data In Columns

Mar 3, 2014

I am now analysing the ordered correlations of products in a warehouse.For example, I have 16 products (product 1 to product 16) in my warehouse. During last month, there were totally 391 orders (order 1 to order 391). If a product is requested in a ordered, an "X" will be marked as per attached sheet.

Now my goal is to figure out which pair (or even triple) of products are ordered/requested at the same time (or in the same order) for the last month. I intend to use the analasys result to move the more ordered pair/triple products to stay near to each other at the warehouse so it will save the time for picking.

How to do that analysis?

View 8 Replies View Related

Correlation Tables -- Setup

Oct 17, 2005

I'm trying to Pearson Ranks correlation table. This is the formula I'm
using:

=PEARSON(Ranks!$B$3:$B$230,Ranks!B$3:B$230)

This is placed in cell B3. When I copy the formula over to DT3 the formula
correctly adjusts the B in the second part of the formula all the way to DT
and still references the values in the B column.

But I want to now copy this down to C4, D5, E6 and then over to DT for each
so that it correctly makes the correlation table.

View 12 Replies View Related

Correlation Between Random Numbers

Dec 17, 2006

I wonder if you think it can be possible to constraint the RAND function so that it gives off its result commensurate with the result of another RAND function with certain probability N? For example,

Say there are two random functions and the first generates 0,5667 the correlation is at 0,5 so there is a 50% probability that the second random function will generate the result very close to it, say, 0,6012….Do you think the second random function can be tweaked so that it performs in this manner….when there is a 100% correlation – the results of both random functions will agree…when it is 80% it will be very close…..do you think this can be done with NORMINV?

View 9 Replies View Related

Manipulating Matrices (set Zones And Convert It To Another Set Of Zones)

Feb 2, 2010

I have an origin and destination matrix with one set of zones and need to convert it to another set of zones. This involves combining some zones together. I tried a sum if, but it didnt work. I have done the calcs individually but will have to repeat the process so was looking for a wuicker, more efficient and less error risk!
Just to clarify, I have to convert a 23 by 23 matrix into a 14 by 14.

View 9 Replies View Related

Correlation From Pivot Table On 3 Variables?

Dec 6, 2013

see attached pivot table... I believe that there is a statistical relationship between column B & C (together, i.e. their combined effect) upon column D. i.e. (B & C) - have some relationship to effect D.

(1) What formula would I use to measure this correlation?

View 3 Replies View Related

Calculating Correlation Between Two Series Of Data

Dec 13, 2012

I have a list with hundreds of customers. Each customer has two measures (i won't bore you with how they are calculated)

1) % Coverage by Salesman
2) % Of Opportunity Won

What tips and tricks can you give me to take my analysis to the next level? The example is a very limited sample and the data was made up using a formula so correlated very well, i've chucked in a couple of anamlous results to make it a bit more realistic.

One of the main things i would like to see is a correlation "score". I suppose if the two series correlated perfectly then the score would be 100%. The less they correlate, then the lower this score gets....

In business terms, if i can run this rule over thousands of customers and get a good correlation - then it becomes a conversation with the salesman to show them that doing those pesky, boring coverage calls has a measurable impact on sales...and here is the number to prove it...

How I can interpret this data?

View 1 Replies View Related

Formula With Criteria - Correlation List

Jul 29, 2013

I have a product list going down column A, Avg Sale Price List going down Column B, a Margin % List going down Column C, and a Correlation List going down Column D. Here is a small sample of my data.

Product Name
Avg Sale Price
Margin
Correlation

372 Grizzly Salmon Oil Total
48.99
35.31%
-0.423

[Code] ........

View 3 Replies View Related

Display Correlation Between 2 Lists Of Results?

Jun 26, 2014

I am looking for the best way ( or choice of ways) to display the correlation between 2 lists of results.

I have a column of failure percentage rates for engineers that I want to compare against a second column of their compliance rate with a process. There are two levels also. The first set shows the good performers and their compliance, the second showing the poor performers.

My goal is to see whether their compliance with the process has any bearing on their failure rates. The full lists contain data on approximately 400 engineers in each category

(if the the numbers below are not in a proper format, I tried to download the excel converter thingy but the link failed)

faliure rate
Compliance
3.95%
91.40%

[Code]....

View 1 Replies View Related

Return Correlation Coefficient Of 2 Ranges

Jul 23, 2007

I have the monthly data stores column by column, e.g. Column B for Jan 07, Col C for Feb 07 etcetc, so every month I have a new column added to the end then I have some statistical analysis table which calculates such as annual return, standard deviation etcetc

How can I make a button which I can click then it can update to replace the formular with the latest column? for example, =CORREL(B2:B10, G2:G10), col B contains Feb 07 data and G contains June 07, let's say I add another column for July 07 which will be column H and I would like by clicking the button then all formula with col G will be replaced by col H?

View 8 Replies View Related

Calculate Rank Correlation Of 2 Datasets

Nov 26, 2007

I am facing a problem with WorksheetFunction.Correl
I got information, that matching class properties of Worksheetfunction is impossible.
This is my first experience with macro's and I hardly know how to deal with this problem.I got some excel file from my friend and tried to do this in the same way.
Macro was supposed to calculate the Pearson's coefficient of correlation for orders from 1 to 100 of autocorrelation in order to calculate Q Box-Pierce statistic.Data is prices of stocks for some bank and correlation coefficient is calculated for simple returns on stocks.

View 9 Replies View Related

Data From Asymmetric Correlation Table

Feb 20, 2008

I have an array of data (A,B,C,D,...,H) and a correlation/relationship data table (asymmetric data).
Out of the array data, i need to make a combination of 3 data out of 8 AND input the relationship data according to the combination.

I found a problem to take the reference from correlation data.

to help you understand my issue, i attached the file with this posting.

View 5 Replies View Related

Can Select Array For Correlation Based On Value In A Column?

Apr 23, 2014

I am calculating multiple Correlations for long lists of data. I want the correlation based on the value in a given column. In the below example I would like a different correlation for each value in colA and the correlation will be between colC and colD. ColB lists the different people whose data are used for the correlations. In actuality there are 30 or more people for each test. In every case ColC is the same for a given value of ColB (although I doubt that matters). The number of people taking each test varies. I would like a correlation of ColC an ColD for each value of ColA.

Simplified version of my data

ColA ColB ColC ColD
Test1 Fred .75 1
Test1 Max .80 0
Test1 Sara .90 1
Test2 Fred .75 1
Test2 Max .80 1
Test2 Sara .90 0
....
Test100 Fred .75 1
Test100 Max .80 1
Test100 Sara .90 1

View 6 Replies View Related

Existing UDF For Returns Correlation (inputting Price)

Jul 18, 2013

Any existing UDF that will take two ranges of Prices (for stocks) but get their respective returns to then get the correlation of that?

View 4 Replies View Related

Correlation Matrix - Cannot Open Source File

Apr 24, 2014

I have a workbook entitled "Correlation Matrix". I download data from my data provider and then update it in excel each night. I have several worksheets in the workbook, one called "MCC". Today I made a copy of MCC, named MCC2, to experiment, then deleted it. Now, after I update my data in Excel it gives me the msg, "We can't open the source file '(Path)[Correlation Matrix.xlsx]MCC2'".

The data updates fine and all values are correct in the worksheets. I've tried closing and reopening the file, closing and reopening excel, but I'm still getting this msg when updating the data.

View 2 Replies View Related

Correlation Function For Matching Dates Within Range Of Data

Jan 9, 2013

i have 2 columns of number of cars using various roads, taken in the last 30 days. A macro has processed the data in these ranges and changed the outlier values to "Bad" so the formula ignores them.

However in the columns A and C , there are dates that the counts were taken on.

{=IFERROR(CORREL(IF(B4:B33"Bad";IF(D4:D33"Bad";B4:B33)));IF(B4:B33"Bad";IF(D4:D33"Bad";D4:D33)));"0")}

sometimes these dates aren't the same (no data available on christmas in some areas, boxing day in others etc. Obviously this destroys the correlation, as it puts the days out of synchronisation and the correlation falls apart.

Is there any way i can adapt the formula for it to check the dates are the same before correlating? It'd almost be like a vlookup, find the date, if match, add to calculation, if not then go to the next date. i'm happy for it to only correlate 26 of the 30 days if there are that many conflicts.

example for last 6 days performed on the 28th of december (looking for 6 calendar days up to but not including 28th dec.

22/12/2012 9 22/12/2012 Bad 23/12/2012 10 23/12/2012 22 24/12/2012 3 24/12/2012 21 25/12/2012 7 26/12/2012 18 26/12/2012 8 27/12/2012 15 27/12/2012 15 These 2 cells would be blank and this column would only contain values for 5 days.it could only correlate the 3 days of 23, 24 and 27.

Given that i'm going to be correlating this information with a number of locations, each with different reporting dates, filtering the dates before correlating and deleting unmatched dates is not a great option, but I will consider it if there is no other way.

View 9 Replies View Related

Correct VBA Syntax To Reference Cells In Functions (Correlation)

Jan 27, 2009

I trying to populate cells with a correlation function using VBA, I have set up dynamic references/arguments for the fuction to take on however I just can't get it to work. Currently instead of populating the formula into the cell, it's just populates it as a string based on what's entered below =correl(Ystart &":"& yend, xstart&'":"'& xend").

FYI - The correl function takes on two ranges,. I've predefined these below.

Sub testing()

lastcell = ActiveSheet.Range("c575").End(xlUp).Row
firstcell = ActiveSheet.Range("c1").End(xlDown).Row

Ystart = ("b" & firstcell)
yend = ("b" & lastcell)

xstart = ("c" & firstcell)
xend = ("c" & lastcell)

Range("c575:c580").Formula = "=correl(Ystart &":"& yend, xstart&'":"'& xend")"

'this works
'Range(xstart, xend).Select

End Sub

View 9 Replies View Related

Turn List Into Correlation Matrix Error Runtime 1004

May 25, 2014

I am trying to turn a list into a correlation matrix.

Goes like this :

From :
1 1 1
1 2 0.6
1 3 0.7
2 2 1
2 3 0.9
3 3 1

To
1 2 3
1 1 0.5 0.6
2 e 1 0.9
3 e e 1

The first list is from worksheet 1, and im trying to create the matrix in worksheet 2. Both worksheet is in the same open workbook.

Here's the code I've been using

Sub button1_click()
Dim i As Integer
Dim j As Integer
Dim b As Integer
Dim a As Integer
Dim c As Integer

[Code] ........

Now the weird thing is, this worked on a smaller matrix before (31 x 31) but now it just would't work at all (85 x 85)

it keeps giving me the error run time 1004 : application defined or object defined error.

Here's the file : matrix.xlsx

View 1 Replies View Related

Conditional Square Of Pearson Product Moment Correlation Coefficient

Jan 3, 2010

I have a very large spreadsheet, a few columns and rows I attach..

in col a we have the time of the event..in column b i have a numerical rank for the
importance of factor 1,in column c i have similiar for factor 2.

What I want is the correlation for each event between col b and col c using the rsq function..i have no problem using this function..but i need the result for each event produced in col d in this same sheet and printed on each row and since I have thousand of rows i need a formula I can fill down

see attached sheet

View 5 Replies View Related

Correlation Trends: Calculate The Trend Of Correlations Over A 4 Year Period

May 4, 2007

Column A is the COB Date Column B through N are various stock data. I would like to calculate the trend of correlations over a 4 year period. I can't seem to figure out how to manipulate the data analysis tool pak to do this.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved