问题描述
我正在使用Partial Correlation Trend Test
测试连续变量(percent1)随时间的变化。 Percent1
是为每个women/total
计算的year
的百分比。
我正在使用本手册https://cran.r-project.org/web/packages/trend/trend.pdf。请参见第19页:“部分相关趋势测试”。
我的问题是:
考虑变量(percent1
)的性质,使用此测试评估趋势(一段时间内的群体差异)是否有效?
根据使用夏皮罗·威尔克(shapiro wilk)的分布(p> 0.05),percent1
是正常的。但是,我使用spearman方法的假设是随着时间的推移可能会出现趋势,但不是线性的。是对的吗?
另一方面,当我尝试使用pearson方法时,我只会丢失值:
Se han producido NaNs
Pearson's Partial Correlation Trend Test
data: t AND trendwomen . trendmen
t = NaN,df = 1,p-value = NA
但是,当我使用spearman方法时,一切进展顺利。那么,我该如何解决这个问题呢?我会很感激。最好的祝福。
dataset
A tibble: 13 x 6
year total women men percent1 percent2
<int> <int> <int> <int> <ts> <ts>
1 2002 1424 740 684 0.5196629 0.4803371
2 2003 1503 746 757 0.4963407 0.5036593
3 2004 1625 826 799 0.5083077 0.4916923
4 2005 2192 1171 1021 0.5342153 0.4657847
5 2006 2285 1219 1066 0.5334792 0.4665208
6 2007 2269 1200 1069 0.5288673 0.4711327
7 2008 2425 1272 1153 0.5245361 0.4754639
8 2009 2518 1254 1264 0.4980143 0.5019857
9 2010 2988 1497 1491 0.5010040 0.4989960
10 2011 2834 1413 1421 0.4985886 0.5014114
11 2012 2836 1395 1441 0.4918900 0.5081100
12 2013 3154 1579 1575 0.5006341 0.4993659
13 2014 3250 1531 1719 0.4710769 0.5289231
library(trend)
partial.cor.trend.test(dataset$percent1,dataset$percent2,method = "spearman")
Spearman's Partial Correlation Trend Test
data: t AND dataset$percent1 . dataset$percent2
t = 0,df = 11,p-value = 1
alternative hypothesis: true rho is not equal to 0
sample estimates:
r(dataset$percent1.dataset$percent2)
0
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)