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
380931fe
Commit
380931fe
authored
Jun 30, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add SKEW.P formula
parent
0ff883ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
48 deletions
+97
-48
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+2
-14
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+95
-34
No files found.
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
380931fe
...
...
@@ -59,7 +59,7 @@
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cBINOM_DIST_RANGE
,
cCHISQ_TEST
,
cCOVARIANCE_P
,
cCOVARIANCE_S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cHYPGEOM_DIST
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cS
KEW_P
,
cS
TDEV_P
,
cSTDEV_S
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cSTDEV_P
,
cSTDEV_S
,
cT_TEST
,
cVAR_P
,
cVAR_S
,
cWEIBULL_DIST
,
cZ_TEST
);
cFormulaFunctionGroup
[
'
Financial
'
]
=
cFormulaFunctionGroup
[
'
Financial
'
]
||
[];
cFormulaFunctionGroup
[
'
Financial
'
].
push
(
cPDURATION
,
cRRI
);
...
...
@@ -75,7 +75,7 @@
cERF_PRECISE
,
cERFC_PRECISE
,
cDBCS
,
cUNICHAR
,
cUNICODE
,
cBINOM_DIST_RANGE
,
cCHISQ_TEST
,
cCOVARIANCE_P
,
cCOVARIANCE_S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cHYPGEOM_DIST
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cSKEW_P
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cSTDEV_P
,
cSTDEV_S
,
cT_TEST
,
cVAR_P
,
cVAR_S
,
cWEIBULL_DIST
,
cZ_TEST
,
cPDURATION
,
cRRI
,
cAGGREGATE
,
cMUNIT
,
cFORMULATEXT
,
cISFORMULA
,
cSHEET
,
cSHEETS
);
...
...
@@ -559,18 +559,6 @@
cSHEETS
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cSHEETS
.
prototype
.
constructor
=
cSHEETS
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cSKEW_P
()
{
cBaseFunction
.
call
(
this
,
"
SKEW.P
"
);
this
.
isXLFN
=
true
;
}
cSKEW_P
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cSKEW_P
.
prototype
.
constructor
=
cSKEW_P
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
380931fe
...
...
@@ -70,7 +70,7 @@
cLOGNORMDIST
,
cMAX
,
cMAXA
,
cMEDIAN
,
cMIN
,
cMINA
,
cMODE
,
cNEGBINOMDIST
,
cNORMDIST
,
cNORMINV
,
cNORMSDIST
,
cNORMSINV
,
cPEARSON
,
cPERCENTILE
,
cPERCENTILE_EXC
,
cPERCENTILE_INC
,
cPERCENTRANK
,
cPERCENTRANK_EXC
,
cPERCENTRANK_INC
,
cPERMUT
,
cPOISSON
,
cPOISSON_DIST
,
cPROB
,
cQUARTILE
,
cQUARTILE_EXC
,
cQUARTILE_INC
,
cRANK
,
cRANK_AVG
,
cRANK_EQ
,
cRSQ
,
cSKEW
,
cSLOPE
,
cSMALL
,
cSTANDARDIZE
,
cSTDEV
,
cSTDEVA
,
cSTDEVP
,
cSTDEVPA
,
cSTEYX
,
cTDIST
,
cT_DIST
,
cRSQ
,
cSKEW
,
cS
KEW_P
,
cS
LOPE
,
cSMALL
,
cSTANDARDIZE
,
cSTDEV
,
cSTDEVA
,
cSTDEVP
,
cSTDEVPA
,
cSTEYX
,
cTDIST
,
cT_DIST
,
cT_DIST_2T
,
cT_DIST_RT
,
cT_INV
,
cT_INV_2T
,
cTINV
,
cTREND
,
cTRIMMEAN
,
cTTEST
,
cVAR
,
cVARA
,
cVARP
,
cVARPA
,
cWEIBULL
,
cZTEST
);
...
...
@@ -1055,6 +1055,58 @@
return
res
;
}
function
skew
(
x
,
bSkewp
)
{
var
sumSQRDeltaX
=
0
,
_x
=
0
,
xLength
=
0
,
sumSQRDeltaXDivstandDev
=
0
,
i
;
for
(
i
=
0
;
i
<
x
.
length
;
i
++
)
{
if
(
x
[
i
]
instanceof
cNumber
)
{
_x
+=
x
[
i
].
getValue
();
xLength
++
;
}
}
if
(
xLength
<=
2
)
{
return
new
cError
(
cErrorType
.
not_available
);
}
_x
/=
xLength
;
for
(
i
=
0
;
i
<
x
.
length
;
i
++
)
{
if
(
x
[
i
]
instanceof
cNumber
)
{
sumSQRDeltaX
+=
Math
.
pow
(
x
[
i
].
getValue
()
-
_x
,
2
);
}
}
var
standDev
;
if
(
bSkewp
){
standDev
=
Math
.
sqrt
(
sumSQRDeltaX
/
(
xLength
));
}
else
{
standDev
=
Math
.
sqrt
(
sumSQRDeltaX
/
(
xLength
-
1
));
}
for
(
i
=
0
;
i
<
x
.
length
;
i
++
)
{
if
(
x
[
i
]
instanceof
cNumber
)
{
sumSQRDeltaXDivstandDev
+=
Math
.
pow
((
x
[
i
].
getValue
()
-
_x
)
/
standDev
,
3
);
}
}
var
res
;
if
(
bSkewp
){
res
=
sumSQRDeltaXDivstandDev
/
xLength
;
}
else
{
res
=
xLength
/
(
xLength
-
1
)
/
(
xLength
-
2
)
*
sumSQRDeltaXDivstandDev
;
}
return
new
cNumber
(
res
);
}
function
GAMMADISTFUNCTION
(
fp
,
fAlpha
,
fBeta
){
this
.
fp
=
fp
;
this
.
fAlpha
=
fAlpha
;
...
...
@@ -5988,45 +6040,54 @@
cSKEW
.
prototype
.
argumentsMin
=
1
;
cSKEW
.
prototype
.
Calculate
=
function
(
arg
)
{
function
skew
(
x
)
{
var
sumSQRDeltaX
=
0
,
_x
=
0
,
xLength
=
0
,
sumSQRDeltaXDivstandDev
=
0
,
i
;
for
(
i
=
0
;
i
<
x
.
length
;
i
++
)
{
if
(
x
[
i
]
instanceof
cNumber
)
{
_x
+=
x
[
i
].
getValue
();
xLength
++
;
}
}
if
(
xLength
<=
2
)
{
return
new
cError
(
cErrorType
.
not_available
);
}
_x
/=
xLength
;
var
arr0
=
[];
for
(
i
=
0
;
i
<
x
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
this
.
getArguments
();
j
++
)
{
if
(
x
[
i
]
instanceof
cNumber
)
{
sumSQRDeltaX
+=
Math
.
pow
(
x
[
i
].
getValue
()
-
_x
,
2
);
if
(
arg
[
j
]
instanceof
cArea
||
arg
[
j
]
instanceof
cArea3D
)
{
arg
[
j
].
foreach2
(
function
(
elem
)
{
if
(
elem
instanceof
cNumber
)
{
arr0
.
push
(
elem
);
}
});
}
else
if
(
arg
[
j
]
instanceof
cRef
||
arg
[
j
]
instanceof
cRef3D
)
{
var
a
=
arg
[
j
].
getValue
();
if
(
a
instanceof
cNumber
)
{
arr0
.
push
(
a
);
}
}
else
if
(
arg
[
j
]
instanceof
cArray
)
{
arg
[
j
].
foreach
(
function
(
elem
)
{
if
(
elem
instanceof
cNumber
)
{
arr0
.
push
(
elem
);
}
});
}
else
if
(
arg
[
j
]
instanceof
cNumber
||
arg
[
j
]
instanceof
cBool
)
{
arr0
.
push
(
arg
[
j
].
tocNumber
());
}
else
if
(
arg
[
j
]
instanceof
cString
)
{
continue
;
}
else
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
var
standDev
=
Math
.
sqrt
(
sumSQRDeltaX
/
(
xLength
-
1
));
for
(
i
=
0
;
i
<
x
.
length
;
i
++
)
{
if
(
x
[
i
]
instanceof
cNumber
)
{
sumSQRDeltaXDivstandDev
+=
Math
.
pow
((
x
[
i
].
getValue
()
-
_x
)
/
standDev
,
3
);
}
}
}
return
this
.
value
=
skew
(
arr0
);
};
return
new
cNumber
(
xLength
/
(
xLength
-
1
)
/
(
xLength
-
2
)
*
sumSQRDeltaXDivstandDev
)
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cSKEW_P
()
{
this
.
name
=
"
SKEW.P
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
}
cSKEW_P
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cSKEW_P
.
prototype
.
constructor
=
cSKEW_P
;
cSKEW_P
.
prototype
.
argumentsMin
=
1
;
cSKEW_P
.
prototype
.
isXLFN
=
true
;
cSKEW_P
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arr0
=
[];
...
...
@@ -6058,7 +6119,7 @@
}
}
return
this
.
value
=
skew
(
arr0
);
return
this
.
value
=
skew
(
arr0
,
true
);
};
/**
...
...
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