Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/74.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
npregivderiv错误_R_Statistics_Regression - Fatal编程技术网

npregivderiv错误

npregivderiv错误,r,statistics,regression,R,Statistics,Regression,在非常小(100 obs)的临时数据集上运行npregivderiv时,经过229次迭代(上网本上10-15分钟),我收到错误: if(!any(mean.loo==maxPenal))中出错:{:缺少值,其中需要TRUE/FALSE 显然,对于多达20次的观测,它不会给出错误 这意味着什么?我如何使函数运行 以下是我使用的代码: install.packages('np', dependencies = TRUE) library(np) mop = read.csv("c:/.../sh

在非常小(100 obs)的临时数据集上运行
npregivderiv
时,经过229次迭代(上网本上10-15分钟),我收到错误:

if(!any(mean.loo==maxPenal))中出错:{:缺少值,其中需要TRUE/FALSE

显然,对于多达20次的观测,它不会给出错误

这意味着什么?我如何使函数运行

以下是我使用的代码:

install.packages('np', dependencies = TRUE)

library(np)

mop = read.csv("c:/.../sht.csv")

trim <- 0.005

v <- mop$z
eps <- mop$w
u <- -0.5*v + eps
w <- mop$x
fun1 <- function(z) { z^2 }
fun2 <- function(z) { exp(-abs(z)) }
z <- 0.2*w + v
y1 <- fun1(z) + u
y2 <- fun2(z) + u
y <- y1
phi <- fun1
ivdata <- data.frame(y,z,w,u,v)
ivdata <- ivdata[order(ivdata$z),]
rm(y,z,w,u,v)
attach(ivdata)
model.ivderiv <- npregivderiv(y=y,z=z,w=w)
ylim <-c(quantile(model.ivderiv$phi.prime,trim),
quantile(model.ivderiv$phi.prime,1-trim))
plot(z,model.ivderiv$phi.prime,
xlim=quantile(z,c(trim,1-trim)),
main="",
ylim=ylim,
xlab="Z",
ylab="Derivative",
type="l",
lwd=2)
rug(z)
## End(Not run)

你能做一个可复制的例子吗()?非常感谢你的回复!就我在我的电脑上试过的情况而言,它应该可以简单地运行(并产生所说的错误)。
structure(list(y = c(855.52914, 1.1283515, 908.51758, 0.7514782, 
661.73008, 1.0657453, 890.40141, 869.96992, 0.6273609, 778.90695, 
1.1568432, 700.16383, 656.48211, 0.3734502, 1.0547463, 703.97711, 
833.33609, 1.1071179, 952.82203, 615.92148, 375.02961, 1.2113513, 
1.1327123, 904.69453, 598.49734, 798.16117, 1.1865938, 574.36656, 
789.65438, 1.012672, 909.95234, 349.57699, 372.64508, 0.4520109, 
878.43656, 1.2991395, 1.1184094, 678.41758, 751.22055, 480.62234, 
897.70094, 800.21281, 0.5323266, 1.537357, 805.63383, 527.56363, 
938.26156, 924.51289, 1.3786252, 0.5548848, 532.18199, 867.58539, 
1.2738473, 614.92715, 250.03736, 387.20566, 902.57727, 0.6784175, 
0.5328116, 750.59086, 923.70094, 413.46332, 1.2695937, 0.6762907, 
451.50113, 513.00297, 445.88805, 0.8880168, 823.90359, 0.6558593, 
474.56914, 351.70363, 1.0155759, 349.57707, 516.12414, 850.27523, 
798.08602, 935.69398, 914.74375, 385.07863, 518.25098, 1.1459232, 
712.15711, 992.94234, 823.53852, 620.17516, 0.5328116, 824.85336, 
1.3809344, 407.81934, 926.82211, 518.50863, 901.43523, 880.83109, 
701.15813, 613.79461, 830.76875, 1.0250023, 1.1362391), z = c(0.60875082, 
0.10875082, 0.60875082, 0.60875082, 0.60875082, 0.20875082, 0.60875082, 
0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.90875082, 0.60875082, 
0.30875082, 0.60875082, 0.60875082, 0.60875082, 0.6, 0.60875082, 
0.60875082, 0.60875082, 0.602989, 0.60875082, 0.60875082, 0.60875082, 
0.2350875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 
0.60875082, 0.60875082, 0.5543875082, 0.60875082, 0.60875082, 
0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 
0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 
0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.12, 0.60875082, 
0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 
0.60875082, 0.60875082, 0.12, 0.60875082, 0.60875082, 0.60875082, 
0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 
0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 
0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 
0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 
0.60875082, 0.88888, 0.60875082, 0.60875082, 0.60875082, 0.60875082, 
0.60875082, 0.60875082, 0.60875082, 0.60875082), w = c(83L, 80L, 
51L, 79L, 63L, 61L, 75L, 64L, 60L, 55L, 81L, 65L, 62L, 52L, 70L, 
53L, 71L, 64L, 63L, 63L, 50L, 71L, 67L, 64L, 71L, 66L, 84L, 57L, 
68L, 84L, 64L, 51L, 40L, 39L, 53L, 49L, 79L, 61L, 66L, 60L, 63L, 
53L, 35L, 66L, 48L, 50L, 62L, 65L, 68L, 43L, 50L, 54L, 69L, 56L, 
54L, 41L, 66L, 61L, 51L, 65L, 61L, 52L, 75L, 64L, 58L, 49L, 61L, 
65L, 51L, 53L, 47L, 48L, 74L, 51L, 53L, 47L, 56L, 59L, 58L, 44L, 
50L, 64L, 63L, 56L, 55L, 57L, 51L, 48L, 68L, 55L, 65L, 63L, 77L, 
62L, 72L, 66L, 68L, 59L, 66L), x = c(74.067852, 52.955316, 56.225129, 
74.879164, 74.463844, 62.743391, 62.965547, 50.187594, 66.421305, 
62.171621, 0.05881477, 69.880313, 67.804906, 71.622492, 68.570344, 
64.366551, 70.452563, 59.251387, 63.727793, 78.042359, 51.238469, 
69.661391, 62.171656, 35.919395, 0.06695618, 64.695395, 55.722531, 
70.313039, 68.377156, 64.069473, 68.397813, 76.897836, 0.05497393, 
52.692496, 44.930246, 28.247617, 63.398324, 69.501711, 72.960695, 
83.124023, 73.273414, 0.06834432, 34.502906, 45.975348, 41.471199, 
55.924777, 63.035965, 69.089609, 50.538238, 41.626965, 67.059602, 
53.923043, 61.120734, 60.075582, 68.319789, 55.665734, 67.392844, 
69.501727, 62.583723, 77.436594, 62.344168, 46.654945, 0.07242857, 
75.155633, 0.08174043, 55.232992, 71.572727, 66.701008, 0.05184766, 
62.377672, 59.816539, 71.243953, 57.105574, 0.07689782, 67.545852, 
53.457934, 73.998234, 74.484039, 0.04600057, 61.319688, 61.891926, 
67.207391, 82.020125, 59.284391, 48.338883, 66.734516, 62.583719, 
35.939527, 56.105645, 79.665039, 74.657023, 63.810398, 65.194012, 
67.014219, 87.847086, 83.696281, 81.900594, 61.759531, 60.634988
)), .Names = c("y", "z", "w", "x"), row.names = c(NA, 99L), class = "data.frame")