我正在使用[
{
"title": "A",
"url": "https://www.google.com"
},
{
"title": "B",
"url": "https://www.facebook.com"
},
{
"title": "A",
"url": "https://www.CNN.com"
}
]
包中的sm.regression
功能来完成我的大学任务,并遇到了一些我无法在网上找到答案的问题。
任务是:
在二维中使用内核平滑拟合二元平滑项,用于响应Y和X和Z之间的双变量项。应使用非常高的平滑参数来强制线性关系,而Z的平滑度应该是根据可视化数据确定。
我的代码:
sm
将第二个平滑参数设置为15可确保强制线性关系。
问题:
如何获得拟合优度统计数据,例如RSS,模型的自由度。一般来说,如何提取常用位,如拟合值,残差,平滑项的估计有效自由度等?
谢谢!
修改
作为评论中的请求:
dput(x)的
require(sm)
x <- cbind(Z,X)
y <- Y
LL <- sm.regression(x,y,h=c(3,15))
dput(y)的
structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1,
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1,
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 1.82454929205105, 1.39252491087053,
0.993251773010283, 0.587786664902119, 1.12330490125848, 1.12330490125848,
1.53686721959926, 3.99314205671294, 3.51551763869145, 2.21648239394063,
1.50407739677627, 1.3415584672785, NA, NA, 2.20092143921755,
1.22377543162212, 2.11625551480255, 2.65558663156647, 3.54769984065116,
4.2579739860039, 2.83321334405622, 2.87919845729804, 2.58021682959233,
NA, NA, 1.51512723296286, 2.19165353228676, 2.24601474150565,
1.48160454092422, 1.66770682055808, 4.1268117523596, 3.50930412298801,
2.67000213346468, 3.23212105161822, 2.88666117849963, 2.81839825827108,
2.86505394991188, 2.29000631078719, 1.69101789942652, 0.113328685307003,
0.765467842139571, 0.799756915618204, 0.553885113226438, 1.88327457806383,
3.59676416520613, 1.90210752639692, 1.42911435830282, 1.50407739677627,
3.43720781918519, 2.45958884180371, 1.43508452528932, 1.26694760348732,
0.662687973075237, 0.545227050483323, 2.78037086268184, 2.96320908184843,
2.60268968544438, 2.87638551592142, 3.13549421592915, 3.49650756146648,
3.41772668361337, 2.22462355152433, 1.34373474670109, 1.09861228866811,
1.19392246847243, 0.485507815781701, 1.70474809223843, 4.09933210373314,
4.39906810052873, 3.28091121578765, 2.95751106073379, 2.95751106073379,
2.85647020622048, 1.87180217690159, 0.693147180559945, 1.01160091167848,
0.916290731874155, 1.98787434815435, 1.67896397508271, 3.13331793650655,
4.11984985263046, 3.39450839351136, 2.69799986524871, 2.39789527279837,
0.955511445027436, 1.48160454092422, 1.2947271675944, 1.19392246847243,
1.38629436111989, 1.1314021114911, 1.31908561142644, 2.98315349134713,
3.45757771509826, 2.04122032885964, 1.38629436111989, 1.06471073699243,
1.71079040669439, 1.14740245283754, 1.19392246847243, 1.7227665977411,
1.26694760348732, 1.01523067972906, 1.11514159061932, 1.90954250488444,
1.64222773525709, 1.48160454092422, 1.71379792775834, 0.8754687373539,
1.2947271675944, 1.45083288225746, 1.06471073699243, 0.8754687373539,
1.17865499634165, 1.29746314741327, 2.484906649788, 1.50407739677627,
1.38128181929635, 0.53062825106217, 0.717839793150317, 1.31730148963294,
1.26694760348732, 1.20896034583698, 1.63413052502447, 0.916290731874155,
1.43983512804792, 0.8754687373539, 1.22377543162212, 2.83673654206353,
2.9391619220656, 1.73165554515835, 1.77495235091167, 2.9882040071332,
2.71137799119488, 1.88706964903238, 1.80005827204275, 1.57897870494939,
2.05412373369555, 1.42310833424261, 1.62268313918412, 1.64865862558738,
1.82454929205105, 2.3764549415605, 2.71137799119488, 2.16332302566054,
1.35239280944421, 1.26694760348732, 1.17865499634165, 1.16315080980568,
0.916290731874155, 1.32175583998232, 2.01490302054226, 1.88706964903238,
2.01490302054226, 2.71137799119488, 1.53686721959926, 0.624154309072996,
0.8754687373539, 0.916290731874155, 1.25276296849537, 1.69193913394584,
1.26694760348732, 2.79116510781272, 2.77570884957602, 3.24649099190117,
3.09874002362822, 2.22462355152433, 1.97408102602201, 2.61739583283408,
1.76644166124377, 1.43508452528932, 1.85629799036563, 1.81645208181843,
1.99470031322475, 2.23001440015921, 2.42480272571829, 3.78418963391826,
3.63098547569503, 2.72457950305342, 2.29556047805708, 3.35165693610202,
3.4291367503514, 2.65675690671466, 1.87946504964716, 2.3887627892351,
2.06686275947298, 2.18041745901984, 2.52172062291072, 3.24454357161678,
2.80638610182307, 1.45861502269952, 2.05796251000271, 2.02154756326093,
1.50407739677627, 1.44691898293633, 1.67709656090792, 1.85629799036563,
1.98375629154543, 2.05412373369555, 2.8094026953625, 3.73169945129686,
2.2082744135228, 1.79674701073909, 1.69561560867515, 2.24601474150565,
2.3664984187377, 1.48160454092422, 1.14740245283754, 1.3609765531356,
1.57069708411767, 1.00430160919687, 0.85015092936961, 1.36353737399727,
1.69927861643389, 1.70474809223843, 2.40061883326541, 2.75493378700106
), .Dim = c(216L, 2L), .Dimnames = list(NULL, c("Month", "LSRP"
)))