使用组的回归格式: [英] Regression format by using group:
本文介绍了使用组的回归格式:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
i有一些疑问 回归格式通过使用组:
假设:如果我有< span class =code-digit> 3 组 0 , 1 , 2
group 0 :代表整场比赛
group1:第一个表达式分组
group2:第二个表达式分组
请给我By 使用任何链接或网址 此
,
我的尝试:
< pre lang =C#>如何做 此 in 我的文本框。
请 此
请使用任意链接或网址 code-keyword> for this
解决方案
Got你好
我认为你需要和SQL一起做这个以及
但如果它有帮助请看这个链接
多元回归 - 免费统计和预测软件(计算器)v.1.1.23-r7 [ ^ ]
但如果没有,请看下面的代码
你试过Matrix逻辑 -
矩阵y = 新矩阵(
< span class =code-keyword> new double [,] {{ 745 } ,
{ 895 },
{ 442 },
{ 440 },
{ 1598 }});
矩阵x = 新矩阵(
新 double [,] {{ 1 , 36 ,< span class =code-digit> 66 },
{ 1 , 37 , 68 },
{ 1 , 47 , 64 },
{ 1 , 32 , 53 },
{ 1 ,< span class =code-digit> 1 , 101 }});
Matrix b =(x.Transpose()* x).Inverse()* x.Transpose()* y;
for ( int i = 0 ; i < b.Rows; i ++)
{
Trace.WriteLine( INFO: + b [i, 0 ]。ToDouble() );
}
_StatConn.EvaluateNoReturn( string .Format( output< - lm({0}),equation));
object intercept = _StatConn.Evaluate( 系数(输出)[ '(截距)']跨度>);
参数[ 0 ] =( double )拦截;
for ( int i = 0 ; i < xColCount; i ++)
{
object parameter = _StatConn.Evaluate( string .Format( systems(输出) )['x {0}'],i));
参数[i + 1 ] =( double )参数;
}
public void Foo(List< Sample> samples )
{
int nAttributes = 3 ; // 3分钟,2分钟,1分钟
int nSamples = samples.Count;
double [,] tsData = new double [nSamples,nAttributes];
double [] resultData = new double < /跨度> [NSAMPLES];
for ( int i = 0 ; i < samples.Count; i ++)
{
tsData [i, 0 ] = samples [i] .Tminus1min;
tsData [i, 1 ] = samples [i] .Tminus2min;
tsData [i, 2 ] = samples [i] .Tminus3min;
resultData [i] = samples [i] .Final;
}
double [] weights = null ;
int fitResult = 0 ;
alglib.lsfit.lsfitreport rep = new alglib.lsfit.lsfitreport();
alglib.lsfit.lsfitlinear(resultData,tsData,nSamples,nAttributes, ref fitResult, ref 权重,代表;
字典<字符串,双> labelsAndWeights = new Dictionary< string,double>();
labelsAndWeights.Add( 1min,权重[ 0 跨度>]);
labelsAndWeights.Add( 2min,权重[ 1 跨度>]);
labelsAndWeights.Add( 3min,权重[ 2 跨度>]);
}
hi guys,
i have some doubts in Regression format by using Group:
Assume:if i have 3 groups 0,1,2
group 0:Represent the Whole match
group1 : first expression grouping
group2 : second expression grouping
Please give me the By using any link or url for this
,
What I have tried:
How to do this in my text box .
Please help for this
Please give me the By using any link or url for this
解决方案
Got you
I think you need to do this in combination with SQL as well
but see this link if it helps
Multiple Regression - Free Statistics and Forecasting Software (Calculators) v.1.1.23-r7[^]
but if it doesn't then, see the code below
Have you tried Matrix logic -
Matrix y = new Matrix( new double[,]{{745}, {895}, {442}, {440}, {1598}}); Matrix x = new Matrix( new double[,]{{1, 36, 66}, {1, 37, 68}, {1, 47, 64}, {1, 32, 53}, {1, 1, 101}}); Matrix b = (x.Transpose() * x).Inverse() * x.Transpose() * y; for (int i = 0; i < b.Rows; i++) { Trace.WriteLine("INFO: " + b[i, 0].ToDouble()); } _StatConn.EvaluateNoReturn(string.Format("output <- lm({0})", equation)); object intercept = _StatConn.Evaluate("coefficients(output)['(Intercept)']"); parameters[0] = (double)intercept; for (int i = 0; i < xColCount; i++) { object parameter = _StatConn.Evaluate(string.Format("coefficients(output)['x{0}']", i)); parameters[i + 1] = (double)parameter; } public void Foo(List<Sample> samples) { int nAttributes = 3; // 3min, 2min, 1min int nSamples = samples.Count; double[,] tsData = new double[nSamples, nAttributes]; double[] resultData = new double[nSamples]; for (int i = 0; i < samples.Count; i++) { tsData[i, 0] = samples[i].Tminus1min; tsData[i, 1] = samples[i].Tminus2min; tsData[i, 2] = samples[i].Tminus3min; resultData[i] = samples[i].Final; } double[] weights = null; int fitResult = 0; alglib.lsfit.lsfitreport rep = new alglib.lsfit.lsfitreport(); alglib.lsfit.lsfitlinear(resultData, tsData, nSamples, nAttributes, ref fitResult, ref weights, rep); Dictionary<string, double> labelsAndWeights = new Dictionary<string, double>(); labelsAndWeights.Add("1min", weights[0]); labelsAndWeights.Add("2min", weights[1]); labelsAndWeights.Add("3min", weights[2]); }
这篇关于使用组的回归格式:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文