rvl.stat.anova
Class Model
java.lang.Object
|
+--rvl.stat.anova.Model
- public class Model
- extends java.lang.Object
Constructor Summary |
Model()
|
Model(java.lang.String s)
Construct a Model by parsing a string s |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
recalcLU
public boolean recalcLU
Model
public Model()
Model
public Model(java.lang.String s)
- Construct a Model by parsing a string s
getFac
public Factor getFac(int i)
- Returns:
- ith factor in model
getFac
public Factor getFac(java.lang.String s)
- Returns:
- factor named s in the model (case is ignored)
Note: Nesting factors are ignored, and s is assumed
not to have any parenthesized expressions.
getTerm
public Term getTerm(int i)
nFac
public int nFac()
nTerm
public int nTerm()
addFactor
public void addFactor(Factor f)
addFactor
public void addFactor(Factor f,
boolean expand)
addTerm
public void addTerm(Term t)
- Add a term to the model
removeTerm
public void removeTerm(int i)
setLevels
public void setLevels(java.lang.String s)
- Set numbers of levels based on a string with format
name #levels name #levels ... (space-delimited)
Extensions:
1. Factors can be locked to have common numbers of levels
by specifying name1=name2=... instead of a single name.
2. A factor's levels may be used to define a fractional
experiment by preceding its name with a "/"
Example (3-period crossover design): Pass the string
/seq=per=drug 3 SUBJ 5
setRandom
public void setRandom(java.lang.String s)
- Set specified factors to be random
setFixed
public void setFixed(java.lang.String s)
- Set specified factors to be fixed
getNobs
public int getNobs()
- Returns:
- the total number of observations in the model
EMSCoefs
public double[][] EMSCoefs()
- Returns:
- matrix of coefficients of the EMSs
The ith row contains the coefficients of the variance components.
This linear combination is the EMS of the ith term
getErrorTerms
public double[][] getErrorTerms(double[][] C)
- Returns:
- matrix of coefficients of the mean squares comprising
the error terms for each term
getErrorTerms
public double[][] getErrorTerms()
power
public double[] power(double[] sd,
double alpha)
- Returns:
- powers of tests, given the
SD components in sd[] and test size alpha
Note: If test is invalid, a negative power is returned:
A "power" of -1 means no error term;
-2 means denominator df are too low;
-3 means an arithmetic exception occurred.
getPowerInfo
public double[] getPowerInfo(int i)
- Returns:
- basic information for use in power computation
for the i-th term:
{ leading coef, EMS(denom), numdf, dendf }
These values are stored in the last call to power(),
so you should call power() first if it hasn't benn
called previously, or if anything has changed.
printEMS
public void printEMS()
EMSString
public java.lang.String EMSString()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getCompRestr
public java.util.Vector getCompRestr(Term compTerm)
- Returns:
- Vector of fac[] arrays corresponding to
restrictions on comparisons of levels or factor
combinations in compTerm. Each restriction represents
a combination of factors that, if held fixed in a
comparison, will have a smaller variance than just any
comparison. Note: The first element is always null,
for an unrestricted comparison.
compTerm should be fixed -- otherwise null is returned
getAllCompRestr
public java.util.Vector getAllCompRestr(Term compTerm)
- Returns:
- all possible restrictions that could be
placed on a comparison. This is just like
getCompRestr(), except it does not confine itself
to the restrictions that make a difference in the
variance of a comparison or contrast.
getCompVariance
public double[] getCompVariance(Term compTerm,
Factor[] restr,
double[] effSD)
- Returns:
- ["base variance", d.f.] of a comparison of the levels
of compTerm, when it is restricted to the same levels of
factors in restr, given the SDs in effSD (note - only
the components of effSD that correspond to random
terms are used.
Multiply this result by the sum of squares of the contrast
coefficients to get the actual variance.
getCompCoefs
public double[] getCompCoefs(Term compTerm,
Factor[] restr)
- Returns:
- the coefficients of the variance components
to obtain the "base variance" described above
getCompErrorTerms
public double[] getCompErrorTerms(double[] coef)
- Returns:
- lin. comb. of MSs that estimates the given lin. comb.
of variances in coef[].
If model has changed since last call, set recalcLU to true
before calling
getCompVarString
public java.lang.String[] getCompVarString(Term compTerm,
Factor[] restr)
- Returns:
- strings that describes the variance of a comparison.
Element 0 is the combination of variances (to be multiplied
by sum of squares of contrast coefs);
Element 1 is the combination of mean squares to estimate
this variance.
Should set recalcLU to true if model has
changed since last call.