Displaying 20 results from an estimated 5000 matches similar to: "tapply"
2013 Apr 05
2
How to perform a grouped shapiro wilk test on dataframe
Hello,
I was wandering if it is possible to perform on a dataframe called 'all' a
shapiro wilk normality test for COUNTS by variable Group
ACTIVITY? Could it be done using plyer? I saw an eg that applies to an
array but not to a dataframe:
lapply(split(dataset1$Height,dataset1$Group),shapiro.test)
Any thoughts would be much appreciated.
My dataframe is in shape:
dat ACTIVIT
2007 Jul 05
3
Loop and function
Hi All, I am trying to make a loop for a function and I am using the
following codes. "p" and "var" are some matrix obtained before. I would like
to apply the function "gpdlow" for i in 1:12 and get the "returnlow" for i
in 1:12. But when I ask for "returnlow" there are warnings and it turns out
some strange result.
for (i in 1:12){
gpdlow
2007 Jun 19
2
Function -return value
Hi, I am trying to write a function with the following codes and I would like
it to return the values for "alpha
beta para parab " seperately. Then I would like to use this funstion for
"variable" with factor "a" and "b". But the result turns out to be a matrix
with element like "Numeric,2" ... I guess they are just the values for
2007 Oct 02
5
Linear Regression
Hello,
I would like to fit a linear regression and when I use summary(), I got the
following result:
Call:
lm(formula = weight ~ group - 1)
Residuals:
Min 1Q Median 3Q Max
-1.0710 -0.4938 0.0685 0.2462 1.3690
Coefficients:
Estimate Std. Error t value Pr(>|t|)
groupCtl 5.0320 0.2202 22.85 9.55e-15 ***
groupTrt 4.6610 0.2202 21.16 3.62e-14
2007 Jun 19
2
Histogram
Hello, I am using the following codes to plot a histogram and density line
for x. For the density line, I just want it to show the two tails, eg, for x
larger than 0.05 ans smaller than -0.05
hist (x, seq(-0.1,0.1,0.01),freq = FALSE)
lines (density(x,bw="SJ"), x> 0.05 & x< (-0.05), col = "red")
But is does not work, can anyone give me some advice?
--
View this
2007 Dec 03
2
Linear Regression, Data is a list
Hello,
I would like to perform a linear regression and the data is a list.e.g
lm(list$abc~., data=list) or lm(abc~., data=list), which would give the same
result.
The problem is I would like to call the response variable in a more general
form. What I try to achieve is sth like lm(list$(paste("a","b","c"))~.,
data=list), but it does not work.
Could anyone give me
2011 Oct 30
1
Normality tests on groups of rows in a data frame, grouped based on content in other columns
Dear R users,
I have a data frame in the form below, on which I would like to make normality tests on the values in the ExpressionLevel column.
> head(df)
ID Plant Tissue Gene ExpressionLevel
1 1 p1 t1 g1 366.53
2 2 p1 t1 g2 0.57
3 3 p1 t1 g3 11.81
4 4 p1 t2 g1 498.43
5 5 p1 t2 g2 2.14
6 6 p1 t2 g3 7.85
I
2007 Jul 03
4
sequences
Hi, I would like to generate a series in the following form (0.8^1, 0.8^2,
..., 0.8^600)
Could anyone tell me how can I achieve that? I am really new to R.
--
View this message in context: http://www.nabble.com/sequences-tf4019146.html#a11414836
Sent from the R help mailing list archive at Nabble.com.
2007 Jul 10
3
ECDF, distribution of Pareto, distribution of Normal
Hello all,
I would like to plot the emperical CDF, normal CDF and pareto CDF in the
same graph and I amusing the following codes. "z" is a vector and I just
need the part when z between 1.6 and 3.
plot(ecdf(z), do.points=FALSE, verticals=TRUE,
xlim=c(1.6,3),ylim=c(1-sum(z>1.6)/length(z), 1))
x <- seq(1.6, 3, 0.1)
lines(x,pgpd(x, 1.544,0.4373,-0.2398), col="red")
y
2007 Jun 29
2
cbind
Hi, I have a series of return data, a and b are factors. I would like to
build a matrix which contains each vector of "returns". I am thinking about
something as following, but I guess there should be a sensible way of doing
this.
returns <- split(return, list(regimef, assetf))
cbind(returns[[1]], returns[[2]],...,returns[[n]])
Could anyone give me some advice? Many thanks.
--
2007 Sep 17
2
vector name
I have got a list named "filtered", I would like to construct alist named
"fdata" as following:
fdata <- cbind(matrix(unlist(filtered),ncol=28), myregime)
If I try names(filtered), it gives all the correct name for each vector, but
if I try names(fdata), it appears "filtered[[1]]" "filtered[[2]]" ...,
How can I keep the name in "fdata"?
2007 Oct 31
2
cbind()
Hello,
I would like to use the cbind() function to construct a matrix used in the
middle of a function as following
for (i in 1:1000) {
b[i] <- function(cbind(a[[1]][[i]],
a[[2]][[i]],a[[3]][[i]],...a[[67]][[i]]))
}
Is there an easy way of achieving this rather than "cbind" every column?
--
View this message in context: http://www.nabble.com/cbind%28%29-tf4724534.html#a13507633
2007 Jun 29
1
Shapiro Test P Value Incorrect? (PR#9768)
Full_Name: Jason Polak
Version: R version 2.5.0 (2007-04-23)
OS: Xubuntu 7.04
Submission from: (NULL) (137.122.144.35)
Dear R group,
I have noticed a strange anomaly with the shapiro.test() function. Unfortunately
I do not know how to calculate the shapiro test P values manually so I don't
know if this is an actual bug.
So, to produce the results, run the following code:
pvalues = 0;
for
2020 Oct 18
2
Resultado de la consola como un tibble
Buen día
estimados
Estoy tratando de hacer un tibble con los resultados de un apply que se
muestran en la consola que me da R, no estoy seguro si eso se pueda hacer,
pero me gustaría organizar los resultados de esa manera.
mi código es:
data("mtcars")
Mtcars_matriz <- as.matrix(mtcars)
apply(Mtcars_matriz, MARGIN =2, FUN = shapiro.test)
DF2 <- tibble(Variable = NA, W = NA, Pvalue =
2006 Oct 25
1
density plot text
Is there any way of adding text to a density plot? I have had a go using the
text() function but I think the error is because this function doesn't work
with densityplot().
Alternatively, I understand I can achieve pretty much the same result if I
plot a density kernel estimate using plot() (which allows text()), but I do
prefer densityplot().
Also, is it possible to specify the dimensions
2007 Nov 07
2
Linear Regression
Hello everyone,
I would like to a linear regression with the following code.
lm(a[,"fquamsci"]~., data=a)
a is a list with class "mts" "ts" , and "fquamsci" is the name of the
response variable in a. I would like to do a linear regression of "fquamsci"
to the rest of the variables. But it turns out the "fquamsci" is also
included in
2007 May 31
2
Import data from Access
Hi, I want to import some data from Access and I am using the following
codes:
testdb <- file.path("c/../db1")
channel <- odbcConnect("testdb")
sqlFetch(channel,"tbl",colnames = TRUE, rownames = FALSE)
It comes out the error message:
1: [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver
Manager] Data source name not found and no default
2007 Jun 01
2
tapply histogram
Dear members,
I would like to pass the histogram settings to each subset of the dataframe,
and generate a multiple figures graph.
First, can anyone tell me how to generate a multiple figures environment? I
am trying
mfrow=c(2,4) and nothing appears.
Secondly, I want to pass the following function in tapply()
hist(x, freq=FALSE)
lines(density(x), col="red")
rug(x)
how can I manage
2020 Oct 18
1
Resultado de la consola como un tibble
Hola,
Bueno, puedes hacer el cálculo de una forma mucho más compacta y rápida.
Esta forma es especialmente recomendable cuando tienes muchas columnas y
muchas filas.
> library(data.table)
> myDT <- as.data.table(mtcars)
> myDTlong <- melt(myDT, measure.vars=1:ncol(myDT))
> myDTlong[ , list(p_value = shapiro.test(value)$p.value, v_stat =
shapiro.test(value)$statistic) , by
2007 Jun 13
1
VGAM Pareto
I would like to fit a Pareto Distribution and I am using the following codes
fit=vglm(ycf1 ~ 1, pareto1(location=alpha), trace=TRUE, crit="c")
fitted(fit)
But the fitted values turn out to be the same for each observation. I guess
the problem is with "ycf1 ~ 1",
I would be grateful if anyone can give me some advice on how to define the
formula.
Many thanks
--
View this