本文整理汇总了C#中MathNet.Numerics.Distributions.StudentT类的典型用法代码示例。如果您正苦于以下问题:C# StudentT类的具体用法?C# StudentT怎么用?C# StudentT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StudentT类属于MathNet.Numerics.Distributions命名空间,在下文中一共展示了StudentT类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CanCreateStudentT
public void CanCreateStudentT(double location, double scale, double dof)
{
var n = new StudentT(location, scale, dof);
Assert.AreEqual(location, n.Location);
Assert.AreEqual(scale, n.Scale);
Assert.AreEqual(dof, n.DegreesOfFreedom);
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:7,代码来源:StudentTTests.cs
示例2: CanCreateStandardStudentT
public void CanCreateStandardStudentT()
{
var n = new StudentT();
Assert.AreEqual(0.0, n.Location);
Assert.AreEqual(1.0, n.Scale);
Assert.AreEqual(1.0, n.DegreesOfFreedom);
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:7,代码来源:StudentTTests.cs
示例3: ValidateMode
public void ValidateMode(double location, double scale, double dof)
{
var n = new StudentT(location, scale, dof);
Assert.AreEqual(location, n.Mode);
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:5,代码来源:StudentTTests.cs
示例4: ValidateMinimum
public void ValidateMinimum()
{
var n = new StudentT();
Assert.AreEqual(Double.NegativeInfinity, n.Minimum);
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:5,代码来源:StudentTTests.cs
示例5: ComputeCorrelation
public static CorrelData ComputeCorrelation(IEnumerable<double> d1, IEnumerable<double> d2)
{
CorrelData oRet = null;
if ((d1 == null) || (d2 == null))
{
return null;
}
double[] dd1 = d1.ToArray();
double[] dd2 = d2.ToArray();
int n = (dd1.Length < dd2.Length) ? dd1.Length : dd2.Length;
if (n < 3)
{
return null;
}
oRet = new CorrelData();
oRet.Count = n;
double corr = myconvert10000(Correlation.Pearson(dd1.Take(n), dd2.Take(n)));
if (corr < -1.0)
{
corr = -1.0;
}
if (corr > 1.0)
{
corr = 1.0;
}
oRet.Value = corr;
double xn = (double)n;
double rr = (corr < 0.0) ? -corr : corr;
double crit = rr * Math.Sqrt(xn - 2.0) / Math.Sqrt(1.0 - rr * rr);
StudentT st = new StudentT(0.0, 1.0, xn - 2);
double pb = st.CumulativeDistribution(crit);
oRet.Probability = myconvert10000(1.0 - pb);
double s1 = 0.5 * Math.Log((1.0 + corr) / (1.0 - corr));
double s2 = 1.96 / Math.Sqrt(xn - 3.0);
double s3 = corr / Math.Sqrt(xn - 1.0);
double z1 = s1 - s2 - s3;
double z2 = s1 + s2 - s3;
oRet.Minimum = myconvert10000(Math.Tanh(z1));
oRet.Maximum = myconvert10000(Math.Tanh(z2));
return oRet;
}
开发者ID:boubad,项目名称:StatDataStoreSolution,代码行数:41,代码来源:StatModelViewBase.cs
示例6: DT
/// <summary>
/// Density function for a Student's T distribution for a specified number
/// of degrees of freedom.
/// </summary>
public static double DT(double value, double df, double location = 0, double scale = 1)
{
var tdist = new StudentT(location, scale, df);
return tdist.Density(value);
}
开发者ID:lgatto,项目名称:proteowizard,代码行数:9,代码来源:Statistics.cs
示例7: CanSampleSequence
public void CanSampleSequence()
{
var n = new StudentT();
var ied = n.Samples();
ied.Take(5).ToArray();
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:6,代码来源:StudentTTests.cs
示例8: ValidateVariance
public void ValidateVariance(double location, double scale, double dof, double var)
{
var n = new StudentT(location, scale, dof);
Assert.AreEqual(var, n.Variance);
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:5,代码来源:StudentTTests.cs
示例9: SetDofFailsWithNonPositiveDoF
public void SetDofFailsWithNonPositiveDoF(double dof)
{
var n = new StudentT();
Assert.Throws<ArgumentOutOfRangeException>(() => n.DegreesOfFreedom = dof);
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:5,代码来源:StudentTTests.cs
示例10: ValidateInverseCumulativeDistribution
public void ValidateInverseCumulativeDistribution(double location, double scale, double dof, double x, double p)
{
var dist = new StudentT(location, scale, dof);
Assert.That(dist.InverseCumulativeDistribution(p), Is.EqualTo(x).Within(1e-6));
Assert.That(StudentT.InvCDF(location, scale, dof, p), Is.EqualTo(x).Within(1e-6));
}
开发者ID:Jungwon,项目名称:mathnet-numerics,代码行数:6,代码来源:StudentTTests.cs
示例11: ValidateCumulativeDistribution
public void ValidateCumulativeDistribution(double location, double scale, double dof, double x, double p)
{
var dist = new StudentT(location, scale, dof);
Assert.That(dist.CumulativeDistribution(x), Is.EqualTo(p).Within(1e-13));
Assert.That(StudentT.CDF(location, scale, dof, x), Is.EqualTo(p).Within(1e-13));
}
开发者ID:Jungwon,项目名称:mathnet-numerics,代码行数:6,代码来源:StudentTTests.cs
示例12: Fit
public IList<LinearFitResult> Fit(double[] observations)
{
if (observations.Length != DesignMatrix.RowCount)
{
throw new ArgumentException("Wrong number of rows"); // Not L10N
}
var coefficients = QrFactorization.Solve(observations);
var fittedValues = new double[observations.Length];
var residuals = new double[observations.Length];
for (int iRow = 0; iRow < observations.Length; iRow++)
{
var designRow = Enumerable.Range(0, DesignMatrix.ColumnCount).Select(index => DesignMatrix[iRow, index]).ToArray();
fittedValues[iRow] = DotProduct(designRow, coefficients);
residuals[iRow] = observations[iRow] - fittedValues[iRow];
}
double rss = DotProduct(residuals, residuals);
int degreesOfFreedom = observations.Length - QrFactorization.NumberIndependentColumns;
double resVar = rss / degreesOfFreedom;
double sigma = Math.Sqrt(resVar);
var covarianceUnscaled = MatrixCrossproductInverse;
var scaledCovariance = covarianceUnscaled.Multiply(sigma * sigma);
var indepColIndexes = QrFactorization.IndependentColumnIndexes.ToArray();
var result = new List<LinearFitResult>();
foreach (var contrastRow in ContrastValues.EnumerateRows())
{
double standardError = 0;
for (int iRow = 0; iRow < indepColIndexes.Length; iRow++)
{
for (int iCol = 0; iCol < indepColIndexes.Length; iCol++)
{
standardError += contrastRow[indepColIndexes[iRow]] * scaledCovariance[iRow, iCol] * contrastRow[indepColIndexes[iCol]];
}
}
standardError = Math.Sqrt(standardError);
double foldChange = DotProduct(coefficients, contrastRow);
double tValue = foldChange / standardError;
double pValue;
if (0 != degreesOfFreedom)
{
var studentT = new StudentT(0, 1.0, degreesOfFreedom);
pValue = (1 - studentT.CumulativeDistribution(Math.Abs(tValue))) * 2;
}
else
{
pValue = 1;
}
result.Add(new LinearFitResult(foldChange)
.SetDegreesOfFreedom(degreesOfFreedom)
.SetTValue(tValue)
.SetStandardError(standardError)
.SetPValue(pValue));
}
return result;
}
开发者ID:AlexandreBurel,项目名称:pwiz-mzdb,代码行数:55,代码来源:LinearModel.cs
示例13: SetScaleFailsWithNonPositiveScale
public void SetScaleFailsWithNonPositiveScale(double scale)
{
var n = new StudentT();
Assert.That(() => n.Scale = scale, Throws.ArgumentException);
}
开发者ID:EraYaN,项目名称:EV2020,代码行数:5,代码来源:StudentTTests.cs
示例14: SetDofFailsWithNonPositiveDoF
public void SetDofFailsWithNonPositiveDoF(double dof)
{
var n = new StudentT();
Assert.That(() => n.DegreesOfFreedom = dof, Throws.ArgumentException);
}
开发者ID:EraYaN,项目名称:EV2020,代码行数:5,代码来源:StudentTTests.cs
示例15: ValidateStdDev
public void ValidateStdDev(double location, double scale, double dof, double sdev)
{
var n = new StudentT(location, scale, dof);
Assert.AreEqual(sdev, n.StdDev);
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:5,代码来源:StudentTTests.cs
示例16: ValidateToString
public void ValidateToString()
{
var n = new StudentT(1.0, 2.0, 1.0);
Assert.AreEqual("StudentT(μ = 1, σ = 2, ν = 1)", n.ToString());
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:5,代码来源:StudentTTests.cs
示例17: SetScaleFailsWithNonPositiveScale
public void SetScaleFailsWithNonPositiveScale(double scale)
{
var n = new StudentT();
Assert.Throws<ArgumentOutOfRangeException>(() => n.Scale = scale);
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:5,代码来源:StudentTTests.cs
示例18: ValidateCumulativeDistribution
public void ValidateCumulativeDistribution(double location, double scale, double dof, double x, double c)
{
var n = new StudentT(location, scale, dof);
AssertHelpers.AlmostEqualRelative(c, n.CumulativeDistribution(x), 13);
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:5,代码来源:StudentTTests.cs
示例19: ValidateDensityLn
public void ValidateDensityLn(double location, double scale, double dof, double x, double p)
{
var n = new StudentT(location, scale, dof);
AssertHelpers.AlmostEqualRelative(p, n.DensityLn(x), 13);
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:5,代码来源:StudentTTests.cs
示例20: CanSample
public void CanSample()
{
var n = new StudentT();
n.Sample();
}
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:5,代码来源:StudentTTests.cs
注:本文中的MathNet.Numerics.Distributions.StudentT类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论