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
Related
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 have dataframe In R wanted to plot pairwise corelation plot currently using package "PerformanceAnalytics" but I am not able get nice colored graph any one suggest me a nice package i tried "psych" not able install to my system. is there any way i can plot
below mention my data
test1 test2 test3 test4 test4 test5 test6 test7
1.4367 1.6589 2.0227 2.2793 159.91 144 18910.1 19137.1902803603
0.2403 0.3404 0.9538 1.1041 226.1 317.61 6275.68 12618.0982994217
0.1737 0.2882 0.8039 3.1088 372.12 177.59 7912.73 6529.72939693551
library("PerformanceAnalytics")
chart.Correlation(df, histogram=TRUE, pch=19)
output
how I wanted a nice colured plot like below any one suggest me how can I plot
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 ...
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)
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
Each co-ordinate(x,y) corresponds to an index. For example: (0,0) has index 0 AND (1,0) has index 1 .
X <-c(0,1,1,0,-1,-1,-1,0,1,2,2,2,2,1,0,-1,-2)
Y <- c(0,0,1,1,1,0,-1,-1,-1,-1,0,1,2,2,2,2,2)
Z<- as.factor(0:16)
df <- data.frame(X,Y,Z)
library(e1071)
model <- svm(Z ~ X+Y, xyz, kernel = "radial")
predict(model, xyz[1:4,1:2]) #1.647681 3.859354 5.908940 4.151374
# From the last code, it appears that it does not predict well for its own data
i need help in building a predictive model which can predict the index.
What is the index corresponding to (12,-22) ?
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)
})