Which R `arima` package is considered being the best? [closed] - r

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Which R's package with arima modeling capabilities is considered being the best ? I would like to simulate new time series from fitted arima model in straightforward way ?

Personally, I like rugarch package. It gives a lot of possibilities and models, easiness of use, maybe It's a bit too "black box".
#example ARMA GARCH 1,1 need rugarch package
spec <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1)),mean.model = list(armaOrder = c(1, 1)))
garch <- ugarchfit(spec = spec, data = timeseries)
forc<-ugarchforecast(garch,n.ahead=200)
plot(forc#forecast$sigmaFor)
plot(forc#forecast$seriesFor)

Related

Species Distribution modelling incorporating climate data in R [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I am trying to use data from GBIF to get an idea of Vachellia species disturbution across Africa and overlay this with annual rainfall in R.
Any package advice, online resources or tutorials would be greatly appreciated?
Thanks in advance
Not easy to see what you have in mind, but you may try
Chloropleth: sf, rnaturalearth, ggplot (geom_sf), maps
Openstreetmap: ggmap (get_stamenmap(bbox = bbox, zoom = 5, maptype = "toner-lite"))
Spatial smoothing: mgcv (gam_gp = target ~ te(lat, long, m = list(c(3,.5)), d=2, bs = 'gp'), data = data_dt, cluster=cl, method = "REML")
Spatial regression
Other packages may be useful as well, on the top of my mind: leaflet, tmap, gganimate
see:
using spatial data in R
Geocomputaion with R
Species distribution modelling
R-spatial
Nice example of spatial smoothing with GAMs
Have fun

Nonlinear LAD regression in R [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I would like to estimate the parameters of a nonlinear regression model with LAD regression. In essence the LAD estimator is an M-estimator. As far as I know it is not possible to use the robustbase package to do this. How could I use R to do LAD regression? Could I use a standard package?
You could do this with the built-in optim() function
Make up some data (make sure x is positive, so that a*x^b makes sense - raising negative numbers to fractional powers is problematic):
set.seed(101)
a <- 1; b <- 2
dd <- data.frame(x=rnorm(1000,mean=7))
dd$y <- a*dd$x^b + rnorm(1000,mean=0,sd=0.1)
Define objective function:
objfun <- function(p) {
pred <- p[1]*dd$x^p[2] ## a*x^b
sum(abs(pred-dd$y)) ## least-absolute-deviation criterion
}
Test objective function:
objfun(c(0,0))
objfun(c(-1,-1))
objfun(c(1,2))
Optimize:
o1 <- optim(fn=objfun, par=c(0,0), hessian=TRUE)
You do need to specify starting values, and deal with any numerical/computational issues yourself ...
I'm not sure I know how to compute standard errors: you can use sqrt(diag(solve(o1$hessian))), but I don't know if the standard theory on which this is based still applies ...

R: Relationship between McFadden & Nagelkerke [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I was wondering if there is a way to calculate Nagelkerke R-square based upon the output produced. I know that I can calculate McFadden R-square directly. But Nagelkerke produces what we feel is a more accurate strength of the model.
I am not having luck with adding on packages to my setup, if that is the line of thought that you have.
Thanks.
This question is underdefined so I'll do my best assuming that "the output produced" is a glm object. This function should produce the appropriate pseudo-R square you want when applied to a glm object.
Nagelkerke <- function(mod) {
l_full <- exp(logLik(mod))
l_intercept <- exp(logLik( update(mod, . ~ 1) ))
N <- length(mod$y)
r_2 <- (1 - (l_intercept / l_full)^(2/N)) / (1 - l_intercept^(2/N))
return( as.numeric(r_2) )
}
Example:
model <- glm(formula = vs ~ mpg + disp, family = binomial("logit"), data = mtcars);
Nagelkerke(model);
#[1] 0.6574295

Can you perform a Kernel Logistic Regression in R [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I am trying to perform a Kernel Logistic Regression in R. Is there a package that does this?
stats::ksmooth gives you the Nadaraya–Watson kernel regression:
with(cars, {
plot(speed, dist>40)
lines(ksmooth(speed, dist>40, "normal", bandwidth = 2), col = 2)
lines(ksmooth(speed, dist>40, "normal", bandwidth = 6), col = 3)
})

Phylogenetic MANOVA in R? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Does anyone know of a package or method in R of carrying out a MANOVA whilst controlling for phylogenetic non-independence?
Thank you!
sos package is your friend:
library('sos')
findFn('phylogenetic MANOVA')
seems like geiger package and more precisely aov.phylo performs phylogenetic ANOVA or MANOVA.
Here an example from the help :
library(geiger)
geo=get(data(geospiza))
dat=geo$dat
d1=dat[,1]
grp<-as.factor(c(rep(0, 7), rep(1, 6)))
names(grp)=rownames(dat)
## MANOVA
x=aov.phylo(dat~grp, geo$phy, nsim=50, test="Wilks")
Multivariate Analysis of Variance Table
Response: dat
Df Wilks approx-F num-Df den-Df Pr(>F) Pr(phy)
group 1 0.27872 3.6229 5 7 0.061584 0.549
Residuals 11

Resources