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
c7bcb46c
Commit
c7bcb46c
authored
Jul 13, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add NEGBINOM.DIST formula
parent
01c6e106
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
20 deletions
+58
-20
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+2
-14
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+56
-6
No files found.
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
c7bcb46c
...
...
@@ -56,7 +56,7 @@
cFormulaFunctionGroup
[
'
TextAndData
'
].
push
(
cDBCS
,
cUNICHAR
,
cUNICODE
);
cFormulaFunctionGroup
[
'
Statistical
'
]
=
cFormulaFunctionGroup
[
'
Statistical
'
]
||
[];
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cBINOM_DIST_RANGE
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cHYPGEOM_DIST
,
c
NEGBINOM_DIST
,
c
PERMUTATIONA
,
cPHI
);
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cHYPGEOM_DIST
,
cPERMUTATIONA
,
cPHI
);
cFormulaFunctionGroup
[
'
Financial
'
]
=
cFormulaFunctionGroup
[
'
Financial
'
]
||
[];
cFormulaFunctionGroup
[
'
Financial
'
].
push
(
cPDURATION
,
cRRI
);
cFormulaFunctionGroup
[
'
Mathematic
'
]
=
cFormulaFunctionGroup
[
'
Mathematic
'
]
||
[];
...
...
@@ -69,7 +69,7 @@
cFormulaFunctionGroup
[
'
NotRealised
'
]
=
cFormulaFunctionGroup
[
'
NotRealised
'
]
||
[];
cFormulaFunctionGroup
[
'
NotRealised
'
].
push
(
cDAYS
,
cISOWEEKNUM
,
cBITAND
,
cBITLSHIFT
,
cBITOR
,
cBITRSHIFT
,
cBITXOR
,
cDBCS
,
cUNICHAR
,
cUNICODE
,
cBINOM_DIST_RANGE
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cHYPGEOM_DIST
,
c
NEGBINOM_DIST
,
c
PERMUTATIONA
,
cPHI
,
cPDURATION
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cHYPGEOM_DIST
,
cPERMUTATIONA
,
cPHI
,
cPDURATION
,
cRRI
,
cAGGREGATE
,
cMUNIT
,
cFORMULATEXT
,
cISFORMULA
,
cSHEET
,
cSHEETS
);
/**
...
...
@@ -324,18 +324,6 @@
cMUNIT
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cMUNIT
.
prototype
.
constructor
=
cMUNIT
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cNEGBINOM_DIST
()
{
cBaseFunction
.
call
(
this
,
"
NEGBINOM.DIST
"
);
this
.
isXLFN
=
true
;
}
cNEGBINOM_DIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cNEGBINOM_DIST
.
prototype
.
constructor
=
cNEGBINOM_DIST
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
c7bcb46c
...
...
@@ -68,12 +68,12 @@
cFORECAST_LINEAR
,
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
,
cLOGNORM_INV
,
cLOGNORMDIST
,
cMAX
,
cMAXA
,
cMEDIAN
,
cMIN
,
cMINA
,
cMODE
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOMDIST
,
cN
ORMDIST
,
cNORM_DIST
,
cNORMINV
,
cNORM_INV
,
cNORMSDIST
,
cNORM_S_
DIST
,
cNORM
SINV
,
cNORM_S_INV
,
cPEARSON
,
cPERCENTILE
,
cPERCENTILE_EXC
,
cPERCENTILE_INC
,
cPERCENTRANK
,
cPERCENTRANK_EXC
,
cPERCENTRANK_
INC
,
cPERMUT
,
cPOISSON
,
cPOISSON_DIST
,
cPROB
,
cQUARTILE
,
cQUARTILE_EXC
,
cQUARTILE_INC
,
cRANK
,
c
RANK_AVG
,
cRANK_EQ
,
cRSQ
,
cSKEW
,
cSKEW_P
,
cSLOPE
,
cSMALL
,
cSTANDARDIZE
,
cSTDEV
,
cSTDEV_S
,
cSTDEVA
,
cSTDEVP
,
cSTDEV
_P
,
cSTDEVPA
,
cSTEYX
,
cTDIST
,
cT_DIST
,
cT_DIST_2T
,
cT_DIST_RT
,
cT_INV
,
cT_INV_2T
,
cTINV
,
cTREND
,
cTRIMMEAN
,
cTTEST
,
cT_TEST
,
cVAR
,
cVARA
,
cVARP
,
cVAR_P
,
cVAR_S
,
cVARPA
,
cWEIBULL
,
cWEIBULL_DIST
,
cZTEST
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOMDIST
,
cN
EGBINOM_DIST
,
cNORMDIST
,
cNORM_DIST
,
cNORMINV
,
cNORM_INV
,
cNORMS
DIST
,
cNORM
_S_DIST
,
cNORMSINV
,
cNORM_S_INV
,
cPEARSON
,
cPERCENTILE
,
cPERCENTILE_EXC
,
cPERCENTILE_INC
,
cPERCENTRANK
,
cPERCENTRANK_
EXC
,
cPERCENTRANK_INC
,
cPERMUT
,
cPOISSON
,
cPOISSON_DIST
,
cPROB
,
cQUARTILE
,
cQUARTILE_EXC
,
c
QUARTILE_INC
,
cRANK
,
cRANK_AVG
,
cRANK_EQ
,
cRSQ
,
cSKEW
,
cSKEW_P
,
cSLOPE
,
cSMALL
,
cSTANDARDIZE
,
cSTDEV
,
cSTDEV_S
,
cSTDEV
A
,
cSTDEVP
,
cSTDEV_P
,
cSTDEVPA
,
cSTEYX
,
cTDIST
,
cT_DIST
,
cT_DIST_2T
,
cT_DIST_RT
,
cT_INV
,
cT_INV_2T
,
cTINV
,
cTR
END
,
cTR
IMMEAN
,
cTTEST
,
cT_TEST
,
cVAR
,
cVARA
,
cVARP
,
cVAR_P
,
cVAR_S
,
cVARPA
,
cWEIBULL
,
cWEIBULL_DIST
,
cZTEST
,
cZ_TEST
);
cFormulaFunctionGroup
[
'
NotRealised
'
]
=
cFormulaFunctionGroup
[
'
NotRealised
'
]
||
[];
...
...
@@ -5366,6 +5366,56 @@
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cNEGBINOM_DIST
()
{
cBaseFunction
.
call
(
this
,
"
NEGBINOM.DIST
"
);
}
cNEGBINOM_DIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cNEGBINOM_DIST
.
prototype
.
constructor
=
cNEGBINOM_DIST
;
cNEGBINOM_DIST
.
prototype
.
argumentsMin
=
4
;
cNEGBINOM_DIST
.
prototype
.
argumentsMax
=
4
;
cNEGBINOM_DIST
.
prototype
.
isXLFN
=
true
;
cNEGBINOM_DIST
.
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
();
argClone
[
3
]
=
argClone
[
3
].
tocNumber
();
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
function
negbinomdist
(
argArray
)
{
var
x
=
parseInt
(
argArray
[
0
]);
var
r
=
parseInt
(
argArray
[
1
]);
var
p
=
argArray
[
2
];
var
bCumulative
=
argArray
[
3
];
if
(
x
<
0
||
r
<
1
||
p
<
0
||
p
>
1
)
{
return
new
cError
(
cErrorType
.
not_numeric
);
}
var
res
;
if
(
bCumulative
){
res
=
1
-
getBetaDist
(
1
-
p
,
x
+
1
,
r
);
}
else
{
res
=
Math
.
binomCoeff
(
x
+
r
-
1
,
r
-
1
)
*
Math
.
pow
(
p
,
r
)
*
Math
.
pow
(
1
-
p
,
x
);
}
return
isNaN
(
res
)
?
new
cError
(
cErrorType
.
not_numeric
)
:
new
cNumber
(
res
);
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
negbinomdist
);
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
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