ARMA 模型的生成

using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Threading;
using System.Windows.Forms;
using System.Windows.Markup;
using System.Xml;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

//产生自回归滑动平均模型ARMA(p, q)的数据。Auto regressive moving average model
/************************************
	a       ---一维数组,长度为(p+1),ARAM(p,q)模型的自回归系数。
	b       ---一维数组,长度为(q+1),ARAM(p,q)模型的滑动平均系数。
	p       ---ARAM(p,q)模型的自回归阶数。
	q       ---ARAM(p,q)模型的滑动平均阶数。
	mean	---白噪声正态分布均值mu。
	sigma	---白噪声正态分布均方差sigma。
	seed    ---随机数种子
	x		---一维数组,长度n,存放ARAM(p,q)模型的数据。
	n 		---放ARAM(p,q)模型的长度。
************************************/
namespace ArmaDataGenerate
{
    //ARMA Model =>  x(k) + 1.45x(k-1) + 0.6x(k-2) = w(k) -0.2w(k) - 0.1w(k)
    //w(k)是均值 0, 方差 0.5的高斯白噪声,生成200个数据于arma.dat
    public partial class ArmaDataGenerateForm : Form
    {
        // generate(0,1)interval random number
        Random rd = new Random();
        //double uniform(double double int*)        
        public ArmaDataGenerateForm()
        {
            InitializeComponent();
        }
        static double[] a = { 1.0, 1.45, 0.6 };
        static double[] b = { 1.0, -0.2, -0.1 };
        void arma(double[] a, double[] b, int p, int q, double mean, double sigma, double[] x, int n)
        {
            int i, k, m; double s; double[] w = new double[n];
            for (k = 0; k < n; k++) w[k] = gauss(mean, sigma);
            x[0] = b[0] * w[0];
            for (k = 1; k <= p; k++) {
                s = 0.0;
                for (i = 1; i <= k; i++) s += a[i] * x[k - 1];
  
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值