Package mondrian.olap.fun
Class LinReg
- java.lang.Object
-
- org.eigenbase.xom.XMLUtil
-
- org.eigenbase.xom.XOMUtil
-
- mondrian.olap.Util
-
- mondrian.olap.fun.FunUtil
-
- mondrian.olap.fun.FunDefBase
-
- mondrian.olap.fun.LinReg
-
- All Implemented Interfaces:
FunDef
- Direct Known Subclasses:
LinReg.InterceptFunDef,LinReg.PointFunDef,LinReg.R2FunDef,LinReg.SlopeFunDef,LinReg.VarianceFunDef
public abstract class LinReg extends FunDefBase
Abstract base class for definitions of linear regression functions.- See Also:
LinReg.InterceptFunDef,LinReg.PointFunDef,LinReg.R2FunDef,LinReg.SlopeFunDef,Correlation coefficient Correlation coefficient The correlation coefficient, r, ranges from -1 to + 1. The nonparametric Spearman correlation coefficient, abbreviated rs, has the same range. Value of r (or rs) Interpretation r= 0 The two variables do not vary together at all. 0 r 1 The two variables tend to increase or decrease together. r = 1.0 Perfect correlation. -1 r 0 One variable increases as the other decreases. r = -1.0 Perfect negative or inverse correlation. If r or rs is far from zero, there are four possible explanations: The X variable helps determine the value of the Y variable. The Y variable helps determine the value of the X variable. Another variable influences both X and Y. X and Y don't really correlate at all, and you just happened to observe such a strong correlation by chance. The P value determines how often this could occur. r2 Perhaps the best way to interpret the value of r is to square it to calculate r2. Statisticians call this quantity the coefficient of determination, but scientists call it r squared. It is has a value that ranges from zero to one, and is the fraction of the variance in the two variables that is shared. For example, if r2=0.59, then 59% of the variance in X can be explained by variation in Y. Likewise, 59% of the variance in Y can be explained by (or goes along with) variation in X. More simply, 59% of the variance is shared between X and Y. (Source). Also see: least squares fitting.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLinReg.InterceptFunDefDefinition of theLinRegInterceptMDX function.static classLinReg.PointFunDefDefinition of theLinRegPointMDX function.static classLinReg.R2FunDefDefinition of theLinRegR2MDX function.static classLinReg.SlopeFunDefDefinition of theLinRegSlopeMDX function.static classLinReg.VarianceFunDefDefinition of theLinRegVarianceMDX function.-
Nested classes/interfaces inherited from class mondrian.olap.fun.FunUtil
FunUtil.DescendingValueComparator
-
Nested classes/interfaces inherited from class mondrian.olap.Util
Util.AbstractFlatList<T>, Util.ByteMatcher, Util.ErrorCellValue, Util.Flat2List<T>, Util.Flat3List<T>, Util.Functor1<RT,PT>, Util.GcIterator<T>, Util.MemoryInfo, Util.PropertyList, Util.SqlNullSafeComparator
-
-
Field Summary
Fields Modifier and Type Field Description static intInterceptstatic intPointstatic intR2static intSlopestatic intVariance-
Fields inherited from class mondrian.olap.fun.FunDefBase
flags, parameterCategories, returnCategory
-
Fields inherited from class mondrian.olap.fun.FunUtil
BooleanNull, DoubleEmpty, DoubleNull, IntegerNull, NullMember
-
Fields inherited from class mondrian.olap.Util
DEBUG, EmptyValue, IBM_JVM, JdbcVersion, JVM_INSTANCE_UUID, nl, nullValue, Retrowoven
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static mondrian.olap.fun.LinReg.Valueaccuracy(mondrian.olap.fun.LinReg.Value value)CalccompileCall(ResolvedFunCall call, ExpCompiler compiler)Converts a call to this function into executable objects.protected static voiddebug(String type, String msg)static Listforecast(mondrian.olap.fun.LinReg.Value value)static mondrian.olap.fun.LinReg.ValuelinearReg(List xlist, List ylist)protected static mondrian.olap.fun.LinReg.Valueprocess(Evaluator evaluator, ListCalc listCalc, DoubleCalc yCalc, DoubleCalc xCalc)-
Methods inherited from class mondrian.olap.fun.FunDefBase
createCall, getDescription, getName, getParameterCategories, getResultType, getReturnCategory, getSignature, getSyntax, unparse, validateArg
-
Methods inherited from class mondrian.olap.fun.FunUtil
avg, box, box, checkIterListResultStyles, checkListResultStyles, compareHierarchically, compareSiblingMembers, compareValues, compareValues, count, decodeCategory, decodeParameterCategories, decodeReturnCategory, decodeSyntacticType, getDimensionDefaultHierarchy, getNonEmptyMemberChildren, getNonEmptyMemberChildrenWithDetails, isAncestorOf, makeNullTuple, max, min, newEvalException, newEvalException, newEvalException, quartile, resolveFunArgs, sum, sumDouble, sumDouble, tupleContainsNullMember, tupleContainsNullMember, worthCaching
-
Methods inherited from class mondrian.olap.Util
addAppender, addDatabaseTime, addLevelCalculatedMembers, append, appendArrays, areOccurencesEqual, assertPostcondition, assertPostcondition, assertPrecondition, assertPrecondition, assertTrue, assertTrue, badValue, binarySearch, bitSetBetween, camelToUpper, canCast, cancelStatement, caseSensitiveCompareName, cast, cast, castToIterable, checkCJResultLimit, close, commaList, compare, compareIntegers, compareKey, compareName, compileScript, convert, convert, convertOlap4jConnectStringToNativeMondrian, convertStackToString, copyOf, copyOf, copyOf, copyOf, copyOf, createExpr, createRandom, createRootRole, createSimpleValidator, createUdf, dbTimeMillis, deprecated, deprecated, digestMd5, digestSha256, equal, equalName, equals, equals, explain, falseFunctor, filter, flatList, flatList, flatListCopy, generateUuidString, genericArray, getAnnotation, getClosestResource, getDimensionCube, getErrorMessage, getErrorMessage, getExecutorService, getFirstDescendantOnLevel, getMatchingCause, getMemberOrdinalInParent, getMemoryInfo, getScheduledExecutorService, hash, hash, hashArray, identityFunctor, implode, intersect, isBlank, isEmpty, isNull, isSorted, isValidProperty, last, lookup, lookup, lookup, lookup, lookup, lookupCompound, lookupCompound, lookupHierarchyLevel, lookupHierarchyRootMember, lookupHierarchyRootMember, lookupProperty, makeAppender, makeBigDecimalFromDouble, makeFqName, makeFqName, makeFqName, matches, matches, mdxEncodeString, needToImplement, newElementNotFoundException, newError, newError, newIdentityHashSet, newIdentityHashSetFake, newInternal, newInternal, newTimer, nonDbTimeMillis, normalizeName, only, parseCommaList, parseConnectString, parseIdentifier, parseInterval, parseLocale, printMemory, printMemory, quoteForMdx, quoteForMdx, quoteJavaString, quoteMdxIdentifier, quoteMdxIdentifier, quoteMdxIdentifier, quoteMdxIdentifier, quotePattern, readFully, readFully, readURL, readURL, readURL, readVirtualFile, readVirtualFileAsString, removeAppender, replace, replace, replaceProperties, safeGet, setLevel, singleQuoteString, singleQuoteString, sort, sort, threadLocalRemove, toMap, toNullValuesMap, toOlap4j, toOlap4j, toOlap4j, toURL, trueFunctor, unexpected, uniquify, unparse, unparse, wildcardToRegexp
-
Methods inherited from class org.eigenbase.xom.XOMUtil
addChild, addChild, addChildren, addElement, concatenate, createDefaultParser, discard, discard, discard, discard, discard, discard, discard, discard, discard, getFirstInstance, wrapperToXml
-
-
-
-
Field Detail
-
Point
public static final int Point
- See Also:
- Constant Field Values
-
R2
public static final int R2
- See Also:
- Constant Field Values
-
Intercept
public static final int Intercept
- See Also:
- Constant Field Values
-
Slope
public static final int Slope
- See Also:
- Constant Field Values
-
Variance
public static final int Variance
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LinReg
protected LinReg(FunDef funDef, int regType)
-
-
Method Detail
-
compileCall
public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler)
Description copied from interface:FunDefConverts a call to this function into executable objects.The result must implement the appropriate interface for the result type. For example, a function which returns an integer must return an object which implements
IntegerCalc.- Specified by:
compileCallin interfaceFunDef- Overrides:
compileCallin classFunDefBase
-
process
protected static mondrian.olap.fun.LinReg.Value process(Evaluator evaluator, ListCalc listCalc, DoubleCalc yCalc, DoubleCalc xCalc)
-
accuracy
public static mondrian.olap.fun.LinReg.Value accuracy(mondrian.olap.fun.LinReg.Value value)
-
forecast
public static List forecast(mondrian.olap.fun.LinReg.Value value)
-
-