Critical value of students T - function
Hi allWith the help of the contributors to the Forum, I managed to create an Oracle table that reflects T student (T-Stat) used to calculate the confidence intervals. The function created with the help of the user from the forum works as well. The user to function between a sample and the confidence level and the function returns the critical value of t is below a subset of the table:
DF CONFIDENCE_LVL CRITICAL_T_STAT
1 0.001 636.6192487
1 0.1 6.313751514
1 0.05 12.70620473
1 0.01 63.65674115
2 0.001 31.59905458
2 0.1 2.91998558
2 0.05 4.30265273
2 0.01 9.924843201
3 0.001 12.92397864
3 0.1 2.353363435
3 0.05 3.182446305
3 0.01 5.840909309
4 0.001 8.610301581
4 0.1 2.131846782
4 0.05 2.776445105
4 0.01 4.604094871
5 0.001 6.868826626
5 0.1 2.015048372
5 0.05 2.570581835
5 0.01 4.032142983
The degrees of freedom table maximum is 500,000. Tables T can go to infinity, but we left the degrees of maximum freedom to 500,000, and I tried to change the function so that if the degrees of freedom is superior to 500 000 given a user specified confidence interval, the critical T Stat by default to a certain value. Compile, but when I try and enter a sample size greater than 500 001 which equals N-1 degrees of freedom or 500 001, then the function just returns Null. I think it has something to do with the fact that the degrees of freedom superior to 500,000 does not exist in the table and merges. I guess I need to use some sort of function NVL but did not understand how do. Here's the function:CREATE OR REPLACE FUNCTION critical_t_value
( in_sample_size IN NUMBER
, in_confidence_lvl IN NUMBER
)
RETURN NUMBER
IS
return_val NUMBER;
BEGIN
SELECT case when in_sample_size > 500001 and in_confidence_lvl = 0.1 then 1.6450000000
when in_sample_size > 500001 and in_confidence_lvl = 0.05 then 1.9600000000
when in_sample_size > 500001 and in_confidence_lvl = 0.01 then 2.5760000000
when in_sample_size > 500001 and in_confidence_lvl = 0.001 then 3.2910000000
else critical_t_stat end
INTO return_val
FROM students_t_table
WHERE df = in_sample_size - 1
AND confidence_lvl = in_confidence_lvl;
RETURN return_val;
END critical_t_value;
/
The case statements with the default values do not once again I think it's probably because there is no df > 500 000. Any help would be appreciated. I use Oracle 10 g, by the way.Thank you
Published by: spalato76 on March 9, 2013 09:24
Hi spalato
I think it is probably because there is no df > 500 000.
I think you are right, since these FD values are special, not in table - I would like to deal with them than special:
create or replace function critical_t_value
( in_sample_size in number
, in_confidence_lvl in number
)
return number
is
k_max_freedom constant number := 500000;
return_val number;
begin
if in_sample_size > k_max_freedom then
return_val := case in_confidence_lvl
when .1 then 1.6450000000
when 0.05 then 1.9600000000
when 0.01 then 2.5760000000
when 0.001 then 3.2910000000
else null
end;
else
select critical_t_stat
into return_val
from students_t_table
where df = in_sample_size - 1
and confidence_lvl = in_confidence_lvl;
end if;
return return_val;
end critical_t_value;
/
Concerning
Peter
Tags: Database
Similar Questions
-
Can I use data value references with a functional overall?
Can I use data value references with a functional global? I am trying, but it causes problems: I run the attached VI with "new DVR" selected. Then I run it again with "return array" and I get the error 1556: "The reference is invalid. This error might occur because the reference has been deleted." It seems to have forgotten the DVR, but I thought it should be stored in the shift register. Another odd thing: In my VI, if I try to connect the wire shown in "something strange", then the type changes (from U16 array to DBL), i.e. it doesn't recognize the type referenced by the DVR. I want to pass a very large 4-dimensional array between parallel loops with a functional global. To avoid memory problems, I want to use a DVR and in-place element structures. If that's not allowed in Labview, I will try passing it through a user event or notifier. Any problems with those alternatives? Thanks.
I received a response from an engineer applications OR on this subject, and it seems that it is perhaps a problem with Labview. They are working on it, so I'll go ahead and close this discussion.
Thanks for the help,
Allan
-
using the value null with a function
Guys, newbie here
What is the value NULL in function header? Does this mean that I can pass a value zero?
FUNCTION tot_sales
(company_id_in IN company.company_id%TYPE,
status_in IN order.status_code%TYPE: = NULL)
RETURN NUMBER
Hello
dorianpc wrote:
Guys, newbie here
What is the value NULL in function header? Does this mean that I can pass a value zero?
FUNCTION tot_sales
(company_id_in IN company.company_id%TYPE,
status_in IN order.status_code%TYPE: = NULL)
RETURN NUMBER
You can always pass NULL for any argument.
What does this code mean, is that the argument is optional (what, you don't have to spend), and if you do not pass it, status_in will be NULL inside the function.
So call for your function with 1 argument, like this:
t: = to_sales (c);
is equivalent to calling with 2 arguments, like this
t: = to_sales (c, NULL);
where the 2nd argument is null.
-
I'm currently testing our website with CF11. He is currently working with CF8 however after the migration to a new server running CF11 I met the following error.
The value returned by the function of load is not numeric.
The error occurred in
D:/applications/CFusion/CustomTags/NEC/COM/objects/address.cfc: line 263
Called from D:/apps/CFusion/CustomTags/NEC/com/objects/contact. CFC: line 331Called from D:/applications/CFusion/CustomTags/NEC/COM/objects/user.cfc: line 510
Called from D:/applications/CFusion/CustomTags/NEC/COM/objects/user.cfc: line 1675
Called from D:/website/NECPhase2/action. Validate.cfm: line 54
261: < cfif isNumeric (get.idCountry) >
262: < cfset rc = this.objCountry.setID (get.idCountry) >
263: < cfset rc = this.objCountry.load () >
264: < / cfif >
265: < cfset this.sPostcode = get.sPostcode >
Were there any changes between CF8 and CF11 which can cause this error?
Does anyone have any ideas?
The problem is in the charge function. There is a real return at the end of the function. The returntype of the function is set to digital. True is not digital, it will trigger an error.
-
need help to get the value using the REGEXP_REPLACE function.
I am trying to extract the value placed between "< listitems >... < / listitems >" but I am unable to get these value using the REGEXP_REPLACE function.
select REGEXP_REPLACE('<InputParameters></ParamSet><listitems>14545454</listitems></ParamSet></InputParameters>' ,'(<InputParameters>.*<listitems>)(.*)(</listitems>.*<InputParameters>)' ,'\2') from dual;
Can someone please help me achieve this goal.required output: 1454554
Hello
You forgot the / before the last InputParameters. If fix you that, your code will work.
Here is a slightly different way:
SELECT REGEXP_REPLACE ( '
' , '^.*?14545454 (.*?) .*$' , '\1' ) AS listitems FROM dual ;Least to type, the less likely you will have to make typos.
If there are 2 (or more) elements of listitmes, 1 will be returned.From Oracle 11.1, you can also use REGEXP_SUBSTR. I have Oracle 10.2 avaialable now, so I can test the following, but I think you'd say:
SELECT REGEXP_SUBSTR ( '
' , '14545454 (.*?) ' , 1 , 1 , NULL , 1 ) AS listitems FROM dual;When it comes with the text that is or looks to, XML, consider using XML functions.
-
can you help me with this. This error pop up when I run my fla file.
TypeError: Error #1006: value is not a function.
at mdas_fla::MainTimeline/ans()
This is my code:
import flash.events. *;
Import flashx.textLayout.conversion.PlainTextExporter;
equal_btn.addEventListener (MouseEvent.CLICK, years);
function ans(event:MouseEvent):void
{
var op: Array = new Array (String [10]);
var num:Array = new Array(Number[10]);
var dock: String;
result_txt. Text = input_txt.text;
keep = input_txt.text;
var g:int = 0; var ctr:int = 0; var ctr2:int = 0; var str:String ="";
while(g < Hold.Length)
{
If (hold.charAt (g) == '+' | hold.charAt (g) == '-' | hold.charAt (g) == ' *' | hold.charAt (g) == ' / ')
{
OP [ctr] = ' "+ hold.charAt (g);
trace (op [CTR]);
CTR ++; Ctr2 ++; Str ="";
}
on the other
{
Str += ' ' + hold.charAt (g);
NUM [ctr2] = parseInt (str);
trace (num [Ctr2]);
}
g ++ ;
}
var pl:int = 0; var val: Number = 0;
for (var a: int = 0; has < op.length (); a ++)
{
Try
{
If (op [a] == ' *')
{
NUM [pl + 1] = num [pl] * num [pl + 1];
}
ElseIf (op [a] == ' /')
{
NUM [pl + 1] = num [pl] / num [pl + 1];
}
ElseIf (op [a] == '+')
{
NUM [pl + 1] = num [pl] + num [pl + 1];
}
on the other
{
NUM [pl + 1] is [pl] - [pl + 1] num num;.
}
}
catch (error)
{
Val = num [pl];
break;
}
PL ++;
}
trace (Val);
result_txt. Text = "" + val;
}
pls... Help me solve this problem...
Length() must be of length. That is to say, the class array has a length property, no method. Flash thinks you are trying to define a new function, length().
PS so that debugging, click file > publishing settings > swf and check the box "enable debugging" so the number of problematic line of your error (s) is in error messages. This makes it much faster to debug your code.
-
Select the list display value from a javascript function
Hi all
I have a list in tabular form, having a display value and return value.
I use $x (statement) .value or $v (statement) for retreving return the value of the selection list in a javascript function.
Can someone let me know how I can get the display of the selection list value in a javascript function? IM using Apex 3.2
Thank you and best regards,
Sandeep
-
TypeError: Error #1006: value is not a function.
I get this error:
TypeError: Error #1006: value is not a function.
at project_fla::MainTimeline/createMap()
at project_fla::MainTimeline/frame1()The following actionscript code:
[A]
function createMap(target:Object,_map:Array,_tilesize:Number):void {}
for (var ix:Number = 0; ix < card [0] .length; ix ++) {}
for (var iy:Number = 0; iy < map.length; iy ++) {}
This ["t" + String (IX) + "x" + String (iy)] = new Object();
This ["t" + String (IX) + "x" + String (iy)] = new tile();
This ["t" + String (IX) + "x" + String (iy)] .gotoAndStop (Map [ix] [Iy]);
This ["t" + String (IX) + "x" + String (iy)] .x = Flxy (new Point(ix,iy), tilesize) .x;
This ["t" + String (IX) + "x" + String (iy)] = Flxy (new Point(ix,iy), tilesize) there there;
target.addChild (this ["t" + String (ix) + "x" + String (iy)]);
}
}
}{/ A]
What is the problem with the code?
There are go. You must give your clip on stage an instance name - when you select the clip - the name of the instance is the field above the behavior instance drop-down list at the top of the properties panel.
-
Hey!
For some reason, this code is sent errors.
MovieClipArray [1]. URLArray [1] .splice (1,1,MovieClip);
The MovieClipArray is an array of movieclips library that I exported for actionscript. The URLArray was created within their class, as such:
package { import flash.display.*; public class LibraryMovieClip extends MovieClip { public var URLArray:Array=new Array ; public function LibraryMovieClip() { } } }
The error is TypeError: Error #1006: value is not a function.
I'm reasonably certain that it's the above code that gives me any questions because everything goes well when he commented.
In any case, thank you for your time.
I'm classy challenged, I can't deal with this aspect of things very well, but for...
MovieClipArray [1]. URLArray [1] .splice (1,1,MovieClip);
compared to
public var URLArray:Array = new Array(); assuming that your parentheses are there
URLArray is a table, but URLArray [1] is an element of an array, not a picture itself, so that apply the splice method is not valid.
MovieClipArray [1]. URLArray.splice (1,1,MovieClip);
Perhaps more correct, but I don't know if it would be good for what you are trying to do.
-
How to extract the second sysdate value using the EXTRACT function
Hello
I want to extract the second sysdate value using the EXTRACT function.
When I run the following query I get an error;
SELECT extract (second OF SYSDATE) FROM dual;
ORA-30076: field of invalid extract for the source of the extract.
When I do to extract the month I get the correct result.
Is there some necessary formatting by specifying the sysdate (or any other date value) in the query. ?
Thank you.You can extract only the year/month / day, day
SQL> Select extract(year from sysdate) from dual; EXTRACT(YEARFROMSYSDATE) ------------------------ 2008 SQL> Select extract(day from sysdate) from dual; EXTRACT(DAYFROMSYSDATE) ----------------------- 20 SQL> Select extract(month from sysdate) from dual; EXTRACT(MONTHFROMSYSDATE) ------------------------- 11 IF you enter Minute or Seconds SQL> Select extract(minute from sysdate) from dual; Select extract(minute from sysdate) from dual * ERROR at line 1: ORA-30076: invalid extract field for extract source but with timestamp you can get the seconds SQL> select EXTRACT(second FROM current_timestamp) from dual; EXTRACT(SECONDFROMCURRENT_TIMESTAMP) ------------------------------------ 39.473 SQL> select EXTRACT(second FROM current_timestamp) from dual; EXTRACT(SECONDFROMCURRENT_TIMESTAMP) ------------------------------------ 57.474 SQL> / EXTRACT(SECONDFROMCURRENT_TIMESTAMP) ------------------------------------ 59.787 SQL> / EXTRACT(SECONDFROMCURRENT_TIMESTAMP) ------------------------------------ .412 SQL> / EXTRACT(SECONDFROMCURRENT_TIMESTAMP) ------------------------------------ .99 SQL> / EXTRACT(SECONDFROMCURRENT_TIMESTAMP) ------------------------------------ 1.458 SQL> / EXTRACT(SECONDFROMCURRENT_TIMESTAMP) ------------------------------------ 1.896 SQL> / EXTRACT(SECONDFROMCURRENT_TIMESTAMP) ------------------------------------ 2.334
Edited by: Viswarayar Maran on November 20, 2008 14:30
-
Why the different values for an analytic function of the same group/game
I have the suite of table I'll be using.
Select * from table1;
REC_ID | STATUS | DATE_FROM | DATE_TO
1. C | 7 January 2015 |
2. H | December 3, 2014. 6 January 2015
3. H | October 3, 2014. December 2, 2014
4. H | May 30, 2014. October 2, 2014
5. H | May 29, 2014 | May 29, 2014
6. H | April 16, 2014 | May 28, 2014
7. H | Tuesday, April 25, 2007 April 15, 2014
INSERT statement if you need.
TOGETHER TO DEFINE
CREATE THE TABLE1 TABLE:
(
NUMBER OF REC_ID,
VARCHAR2 (1 BYTE) STATUS NOT NULL,.
DATE_FROM DATE NOT NULL,
DATE OF DATE_TO
);
Insert into TABLE1
(REC_ID, STATUS, DATE_FROM)
Values
(1, 'C', TO_DATE (7 JANUARY 2015 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'));))
Insert into TABLE1
(REC_ID, STATUS, DATE_FROM, DATE_TO)
Values
(2, 'H', TO_DATE (3 DECEMBER 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (6 JANUARY 2015 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'));))
Insert into TABLE1
(REC_ID, STATUS, DATE_FROM, DATE_TO)
Values
(3, 'H', TO_DATE (3 OCTOBER 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (2 DECEMBER 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'));))
Insert into TABLE1
(REC_ID, STATUS, DATE_FROM, DATE_TO)
Values
(4, 'H', TO_DATE (MAY 30, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (2 OCTOBER 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'));))
Insert into TABLE1
(REC_ID, STATUS, DATE_FROM, DATE_TO)
Values
(5, 'H', TO_DATE (29 MAY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (29 MAY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'));))
Insert into TABLE1
(REC_ID, STATUS, DATE_FROM, DATE_TO)
Values
(6, 'H', TO_DATE (APRIL 16, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (28 MAY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'));))
Insert into TABLE1
(REC_ID, STATUS, DATE_FROM, DATE_TO)
Values
(7, 'H', TO_DATE (APRIL 25, 2007 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (APRIL 15, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'));))
COMMIT;
I will exercise more analytical query...
Select rec_id date_from, date_to, status,
min (date_from) over (partition by order of status by date_from desc) min_dt_from_grp,
ROW_NUMBER() over (partition by order of status by date_from desc) rownumberdesc,
ROW_NUMBER() over (partition by order of status by ASC date_from) rownumberasc
FROM table1;
the query result
REC_ID | DATE_FROM | DATE_TO | STATUS | MIN_DT_FROM_GRP | ROWNUMBERDESC | ROWNUMBERASC
1. 7 January 2015 | C | 7 January 2015 | 1. 1
2. December 3, 2014. 6 January 2015 | H | December 3, 2014. 1. 6
3. October 3, 2014. December 2, 2014 | H | October 3, 2014. 2. 5
4. May 30, 2014. October 2, 2014 | H | May 30, 2014. 3. 4
5. May 29, 2014 | May 29, 2014 | H | May 29, 2014 | 4. 3
6. April 16, 2014 | May 28, 2014. H | April 16, 2014 | 5. 2
7. Tuesday, April 25, 2007 April 15, 2014. H | Tuesday, April 25, 2007 6. 1
If you look at the output above, it dates back in the min_dt_from_grp column.
MY question is if the analytical function calculates for a particular/set group, which is by statute and for what min (date_from) partition is 25-apr-2007 for the GROUP H (Status column), then why I have different values returned by the query above in the min_dt_from_grp column.
Hello
Because you have specified an ORDER BY clause for the analytical function. In doing so, you calculate the rows on a window. Since you have not specified a windowing clause, the default applies:
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
-
Can I share a value returned by a function of report?
I have two functions of report:
1 counts all occurrences of courses that correspond to a given school year.
2. get a total number of courses
I also need to count occurrences of courses that do not correspond to a given school year. How can I subtract the value of the first report of second report function?
Is there a better way to do it?
As always, try to do as much as you can on the side of the data base.
For example, in Microsoft SQL Server, you could do the following:
SELECT
schoolID, courseID, additionalFields,
CASE WHEN CourseYear = school year THEN 1 0 OTHERWISE END AS CourseYearMatch,
CASE WHEN CourseYear <> CourseYearMismatch AS END school year THEN 1 ELSE 0
TABLENAME
Then, in the report designer, you can use simple calculated fields to adding these two fields to create the desired counties.
See you soon
Eddie
-
Using value as parameter of function data
Hi all
Is it posible on Essbase use values of data as parameters to functions? For example, the code
@CONCATENATE ("AccountMember", "Text")
Returns "AccountMemberText", but I need to get the value in AccountMember concatenated with text, as 123456Text.
So, is it posible to get the value as a string?
Thank you!
Mauro.
Edited by: 992758 03/13/2013 08:36I don't think that's what wants to Mauro, Celvin. If actually 1234 as a data value contains "AccountMember", he wants to return "1234Text", which is arguably a member name.
I don't think it's possible (but I'm willing to be wrong) without a set predefined options and a potentially ugly logic of 'IF'. A CDF would be an option.
-
getting NaN for a value returned by a function
Hello, I am writing for the reason given above. I'm trying to get two values of a function gives me the hypotnuse of a triangle, like this:
var hyp1:Number = getHypotenuseLength(theRotation,a);
var hyp2:Number = getHypotenuseLength ((90-theRotation), b);
Here's the function:
public void getHypotenuseLength(theRotation:Number,_segment:Number):Number {}
var radians = deg2rad (theRotation);
Return segment/Math.cos (radians);
}
values, the 'theRotation', 'a' and 'b', all referred to a certain number, but "hype1" and "hype2" return NaN. If anyone has an idea why please let me know. The function is correct I would say.
You must use the function trace to see what values are being processed in the getHypotenuseLength function.
-
passage of long values of inputItem to function in backing bean
Hello
My grain of support I intend to call the function func1 (Long pAmount)
on my page, there is an inputItem related to the BB.
Thus, by supporting me bean I would achieve the value of long type (oracle db number (10,2)) of the dependent text element.
How can I get a long value? by default, it comes easily under the number ((Number) (itPTPAmount.getValue ()) m:System.NET.SocketAddress.ToString ())
But even if I can't convert it at length;
what I have is through the chain, but this way below divides the fractions:
try {}
ptpAmount = new Long ((itPTPAmount.getValue ()) m:System.NET.SocketAddress.ToString ());
}
catch (Exception e) {System.out.println "(erreur ptpAmount:"+e.getMessage());) "} return ;}
Please notifyGrodno,
Long are integers; they cannot store "fractions".
John
Maybe you are looking for
-
Qosmio G40 - 11 d - every 2-3 minutes freeze the system
Hardware: Computer laptop Toshiba Qosmio G40 - 11 d, bios 2008, OCZ Vertex 3 SSDSoftware: Windows 7 Professional 64-bit all updates from windows update. Problem:Every 2-3 minutes freeze the system - to stop the disc - LED disc controller turned on al
-
Restoring Windows XP on Qosmio G20
Hi all I have problems with my Qosmio running slow and I suspect some virus or Trojan. So I decided to restore my system, but to my surprise, it's that I can't find a windows restore cd. Is this possible? I don't have a CD that said QosmioPlayer Reco
-
Windows Server 2012 BEX problem
Hello, I got Windows Server 2012 and VPS, I am connected by DRC, turned on my Tibia & Bot and 'close this window of DRC' after... 20 ~ minutes... Problem signature: Problem Event Name: BEX Application Name: Tibia.exe Application Version: 10.9.3.0 App
-
Try to restore supported files on an external hard drive.
I have a Windows VIsta operating system that crashed this past year. But just before losing, I used the center of restoration with the Windows backup utility to back up our files. I supported it up to an external hard drive, Toshiba (E :). I see
-
How can I burn a vdeo stored in a file on my computer on a dvd disc?
I've downloaded and saved video files from the internet to my own personal file on my desktop. Now, I try to copy those video files on a dvd - r disc, so I can be played on a standard dvd player, but can not seem to operate. can someone tell me pleas