Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用dlply将包strucchange的断点函数应用于数据子集?[R]_R_Plyr_Piecewise - Fatal编程技术网

如何使用dlply将包strucchange的断点函数应用于数据子集?[R]

如何使用dlply将包strucchange的断点函数应用于数据子集?[R],r,plyr,piecewise,R,Plyr,Piecewise,那么 我尝试对数据进行分段回归,以找到每个ID的最终断点,并提取这些信息 示例:我的个人数据的子集 ID time y 7G009 0 9 7G009 108,33 13 7G009 185,69 16 7G009 309,22 20 7G009 515,08 21 7G051 0 10 7G051 108,33 14 7G051 185,69 19 7G051 309,22 23 7G051 515

那么

我尝试对数据进行分段回归,以找到每个ID的最终断点,并提取这些信息

示例:我的个人数据的子集

 ID     time     y
7G009   0       9
7G009   108,33  13
7G009   185,69  16
7G009   309,22  20
7G009   515,08  21
7G051   0       10
7G051   108,33  14
7G051   185,69  19
7G051   309,22  23
7G051   515,08  25
8S027   0       8
8S027   108,33  13
8S027   185,69  17
8S027   309,22  22
8S027   515,08  23
为此,我使用了包strucchange和dlply的断点函数,我的代码如下:

breakby=dlply(test,.(subject),summarize,break=breakpoints(y~time,h=2))
但我有一个错误:

Erreur dans breakpoints.formula(nbf ~ cumggd, h = 2) :
minimum segment size must be greater than the number of regressors
好吧,如果有人能告诉我怎么处理的话

先谢谢你


对不起,英语很差。

如果你只有一个ID来完成这项任务,你知道如何做你想做的吗?是的,我知道不同的方法。例如,我使用strucchange包(breakpoint())或分段包(segemented())进行测试。我也尝试使用siZer软件包(分段。线性),但当我想处理我所有的ID时,我被卡住了。为什么不发布你将用于测试单个ID的代码,并解释为什么你在所有ID上做相同类型的事情时遇到困难?这可能对你不再感兴趣,但我认为问题在于规格
h=2
——你有2个回归方程,所以你的h必须至少是3。