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
24fe24a9
Commit
24fe24a9
authored
Jul 06, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add COVARIANCE.P formula
parent
7956149a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
15 deletions
+98
-15
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+2
-14
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+96
-1
No files found.
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
24fe24a9
...
...
@@ -55,7 +55,7 @@
cFormulaFunctionGroup
[
'
TextAndData
'
]
=
cFormulaFunctionGroup
[
'
TextAndData
'
]
||
[];
cFormulaFunctionGroup
[
'
TextAndData
'
].
push
(
cDBCS
,
cUNICHAR
,
cUNICODE
);
cFormulaFunctionGroup
[
'
Statistical
'
]
=
cFormulaFunctionGroup
[
'
Statistical
'
]
||
[];
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cBINOM_DIST_RANGE
,
cCHISQ_TEST
,
cCOVARIANCE_P
,
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cBINOM_DIST_RANGE
,
cCHISQ_TEST
,
cCOVARIANCE_S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cHYPGEOM_DIST
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cSTDEV_P
,
cSTDEV_S
,
...
...
@@ -72,7 +72,7 @@
cFormulaFunctionGroup
[
'
NotRealised
'
]
=
cFormulaFunctionGroup
[
'
NotRealised
'
]
||
[];
cFormulaFunctionGroup
[
'
NotRealised
'
].
push
(
cDAYS
,
cISOWEEKNUM
,
cBITAND
,
cBITLSHIFT
,
cBITOR
,
cBITRSHIFT
,
cBITXOR
,
cDBCS
,
cUNICHAR
,
cUNICODE
,
cBINOM_DIST_RANGE
,
cCHISQ_TEST
,
cCOVARIANCE_
P
,
cCOVARIANCE_
S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cCOVARIANCE_S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cHYPGEOM_DIST
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cSTDEV_P
,
cSTDEV_S
,
cT_TEST
,
cWEIBULL_DIST
,
cZ_TEST
,
cPDURATION
,
cRRI
,
cAGGREGATE
,
cMUNIT
,
...
...
@@ -186,18 +186,6 @@
cCOMBINA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cCOMBINA
.
prototype
.
constructor
=
cCOMBINA
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cCOVARIANCE_P
()
{
cBaseFunction
.
call
(
this
,
"
COVARIANCE.P
"
);
this
.
isXLFN
=
true
;
}
cCOVARIANCE_P
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cCOVARIANCE_P
.
prototype
.
constructor
=
cCOVARIANCE_P
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
24fe24a9
...
...
@@ -63,7 +63,7 @@
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cAVEDEV
,
cAVERAGE
,
cAVERAGEA
,
cAVERAGEIF
,
cAVERAGEIFS
,
cBETADIST
,
cBETA_DIST
,
cBETA_INV
,
cBINOMDIST
,
cBINOM_DIST
,
cBINOM_INV
,
cCHIDIST
,
cCHIINV
,
cCHISQ_DIST
,
cCHISQ_DIST_RT
,
cCHISQ_INV
,
cCHISQ_INV_RT
,
cCHITEST
,
cCONFIDENCE
,
cCONFIDENCE_NORM
,
cCONFIDENCE_T
,
cCORREL
,
cCOUNT
,
cCOUNTA
,
cCOUNTBLANK
,
cCOUNTIF
,
cCOUNTIFS
,
cCOVAR
,
cCRITBINOM
,
cDEVSQ
,
cEXPON_DIST
,
cEXPONDIST
,
cF_DIST
,
cFDIST
,
cCOUNTBLANK
,
cCOUNTIF
,
cCOUNTIFS
,
cCOVAR
,
cC
OVARIANCE_P
,
cC
RITBINOM
,
cDEVSQ
,
cEXPON_DIST
,
cEXPONDIST
,
cF_DIST
,
cFDIST
,
cF_DIST_RT
,
cF_INV
,
cFINV
,
cF_INV_RT
,
cFISHER
,
cFISHERINV
,
cFORECAST
,
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
,
...
...
@@ -2551,6 +2551,101 @@
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cCOVARIANCE_P
()
{
this
.
name
=
"
COVARIANCE.P
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cCOVARIANCE_P
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cCOVARIANCE_P
.
prototype
.
constructor
=
cCOVARIANCE_P
;
cCOVARIANCE_P
.
prototype
.
argumentsMin
=
2
;
cCOVARIANCE_P
.
prototype
.
argumentsMax
=
2
;
cCOVARIANCE_P
.
prototype
.
isXLFN
=
true
;
cCOVARIANCE_P
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg2
=
[
arg
[
0
],
arg
[
1
]];
//если первое или второе значение строка
if
(
cElementType
.
string
===
arg
[
0
].
type
||
cElementType
.
bool
===
arg
[
0
].
type
){
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
if
(
cElementType
.
string
===
arg
[
1
].
type
||
cElementType
.
bool
===
arg
[
1
].
type
){
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
//если первое или второе значение число
if
(
cElementType
.
number
===
arg
[
0
].
type
){
arg2
[
0
]
=
new
cArray
();
arg2
[
0
].
addElement
(
arg
[
0
]);
}
if
(
cElementType
.
number
===
arg
[
1
].
type
){
arg2
[
1
]
=
new
cArray
();
arg2
[
1
].
addElement
(
arg
[
1
]);
}
var
oArguments
=
this
.
_prepareArguments
(
arg2
,
arguments
[
1
],
true
,
[
cElementType
.
array
,
cElementType
.
array
]);
var
argClone
=
oArguments
.
args
;
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
function
pearson
(
argArray
)
{
var
arg1
=
argArray
[
0
];
var
arg2
=
argArray
[
1
];
var
x
=
[];
var
y
=
[];
for
(
var
i
=
0
;
i
<
arg1
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
arg1
[
i
].
length
;
j
++
)
{
x
.
push
(
arg1
[
i
][
j
]);
}
}
for
(
var
i
=
0
;
i
<
arg2
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
arg2
[
i
].
length
;
j
++
)
{
y
.
push
(
arg2
[
i
][
j
]);
}
}
var
sumXDeltaYDelta
=
0
,
sqrXDelta
=
0
,
sqrYDelta
=
0
,
_x
=
0
,
_y
=
0
,
xLength
=
0
,
i
;
if
(
x
.
length
!==
y
.
length
)
{
return
new
cError
(
cErrorType
.
not_available
);
}
for
(
i
=
0
;
i
<
x
.
length
;
i
++
)
{
if
(
!
(
x
[
i
]
instanceof
cNumber
&&
y
[
i
]
instanceof
cNumber
))
{
continue
;
}
_x
+=
x
[
i
].
getValue
();
_y
+=
y
[
i
].
getValue
();
xLength
++
;
}
_x
/=
xLength
;
_y
/=
xLength
;
for
(
i
=
0
;
i
<
x
.
length
;
i
++
)
{
if
(
!
(
x
[
i
]
instanceof
cNumber
&&
y
[
i
]
instanceof
cNumber
))
{
continue
;
}
sumXDeltaYDelta
+=
(
x
[
i
].
getValue
()
-
_x
)
*
(
y
[
i
].
getValue
()
-
_y
);
}
return
new
cNumber
(
sumXDeltaYDelta
/
xLength
);
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
pearson
);
};
/**
* @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