R - SQUARE is caluclating hurt when I did the math in the Excel spread sheet

Hi all

Any help is appreciated

I have a query that calculates the R_square for all 3 lines A

When I do the calculation of request for the 3 first lines is the correct calculation

Following lines set calculates wrong

I checked the calculation using the formula Rsquare Excel spread sheet
SELECT a.*,
       REGR_R2 (average, prof) OVER (ORDER BY rn
                                     ROWS BETWEEN CASE WHEN MOD (rn, 3) = 0
                                                            THEN 3
                                                       WHEN rn_desc = 1
                                                            THEN  MOD (rn, 3)
                                                       ELSE  0
                                                  END  PRECEDING
                                           AND CURRENT ROW) AS r_square 
FROM   (select b.*,
               row_number() over (order by b.a) rn,
               row_number() over (order by b.a desc) rn_desc
        from   tableaa b
       ) a
ORDER BY  a.a;
1     A     BEG     END     PROF     AVERAGE     REGION     RN     RN_DESC     R_SQUARE     Excel Formula(
2     1     0     0.1     159     159     1     1     14          
3     2     0.1     0.2     159     168     1     2     13          
4     3     0.2     0.3     179     159     1     3     12     0.25          0.25        =RSQ(E2:E4,D2:D4)
5     4     0.1     0.2     250     300     1     4     11          
6     5     0.2     0.3     320     250     1     5     10          
7     6     0.3     0.4     250     380     1     6     9     0.164520715     0.627906977 ===RSQ(E5:E7,D5:D7)
8     7     0.2     0.3     388     379     2     7     8          
9     8     0.3     0.4     379     388     2     8     7          
10     9     0.4     0.5     388     400     2     9     6     0.218256852     0.006756757 ==RSQ(E8:E10,D8:D10)
11     10     1.5     0.6     499     500     2     10     5          
12     11     0.5     0.6     420     448     2     11     4          
13     12     0.6     0.7     520     530     1     12     3     0.973538061     0.971560719 =RSQ(E11:E13,D11:D13)
14     13     0.7     0.8     540     550     1     13     2          
15     14     0.9     1     560     570     1     14     1     1          1           =RSQ(E13:E15,D13:D15)
When i do seperatly i am getting correct value what excel is showing

select REGR_R2 (average, prof) from tableaa
where a in (1,2,3)

REGR_R2(AVERAGE,PROF)
0.25


select REGR_R2 (average, prof) from tableaa
where a in (4,5,6)

REGR_R2(AVERAGE,PROF)
0.627906976744186
create table TABLEAA
(
  A       NUMBER,
  BEG     NUMBER,
  END     NUMBER,
  PROF    NUMBER,
  AVERAGE NUMBER,
  REGION  NUMBER
)
;

prompt Loading TABLEAA...

insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (1, 0, .1, 159, 159, 1);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (2, .1, .2, 159, 168, 1);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (3, .2, .3, 179, 159, 1);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (4, .1, .2, 250, 300, 1);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (5, .2, .3, 320, 250, 1);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (6, .3, .4, 250, 380, 1);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (7, .2, .3, 388, 379, 2);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (8, .3, .4, 379, 388, 2);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (9, .4, .5, 388, 400, 2);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (10, 1.5, .6, 499, 500, 2);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (11, .5, .6, 420, 448, 2);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (12, .6, .7, 520, 530, 1);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (13, .7, .8, 540, 550, 1);
insert into TABLEAA (A, BEG, END, PROF, AVERAGE, REGION)
values (14, .9, 1, 560, 570, 1);
commit;
Published by: user1849 on 22 Sep, 2009 11:59

Published by: user1849 on 22 Sep, 2009 12:00

Hello

"The LINES BETWEEN PREVIOUS AND CURRENT LINE x" means that you do the math on a window containing x + 1 lines (previous lines plus 1 x current rank).
Most desired window is 3 rows, so the largest x should be 2.
Change the 3 literal returned by the expression BOX for 2:

SELECT a.*,
       REGR_R2 (average, prof) OVER (ORDER BY rn
                                     ROWS BETWEEN CASE WHEN MOD (rn, 3) = 0
                                                            THEN 2          -- Not 3
                                                       WHEN rn_desc = 1
                                                            THEN  MOD (rn, 3)
                                                       ELSE  0
                                                  END  PRECEDING
                                           AND CURRENT ROW) AS r_square
FROM   (select b.*,
               row_number() over (order by b.a) rn,
               row_number() over (order by b.a desc) rn_desc
        from   tableaa b
       ) a
ORDER BY  a.a;

The above call to REGR_R2 looks like something I wrote. If I told you to say 'THEN 3', I apologize.

Tags: Database

Similar Questions

  • have problems printing wirelessly on my C510 estn. I get an error message that says: I'm paper when I did the paper

    off message on my c510 estn paper

    I have problems printing wireless to my C510 estn. I get an error message that says: I'm paper when I did the paper

    Hello

    1. what operating system is installed on the computer?

    2. were there any changes (hardware or software) to the computer before the show?

    Perform the steps in the article mentioned below and check if the problem occurs.

    http://bizsupport1.Austin.HP.com/bizsupport/TechSupport/document.jsp?lang=en&cc=us&TaskID=110&prodSeriesId=4073314&prodTypeId=18972&ObjectID=c02248120

    Hope this information helps.

  • I can't find my favorites even though when I did the wizard put in place they were imported

    When I set up mozilla firefox, it showed that import you my favorites but I can't put them anywhere. I presume that is when the bookmark is and I followed one of the explanations on another section of the help, but even after having counted what I was told to check he used to show my favorites

    You can usually find favorites IE imported into a folder ("Internet Explorer") at the bottom of the file Menu Bookmarks (bookmarks > show all bookmarks).

    If you have problems with importing IE bookmarks in Firefox, then export favorites in Internet Explorer to a HTML file and import this file in the Firefox Bookmarks Manager.

    Like that you also preserve any sort you did in Internet Explorer with favorites.

    • Export Favorites in Internet Explorer to a file (bookmarks.html) HTML: file > import and export
    • Import the HTML file in Firefox: bookmarks > show all bookmarks > import and backup > import HTML: from a file

    See also:

  • How can I change my plan when I did the billing period?

    My current plan expired recently, but I would like to change my plan without having been charged to cancel my current plan or pay for another year of use, however I have not had the option change, only to cancel. I don't want to lose my presets or files do not have to cancel, but it doesn't seem to be an option to do so. We know the best way to deal with the issue? I realize that it's my fault for allowing my plan expire.

    Please contact customer service to upgrade the plan. You can use: http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

  • Unable to allow the engine to mercury using openCL, when he did before.

    Hello my fellow artists digital,.

    So I have a laptop with a card of gfx mobilty Radeon 5800. I know that its low with 1 GB and I need a better.

    But here's the thing. The other day I went to edit videos of baby quickie & when I did the new project the normal Mercury engine drop-down is not grey! I had the opportunity to use it on my hardware, IE... No only software mode. It has a great without any problem and made me think that I might not upgrade my lappy so fast.

    SO I went to work on files that makes my computer before studder and today I don't have the option, only software mode.

    I ran a vid card check to make sure it was working & always good; He has done & a. The only change I did anything was moving where I want my zero files which I can't change anything.

    Any reason, that I would have the opportunity to use the reading Mercury on the map engine but now I don't have? Is there a way to change that is not in the new project settings?

    I felt like I saw Elvis in the café-restaurant & when I went with a camera he disappered. Thanks for your help!

    @IdeaJason

    AHa! I'm so smart that I thought about it! I was clicking the CS6 version and not CC. See, smart.

    I guess CS6 won't let you use it and CC is.

    I'm happy to have just a single Sherlocked.  (feel sorta silly to have two full versions and not to change the shortcut on the desktop)

  • Reinstalled FF12 it is now trained yahoo, ebay, google, etc. boomarks when I load the program. How can I STOP pregeneration these bookmarks?

    didn't happen before FF auto update to a newer version which took the bad and I had to restore the system back to the lower version that ran good. Now, he keeps automatically generate these bookmarks that I don't want and I can't stop it doing so.

    That was the problem - updated to 27 FF and it ends up in my old computer. However, I correct the problem - turned off as some sort of add on this is come from God knows where, when I did the system restore. He's fine now

  • Directory disappeared when I copied the directory to the new machine

    I bought a new computer and was moving files from one to the other. I copied an entire directory - subdirectories and files - on the map, and then copied that data on the new machine. The original computer runs Vista. The new computer running Windows 7.

    When I did this, the directory has been eliminated from drive C visible on the original Vista machine. So I tried to overthrow: all that the copy of the new machine back to the existing one. When I did, the existing machine informed me that the files that I had to put on her already existing. I could not just see them. That's nice!

    So, I tried a search in Windows Explorer for files that I knew. Do they not appear unless I did a 'Advanced' search and checked the box "Include non indexed files hidden and system (slower). They came, and so did the directory that I had tried to find.

    This leads me to think that I should re - index the first machine, which is something that I discovered clicking around. However, I'm a little scared of this and thought I'd better ask first. As you can imagine, it's frustrating, because I'm just a regular computer user and not someone who knows a lot about the details. Thanks for any help.

    Win7 has its mysteries.

    Here are a few things to try:

    option 1 - type the address in the address bar in the Solution Explorer and see if the invisible folder will appear again on the list of folders.

    -If Yes, then sometimes the case will resume on the list of files.

    -also check its properties and see if the folder attributes are set to 'hidden '.  you could try to switch the hidden on and out attribute to see if it committed the file to be seen again.

    workarounds are:

    option 2 - create a new folder on the drive as MyFiles and copy the contents of that unstable.  then delete this unstable, c:\files.   If it is still not visible by the browser, then try the delete command via the console drive prompt.

    option 3 - create a shortcut of desk top of the page with the address in the unstable folder which will give you quick access

    option 4 - create a new folder, as MyFiles and copy your files to another computer.

  • When you play the Sims 3 on Windows 7, the system hangs

    Whenever I play my Sims 3 game, the computer just turns. When I did the troubleshooting options it says that the game is inconsistent. How can I make it work again? He only did this until recently

    * original title - programs compatibility Application Applications App Apps game games Legacy Crash crashes Hang hangs *.

    Hi erinbohn,

    Please see the thread with a similar problem and fix possible:

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-windows_programs/Windows-7-crashes-automatically-shuts-down-when-i/e6b61c76-4B7E-4c37-ACBB-02f39f550f6c

    I hope this helps!

  • After I did the update Internet Explorer 11, I lost all my Gadgets?

    When I did the last update, I've lost all my Gadgets on the right side, so how can I get them back, I do not side of the weather display, but all missing?

    Thank you
    Jerry

    Same thing here. Do not use IE, so rolled back the update and everything worked well. More funny thing is: all the gadgets that I continued to fall on my desk... when I returned, they were all there... like 20 clocks!

  • Uh-oh, what did hurt when I downloaded this plug-in?

    Hi people,

    When I downloaded the plug-in for the glow of hawksmont brushes I downloaded it in the plugin file: the path it takes is Program Files/Adobe/Photoshop Elements/plug-ins.

    I don't see them when I opened my Photoshop Editor under brushes. I missed a step when downloading?

    I don't have Photoshop Elements 10 open when I downloaded it.

    Any help is greatly appreciated.

    Those who should be brush does not plugins. If you have unpacked the files, brush sets must go to:

    C:\Program 10\Presets\Brushes of Adobe Photoshop Elements for a 32-bit windows system

    or

    C:\Program Files (x 86) \Adobe\Photoshop 10\Presets\Brushes of the elements of a system of 64-bit windows

    or on a windows system:

    C:\Users\Your Name\AppData\Roaming\Adobe\Photoshop Elements\10.0\Presets\Brushes

    What operating system do you use?

  • where did the sound when I installed 10.11.4?    System preferences do not allow to do me anything for the sound preferences.

    where did the sound when I installed 10.11.4?    System preferences do not allow to do me anything for the sound preferences.

    Are there no icon preferably for sound?

  • When taking picture with the light in the background with the camera back from my iPhone more than 6 s, there is a clear blue colour square (a bit like a reflection of the light) will appear.

    When taking picture with the light in the background with the camera back from my iPhone more than 6 s, there is a clear blue colour square (a bit like a reflection of the light) will appear.

    someone has an idea of what's going on?

    The blue square is the area of the camera is in point and exposure on.

    Tap on the area actually taking a picture of. For example, if you take a photo of someone int eh the room and the bottom is very light (or dark), tap on the face of the person to turn to that.

    See it-> http://iphonephotographyschool.com/how-to-use-iphones-camera-app/

  • With the help of modulated signal pulse width (square wave) to control when a signal is enabled or disable

    With the help of modulated signal pulse width (square wave) to control when a signal is enabled or disable

    Hello all

    I am using a modulated signal to labview created pulse width (square wave) to control when a signal is activated or not.

    Here is my logic and a concrete example:
    (1) the wave source signal is continuous
    (2) use a PWM (square wave) created in labview to control when the signal is enabled or disabled
    (3) if the PWM (amplitude) signal is superior to 0 play signal PWM is not greater than 0 do not play signal.

    I use actually this to the sequence step / pulse several distinct magnetic coils using my audio card (which has several channels of audio output), I have a signal in labview played constantly.  As to compare it to the PWM (square wave) which controls whether or not the signal is played on each separate channel.  That way I can control which coil is on and offshore and in what order they are activated.

    I couldn't find an edge detection for a square wave created in labview, so I tried the limits, but it doesn't seem to work unless I change the phase manually and it only goes 1-1.  I'm just trying to compare the PWM (edges of the square wave) already created by labview / play a signal if the pulse is greater than 0 and it shuts off the signal, if she is less than 0.

    Should I do this another way

    TIA

    A waveform contains an array of values. You must check every value and respond accordingly:

  • When I cut the computer on I have to press ctrl, ALT, DELETE. I'm not sure what I did. Does one know how I can uninstall client services netware fot or a way to solve this problem?

    loging on

    When I cut the computer on I have to press ctrl, ALT, DELETE. I'm not sure what I did. None knows how I can uninstall the client services fot netware or a way to solve this problem thanks, Im using Microsoft Windows XP Professional Version: 5.1.2600

    When I cut the computer on I have to press ctrl, ALT, DELETE. I'm not sure what I did. None knows how I can uninstall the client services fot netware or a way to solve this problem thanks, Im using Microsoft Windows XP Professional Version: 5.1.2600

    It is normal and safe... Do you mean that you have not always press CTRL + ALT + DELETE to log on?

    If you * want * automatic login?

  • I had Cogeco security Anti Virus etc installed on the computer, called and asked them to remove it, and when they did, he deleted Outlook Express too.

    I had Cogeco security Anti Virus etc installed on the computer and called and asked them to remove it and when they did... He also took off my e-mail Outlook Express6 program.  After talking to them... they said was probably altered the outlook express and take off the anti virus program him took off the corrupt outlook express as well.  Can someone tell me where to find a download for outlook express6 for windows xp professional?

    Thank you

    original title: download of outlook express6

    They screwed something. OE is a part of IE6 and both are part of the XP operating system. You can't take off OE is there a standalone download.

    Control Panel | Add/Remove programs. Add/Remove Windows components. OE is checked and restart.

    If OE is verified:

    Right click on the desktop | New | Shortcut. Navigate to "c:\program files\outlook express\msimn.exe". Click next | Click Finish.  It will be a new shortcut on the desktop.

    I would like to know where you are now.

Maybe you are looking for

  • My Podcast will not occur

    We tried again our podcast as it was deleted for some reason any in the itunes store.  I went to 6 validators different sites, including one that suggests Apple, and all of them say that the food is good.  By submitting the food less than a minute I'

  • bars of variable width in the bar chart

    I would like to establish a curve that looks like a bar graph, but I want to be able to specify the width of the bars. For example, if the user enters 0 for the x - min, 6 for the x - max and 5,000 for y - max, then I want to draw a bar that starts a

  • DRIVERS NVIDIA for WINDOWS 7 hp compaq presario CQ 3520IX model: BZ604AAA #CJ

    I want TO INSTALL the NEW DRIVER FOR MY PC - Hp Compaq Presario CQ 3520IX BZ604AAA #CJ MODEL NUMBER AND ALSO TO REGISTER MY COMPUTER ONLINE Send me a message at: {information}

  • Windows 7 - Windows key or Alt + Tab does not

    I have Windows 7 Home Edition, and suddenly my Alt + Tab feature has stopped working.  I use it regularly, so I don't know what I did to disable.  In addition, my Windows (the one next to the left Alt key) key stops working to bring up the Start Menu

  • Update blackBerry Smartphones.99

    When I loaded le.99 on my storm it erased everything and my phone is basically gone brand new, when I updated to autres.85,.90 it didn't happen. help to recover my contacts would be great