简体   繁体   English

偏度分布Rcpp

[英]Skew distribution Rcpp

Anyone know How do I generate skew distribution using Rcpp? 有人知道如何使用Rcpp生成偏斜分布吗? (for example skew normal or skew t). (例如,正常偏斜或t偏斜)。

By the way, how do I generate distributions that aren't defined in Rmath.h? 顺便说一句,我如何生成Rmath.h中未定义的分布?

Edit: 编辑:

I want use some function available in any package of R, for example the function rsn(n = 1, location = 0, scale = 1, shape = 0, dp = NULL) of the package ´sn´ to generate de skew normal distribution: 我想使用R的任何软件包中的某些函数,例如软件包sn的函数rsn(n = 1,location = 0,scale = 1,shape = 0,dp = NULL)以生成偏斜正态分布:

library(sn)
rsn(100, 5, 2, 5)

Thanks and Happy New Year 谢谢,新年快乐

The sn package contains no C or C++ code, but only R code. sn软件包不包含C或C ++代码,而仅包含R代码。 So you could not have meant calling its compiled code, but just its R functions. 因此,您不必意味着调用其编译代码,而只需调用其R函数。

Which you can do via the Rcpp::Function() object -- but the execution will be no different than calling directly from R. 您可以通过Rcpp::Function()对象执行此操作-但执行与直接从R调用没有什么不同。

An R function is still an R function, whether you can it from R or from from your C++ code via Rcpp. 无论您是从R还是通过Rcpp从C ++代码中获得R函数,R函数仍然是R函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM