Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA with Linest non-equal observations

The Excel function Linest does not return a value if your independant
and dependant variable count :i.e. Linest(C3:C18,D3:D6) do not match.
Is there a way to code this in VBA?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default VBA with Linest non-equal observations

What do you propose to do with observations C7:C18 that have no explanatory
variables?

Jerry

" wrote:

The Excel function Linest does not return a value if your independant
and dependant variable count :i.e. Linest(C3:C18,D3:D6) do not match.
Is there a way to code this in VBA?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default VBA with Linest non-equal observations

Linest works on XY pairs. It isn't designed to work with missing data points.

In your example why wouldn't you use C3:C6, D3:D6

--
Regards,
Tom Ogilvy


" wrote:

The Excel function Linest does not return a value if your independant
and dependant variable count :i.e. Linest(C3:C18,D3:D6) do not match.
Is there a way to code this in VBA?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA with Linest non-equal observations

On Jun 19, 3:16 pm, Tom Ogilvy
wrote:
Linest works on XY pairs. It isn't designed to work with missing data points.

In your example why wouldn't you use C3:C6, D3:D6

--
Regards,
Tom Ogilvy



" wrote:
The Excel function Linest does not return a value if your independant
and dependant variable count :i.e. Linest(C3:C18,D3:D6) do not match.
Is there a way to code this in VBA?- Hide quoted text -


- Show quoted text -


It's a problem when you have a data dump in columns (Linest at the
bottom cell) where there is varying rows between columns- trying to
automate the beta calculation whenever information is updated.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default VBA with Linest non-equal observations

Are you the one that was saying the client wants you to do a t-test based on
using a Beta distribution rather than a Normal distribution. While that
doesn't compute for me, you might take this opportunity to ask Jerry - he has
the Phd in Statistics and may be able to figure out what you are talking
about.

Anyway, you might use dynamic range formulas to only do the Linest on
paired values. http://www.contextures.com/xlNames01.html#Dynamic

--
Regards,
Tom Ogilvy






" wrote:

On Jun 19, 3:16 pm, Tom Ogilvy
wrote:
Linest works on XY pairs. It isn't designed to work with missing data points.

In your example why wouldn't you use C3:C6, D3:D6

--
Regards,
Tom Ogilvy



" wrote:
The Excel function Linest does not return a value if your independant
and dependant variable count :i.e. Linest(C3:C18,D3:D6) do not match.
Is there a way to code this in VBA?- Hide quoted text -


- Show quoted text -


It's a problem when you have a data dump in columns (Linest at the
bottom cell) where there is varying rows between columns- trying to
automate the beta calculation whenever information is updated.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default VBA with Linest non-equal observations

You still have not explained what you want done with all the extra cells.

I will take a wild guess and assume that you have a constant model (D3:D6)
and a data loading process that puts exactly four numeric values in proper
order, but with an unpredictable number of line feeds (<=16) in and around
the data. As a result, I am guessing that you want to align the first
numeric value in C3:C18 with D3, the second numeric value in C3:C18 with D4,
....

The most reliable way to do this in VBA is to loop through the cells in
C3:C18 and populate an array (dimensioned to hold four values) with the
values that you find. That way you can include a diagnostic as to whether
there really are exactly four values or not.

Doing it in an array formula is a bit tricky. If the values in C3:C18 will
always be ascending, you could use

=LINEST(SMALL(C3:C18,{1;2;3;4}),D3:D6)

Otherwise the problem becomes much more messy. The following will work for
the limited size problem that you posed, but does not extend to large sample
sizes

=LINEST(CHOOSE(SMALL(IF(ISNUMBER(C3:C18),ROW(C3:C1 8)),{1;2;3;4})-2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 ,C17,C18),D3:D6)

The more obvious approaches using INDEX(), OFFSET(), or INDIRECT() fail,
because their results are not recognized as arrays within array formulas.

Note that the VBA function EVALUATE() will evaluate the string argument as
though it were an array entered Excel expression.

Jerry

" wrote:

On Jun 19, 3:16 pm, Tom Ogilvy
wrote:
Linest works on XY pairs. It isn't designed to work with missing data points.

In your example why wouldn't you use C3:C6, D3:D6

--
Regards,
Tom Ogilvy



" wrote:
The Excel function Linest does not return a value if your independant
and dependant variable count :i.e. Linest(C3:C18,D3:D6) do not match.
Is there a way to code this in VBA?- Hide quoted text -


- Show quoted text -


It's a problem when you have a data dump in columns (Linest at the
bottom cell) where there is varying rows between columns- trying to
automate the beta calculation whenever information is updated.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA with Linest non-equal observations

Sorry for the late response!

Good approach. Thanks alot- got it, use a loop to match the cells in
an array to retrieve a beta (an index vs a fund). Great!




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 806
Default VBA with Linest non-equal observations

Hello,

You are perhaps looking for an "outlier resistant" beta?

A pragmatic approach:
http://www.sulprobil.com/html/outlie...tant_beta.html

Regards,
Bernd

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default VBA with Linest non-equal observations

You're welcome, glad it helped.

Jerry

" wrote:

Sorry for the late response!

Good approach. Thanks alot- got it, use a loop to match the cells in
an array to retrieve a beta (an index vs a fund). Great!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting number of observations within a date range? Nic Excel Worksheet Functions 7 April 20th 07 09:20 AM
How to find the top 5% observations Bin Excel Discussion (Misc queries) 4 June 26th 06 08:23 PM
Listing Unique Observations Henrik Excel Worksheet Functions 3 February 7th 05 11:16 PM
Number of Observations Diane Excel Discussion (Misc queries) 3 December 21st 04 09:10 PM
Counting Unique Observations Henrik Excel Programming 2 December 20th 04 11:24 PM


All times are GMT +1. The time now is 11:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"