Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
1bf2b146
Commit
1bf2b146
authored
Jun 22, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add CONFIDENCE.NORM/CONFIDENCE.T formulas
modify CONFIDENCE
parent
418b3393
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
73 deletions
+98
-73
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+10
-39
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+88
-34
No files found.
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
1bf2b146
...
...
@@ -56,15 +56,11 @@
cFormulaFunctionGroup
[
'
TextAndData
'
]
=
cFormulaFunctionGroup
[
'
TextAndData
'
]
||
[];
cFormulaFunctionGroup
[
'
TextAndData
'
].
push
(
cDBCS
,
cUNICHAR
,
cUNICODE
);
cFormulaFunctionGroup
[
'
Statistical
'
]
=
cFormulaFunctionGroup
[
'
Statistical
'
]
||
[];
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cBINOM_DIST
,
cBINOM_DIST_RANGE
,
cBINOM_INV
,
cCHISQ_TEST
,
cCONFIDENCE_NORM
,
cCONFIDENCE_T
,
cCOVARIANCE_P
,
cCOVARIANCE_S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cFORECAST_LINEAR
,
cHYPGEOM_DIST
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cPOISSON_DIST
,
cQUARTILE_EXC
,
cQUARTILE_INC
,
cSKEW_P
,
cSTDEV_P
,
cSTDEV_S
,
cT_TEST
,
cVAR_P
,
cVAR_S
,
cWEIBULL_DIST
,
cZ_TEST
);
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cBINOM_DIST
,
cBINOM_DIST_RANGE
,
cBINOM_INV
,
cCHISQ_TEST
,
cCOVARIANCE_P
,
cCOVARIANCE_S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cFORECAST_LINEAR
,
cHYPGEOM_DIST
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cPOISSON_DIST
,
cQUARTILE_EXC
,
cQUARTILE_INC
,
cSKEW_P
,
cSTDEV_P
,
cSTDEV_S
,
cT_TEST
,
cVAR_P
,
cVAR_S
,
cWEIBULL_DIST
,
cZ_TEST
);
cFormulaFunctionGroup
[
'
Financial
'
]
=
cFormulaFunctionGroup
[
'
Financial
'
]
||
[];
cFormulaFunctionGroup
[
'
Financial
'
].
push
(
cPDURATION
,
cRRI
);
cFormulaFunctionGroup
[
'
Mathematic
'
]
=
cFormulaFunctionGroup
[
'
Mathematic
'
]
||
[];
...
...
@@ -77,12 +73,11 @@
cFormulaFunctionGroup
[
'
NotRealised
'
]
=
cFormulaFunctionGroup
[
'
NotRealised
'
]
||
[];
cFormulaFunctionGroup
[
'
NotRealised
'
].
push
(
cDAYS
,
cISOWEEKNUM
,
cBITAND
,
cBITLSHIFT
,
cBITOR
,
cBITRSHIFT
,
cBITXOR
,
cERF_PRECISE
,
cERFC_PRECISE
,
cDBCS
,
cUNICHAR
,
cUNICODE
,
cBINOM_DIST
,
cBINOM_DIST_RANGE
,
cBINOM_INV
,
cCHISQ_TEST
,
cCONFIDENCE_NORM
,
cCONFIDENCE_T
,
cCOVARIANCE_P
,
cCOVARIANCE_S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cFORECAST_LINEAR
,
cHYPGEOM_DIST
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cPOISSON_DIST
,
cQUARTILE_EXC
,
cQUARTILE_INC
,
cSKEW_P
,
cSTDEV_P
,
cSTDEV_S
,
cT_TEST
,
cVAR_P
,
cVAR_S
,
cWEIBULL_DIST
,
cZ_TEST
,
cPDURATION
,
cRRI
,
cAGGREGATE
,
cMUNIT
,
cFORMULATEXT
,
cISFORMULA
,
cSHEET
,
cSHEETS
);
cCOVARIANCE_P
,
cCOVARIANCE_S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cFORECAST_LINEAR
,
cHYPGEOM_DIST
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cPOISSON_DIST
,
cQUARTILE_EXC
,
cQUARTILE_INC
,
cSKEW_P
,
cSTDEV_P
,
cSTDEV_S
,
cT_TEST
,
cVAR_P
,
cVAR_S
,
cWEIBULL_DIST
,
cZ_TEST
,
cPDURATION
,
cRRI
,
cAGGREGATE
,
cMUNIT
,
cFORMULATEXT
,
cISFORMULA
,
cSHEET
,
cSHEETS
);
/**
* @constructor
...
...
@@ -216,30 +211,6 @@
cCOMBINA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cCOMBINA
.
prototype
.
constructor
=
cCOMBINA
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cCONFIDENCE_NORM
()
{
cBaseFunction
.
call
(
this
,
"
CONFIDENCE.NORM
"
);
this
.
isXLFN
=
true
;
}
cCONFIDENCE_NORM
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cCONFIDENCE_NORM
.
prototype
.
constructor
=
cCONFIDENCE_NORM
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cCONFIDENCE_T
()
{
cBaseFunction
.
call
(
this
,
"
CONFIDENCE.T
"
);
this
.
isXLFN
=
true
;
}
cCONFIDENCE_T
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cCONFIDENCE_T
.
prototype
.
constructor
=
cCONFIDENCE_T
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
1bf2b146
...
...
@@ -62,7 +62,7 @@
cFormulaFunctionGroup
[
'
Statistical
'
]
=
cFormulaFunctionGroup
[
'
Statistical
'
]
||
[];
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cAVEDEV
,
cAVERAGE
,
cAVERAGEA
,
cAVERAGEIF
,
cAVERAGEIFS
,
cBETADIST
,
cBETA_DIST
,
cBETA_INV
,
cBINOMDIST
,
cCHIDIST
,
cCHIINV
,
cCHISQ_DIST
,
cCHISQ_DIST_RT
,
cCHISQ_INV
,
cCHISQ_INV_RT
,
cCHITEST
,
cCONFIDENCE
,
cCORREL
,
cCOUNT
,
cCOUNTA
,
cCOUNTBLANK
,
cCOUNTIF
,
cCOUNTIFS
,
cCOVAR
,
cCRITBINOM
,
cDEVSQ
,
cCHITEST
,
cCONFIDENCE
,
cCO
NFIDENCE_NORM
,
cCONFIDENCE_T
,
cCO
RREL
,
cCOUNT
,
cCOUNTA
,
cCOUNTBLANK
,
cCOUNTIF
,
cCOUNTIFS
,
cCOVAR
,
cCRITBINOM
,
cDEVSQ
,
cEXPON_DIST
,
cEXPONDIST
,
cF_DIST
,
cFDIST
,
cF_DIST_RT
,
cF_INV
,
cFINV
,
cF_INV_RT
,
cFISHER
,
cFISHERINV
,
cFORECAST
,
cFREQUENCY
,
cFTEST
,
cGAMMA
,
cGAMMA_DIST
,
cGAMMADIST
,
cGAMMA_INV
,
cGAMMAINV
,
cGAMMALN
,
cGAMMALN_PRECISE
,
cGAUSS
,
cGEOMEAN
,
cGROWTH
,
cHARMEAN
,
cHYPGEOMDIST
,
cINTERCEPT
,
cKURT
,
cLARGE
,
cLINEST
,
cLOGEST
,
cLOGINV
,
cLOGNORM_DIST
,
...
...
@@ -1995,46 +1995,100 @@
cCONFIDENCE
.
prototype
.
argumentsMax
=
3
;
cCONFIDENCE
.
prototype
.
Calculate
=
function
(
arg
)
{
var
alpha
=
arg
[
0
],
stdev_sigma
=
arg
[
1
],
size
=
arg
[
2
];
if
(
alpha
instanceof
cArea
||
alpha
instanceof
cArea3D
)
{
alpha
=
alpha
.
cross
(
arguments
[
1
]);
}
else
if
(
alpha
instanceof
cArray
)
{
alpha
=
alpha
.
getElement
(
0
);
}
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
],
true
);
var
argClone
=
oArguments
.
args
;
if
(
stdev_sigma
instanceof
cArea
||
stdev_sigma
instanceof
cArea3D
)
{
stdev_sigma
=
stdev_sigma
.
cross
(
arguments
[
1
]);
}
else
if
(
stdev_sigma
instanceof
cArray
)
{
stdev_sigma
=
stdev_sigma
.
getElement
(
0
);
}
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
argClone
[
2
]
=
argClone
[
2
].
tocNumber
();
if
(
size
instanceof
cArea
||
size
instanceof
cArea3D
)
{
size
=
size
.
cross
(
arguments
[
1
]);
}
else
if
(
size
instanceof
cArray
)
{
size
=
size
.
getElement
(
0
);
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
alpha
=
alpha
.
tocNumber
();
stdev_sigma
=
stdev_sigma
.
tocNumber
();
size
=
size
.
tocNumber
();
var
calcConfidence
=
function
(
argArray
){
var
alpha
=
argArray
[
0
];
var
stdev_sigma
=
argArray
[
1
];
var
size
=
parseInt
(
argArray
[
2
]);
if
(
alpha
instanceof
cError
)
{
return
this
.
value
=
alpha
;
}
if
(
stdev_sigma
instanceof
cError
)
{
return
this
.
value
=
stdev_sigma
;
}
if
(
size
instanceof
cError
)
{
return
this
.
value
=
size
;
}
if
(
alpha
<=
0
||
alpha
>=
1
||
stdev_sigma
<=
0
||
size
<
1
)
{
return
new
cError
(
cErrorType
.
not_numeric
);
}
if
(
alpha
.
getValue
()
<=
0
||
alpha
.
getValue
()
>=
1
||
stdev_sigma
.
getValue
<=
0
||
size
.
getValue
()
<
1
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
not_numeric
);
return
new
cNumber
(
gaussinv
(
1
-
alpha
/
2
)
*
stdev_sigma
/
Math
.
sqrt
(
size
));
};
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
calcConfidence
);
};
/**
* @constructor
* @extends {cCONFIDENCE}
*/
function
cCONFIDENCE_NORM
()
{
cCONFIDENCE
.
call
(
this
);
this
.
name
=
"
CONFIDENCE.NORM
"
;
}
cCONFIDENCE_NORM
.
prototype
=
Object
.
create
(
cCONFIDENCE
.
prototype
);
cCONFIDENCE_NORM
.
prototype
.
constructor
=
cCONFIDENCE_NORM
;
cCONFIDENCE_NORM
.
prototype
.
isXLFN
=
true
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cCONFIDENCE_T
()
{
this
.
name
=
"
CONFIDENCE.T
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cCONFIDENCE_T
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cCONFIDENCE_T
.
prototype
.
constructor
=
cCONFIDENCE_T
;
cCONFIDENCE_T
.
prototype
.
argumentsMin
=
3
;
cCONFIDENCE_T
.
prototype
.
argumentsMax
=
3
;
cCONFIDENCE_T
.
prototype
.
isXLFN
=
true
;
cCONFIDENCE_T
.
prototype
.
Calculate
=
function
(
arg
)
{
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
],
true
);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
argClone
[
2
]
=
argClone
[
2
].
tocNumber
();
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
return
this
.
value
=
new
cNumber
(
gaussinv
(
1.0
-
alpha
.
getValue
()
/
2.0
)
*
stdev_sigma
.
getValue
()
/
Math
.
sqrt
(
size
.
getValue
()));
var
calcConfidence
=
function
(
argArray
){
var
alpha
=
argArray
[
0
];
var
stdev_sigma
=
argArray
[
1
];
var
size
=
parseInt
(
argArray
[
2
]);
if
(
alpha
<=
0
||
alpha
>=
1
||
stdev_sigma
<=
0
||
size
<
1
)
{
return
new
cError
(
cErrorType
.
not_numeric
);
}
//ScTDistFunction aFunc( *this, fAlpha, fSize, nType );
//double fVal = lcl_IterateInverse( aFunc, fSize * 0.5, fSize, bConvError );
var
aFunc
=
new
TDISTFUNCTION
(
alpha
,
size
-
1
,
2
);
var
oVal
=
iterateInverse
(
aFunc
,
size
*
0.5
,
size
);
var
bConvError
=
oVal
.
bError
;
if
(
bConvError
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
var
res
=
(
stdev_sigma
*
oVal
.
val
)
/
Math
.
sqrt
(
size
);
return
new
cNumber
(
res
);
};
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
calcConfidence
);
};
/**
...
...
@@ -5212,7 +5266,7 @@
var
argClone
=
oArguments
.
args
;
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
argClone
[
2
]
=
argClone
[
2
]
?
argClone
[
2
]
:
new
cNumber
(
3
);
argClone
[
2
]
=
argClone
[
2
]
?
argClone
[
2
]
.
tocNumber
()
:
new
cNumber
(
3
);
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
...
...
@@ -5262,7 +5316,7 @@
var
argClone
=
oArguments
.
args
;
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
argClone
[
2
]
=
argClone
[
2
]
?
argClone
[
2
]
:
new
cNumber
(
3
);
argClone
[
2
]
=
argClone
[
2
]
?
argClone
[
2
]
.
tocNumber
()
:
new
cNumber
(
3
);
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment