Displaying 20 results from an estimated 105 matches for "6,2".
Did you mean:
1,2
2012 Jan 03
6
calculate quantiles of a custom function
Hi,
I guess that my problem has an obvious answer, but I have not been able to
find it.
Suppose I create a custom function, consisting of two beta-distributions:
myfunction <- function(x) {
dbeta(x,2,6) + dbeta(x,6,2)
}
How can I calculate the quantiles of myfunction?
I have not seen any continous function treated in the docs, and applying the
"quantile function" gives me an error (since it seems only to be defined on
lists and atoms).
Thank you in advance,
Gerhard
2011 Nov 03
2
optimising a loop
...t find a good way to do it. Hopefully one of you will have something clever to propose.
Here is a simplified example:
I have a squared matrix:
> nom.plac2 <- c("102", "103", "301", "303","304", "403")
> poids2 <- matrix(NA, 6,6, dimnames=list(nom.plac2,nom.plac2))
> poids2
102 103 301 303 304 403
102 NA NA NA NA NA NA
103 NA NA NA NA NA NA
301 NA NA NA NA NA NA
303 NA NA NA NA NA NA
304 NA NA NA NA NA NA
403 NA NA NA NA NA NA
I want to replace some of the NAs following specifi...
2004 Feb 12
2
lattice: showing panels for factor levels with no values
How to show panels for factor levels of conditioning variables
which do have no values?
E.g. there are panels for "Grand Rapids" when they have values:
data( barley )
with( barley, dotplot(variety ~ yield | year * site, layout=c(6,2) ) )
There are no panels for "Grand Rapids"
when there are no values for "Grand Rapids":
my.barley <- subset( barley, ! ( site == "Grand Rapids" ) )
with( my.barley, dotplot(variety ~ yield | year * site, layout=c(6,2) ) )
But there is a level "Grand Rapi...
Equal confidence interval arrowhead lengths across multiple-paneled lattice plots with free y-scales
2007 Nov 15
1
Equal confidence interval arrowhead lengths across multiple-paneled lattice plots with free y-scales
...t; argument in
panel.arrows is in terms of grid units (which I assume are specific to
the particular panel). Can anybody think of a way to set the length so
that it appears uniform across all panels?
Example code:
summTable<-data.frame("X" = seq(1,12), "Y" =
c(1,8,3,6,6,5,7,3,8,1,10,-2),
"Location" = rep(c("Site1", "Site2"), times = c(6,6)),
"Species" = rep(c("A", "B"), 6)
)
#change scale for Site 1
summTable[1:6,2]<-100*summTable[1:6,2]
#arbitrary confidence intervals
summTabl...
2004 Apr 27
2
T1 DID problem
...adding another DID and I need to trap it correctly.
Thanks.
Here are snippets from the relevant files:
-- zaptel.conf --
span=1,0,0,esf,b8zs
e&m=1-8
loadzone=us
defaultzone=us
-- extensions.conf --
; Need an extension to pick up calls from the T1 that uses e&m wink
; This comes in as a 6 instead of 4 full digits
; then pass to the s extension
exten => 6,1,Wait(1)
exten => 6,2,Goto(incoming,s,1)
-- zapata.conf --
[channels]
context=incoming
signalling=em_w
; rxwink=600
echocancel=yes
echotraining=yes
group=1
immediate=no
channel => 1-8
-------------- next part -----------...
2011 Feb 26
1
Finding pairs with least magnitude difference from mean
Hi,
I have what I think is some kind of linear programming question.
Basically, what I want to figure out is if I have a vector of numbers,
> x <- rnorm(10)
> x
[1] -0.44305959 -0.26707077 0.07121266 0.44123714 -1.10323616
-0.19712807 0.20679494 -0.98629992 0.97191659 -0.77561593
> mean(x)
[1] -0.2081249
Using each number only once, I want to find the set of five pairs
where the magnitude of the differences between the mean(x) and each
pairs sum is least.
> y <-...
2005 Dec 06
2
how to extract row& col names from a matrix
Dear all,
I like to extract row names & column names from the named matrix......
like......
a<-matrix(1:6,2)
ro<-c("aa","bb")
co<-c("dd","ee","ff")
dimnames(a)<-list(ro,co)
a
>
dd ee ff
aa 1 3 5
bb 2 4 6
from the above matrix "a"
I like to extract
rownames separately like rownames(a)= (aa,bb)
column n...
2009 Oct 26
2
exclude data for boxplot stats using mathematical operator
Readers,
I have a data set as follows:
1,1
2,2
3,3
4,4
5,3
6,2
7,-10
8,-9
9,-3
10,2
11,3
12,4
13,5
14,4
15,3
16,2
17,1
I entered this data set using the command 'read.csv'. I want to
exclude values fewer than zero in column 2 so then I tried the
following command:
boxplot.stats(x[>0,2],do.conf=FALSE)
Error: syntax error, unexpected GT, expecting...
2012 Jan 29
1
height of plots
Hello R gurus,
I have to create 12 plots, I have been using the following script, which
leaves a large white space between two plot. I would appreciate if someone
can suggest an alternative to reduce the white space.
par(mar=c(3,3,.5,.5))
split.screen(c(6,2)) # split display into two screens
for (i in 1:12)
{
if (i<11)
{
screen(i)
plot(1:10,xaxt='n', xlab='', ylab='')
box()
}else{
screen(i)
plot(1:10, xlab='', ylab='', cex=0.75)
box()
}
}
Thanks
Sharad
--
View this message in context: http://...
2011 Feb 12
4
From SPSS Syntax to R code
There is a code from SPSS Syntax
do if sub(ATVK,2,2)="01".
comp strata=1.
else if sub(ATVK,2,2)>="05" and sub(ATVK,2,2)<="27".
comp strata=3.
else if sub(ATVK,4,2)>"20" or sub(ATVK,6,2)>"20".
comp strata=4.
else if sub(ATVK,4,2)>"00".
comp strata=2.
end if.
value labels strata 1 "R 2 "Li" 3 "M" 4 "La".
How can i rewrite it in R code?
--
View this message in context: http://r.789695.n4.nabble.com/From-SPSS-Syntax-to...
2012 Jan 19
2
Reading in tab (and space) delimited data within a script XXXX
Hello everyone,
I use Bob Muenchen's approach for reading in "in-stream" (to use SAS
parlance) delimited data within a script. This works great:
mystring <-
"id,workshop,gender,q1,q2,q3,q4
1,1,f,1,1,5,1
2,2,f,2,1,4,1
3,1,f,2,2,4,3
4,2, ,3,1, ,3
5,1,m,4,5,2,4
6,2,m,5,4,5,5
7,1,m,5,3,4,4
8,2,m,4,5,5,5"
mydata <- read.table( textConnection(mystring),
header=TRUE, sep=",",
row.names="id", na.strings=" ")
closeAllConnections()
mydata
Can anyone suggest a similar approach for reading in tab-delimited or
single sp...
2004 Aug 13
1
How to use the whole dataset (including between events) in Cox model (time-varying covariates) ?
...een event
times (or "death times") , since computation only occurs at event times.
For instance, removing observations when there is no event at that time in
the whole dataset does not change the results:
> set.seed(1)
> data <-
as.data.frame(cbind(start=c(1:5,1:5,1:4),stop=c(2:6,2:6,2:5),status=c(rep(
0,7),1,rep(0,5),1),id=c(rep(1,5),rep(2,5),rep(3,4)),x1=rnorm(14)))
> data
start stop status id x1
1 1 2 0 1 -0.6264538
2 2 3 0 1 0.1836433
3 3 4 0 1 -0.8356286
4 4 5 0 1 1.5952808
5 5 6 0 1 0.3295078
6 1 2 0 2 -0.8204684
7 2 3 0 2 0.4874291
8 3 4 1 2 0.7383247
9 4 5 0 2 0....
2008 Jul 08
2
Change in behaviour of sd()
Hi
I have just upgraded from R2.6.0 to R2.7.1 (running on Windows) and a part
of my code that previously ran ok now gives an error. The following is a
simple example to demonstrate my problem.
> a <- array(c(1,2,3,4,5,6,rep(NA,6)),dim=c(6,2))
> apply(a,2,sd,na.rm=T)
In R2.6.0 this gives (which is what I would like)
[1]...
2017 Jan 27
1
RFC: tapply(*, ..., init.value = NA)
The "no factor combination" case is distinguishable by 'tapply' with simplify=FALSE.
> D2 <- data.frame(n = gl(3,4), L = gl(6,2, labels=LETTERS[1:6]), N=3)
> D2 <- D2[-c(1,5), ]
> DN <- D2; DN[1,"N"] <- NA
> with(DN, tapply(N, list(n,L), FUN=sum, simplify=FALSE))
A B C D E F
1 NA 6 NULL NULL NULL NULL
2 NULL NULL 3 6 NULL NULL
3 NULL NULL NULL NULL 6 6
There is...
2009 Sep 04
1
User defined function's argument as Subset function's input
...e to make a user defined function so that I can input the desired
conditions and just get the results accordingly.
Below is an arbitrary data set & sample statements with its outputs in
accordance with specified conditions:
x <- data.frame(ID=rep(letters[1:5],2), A1=rep(10:14,2), A2=rep(2:6,2),
A3=c(101:105,95:99), A4=3*ceil(rt(10,2)))
x1 <- subset(x, ID == "a" & A1 <= 10 & A2 > 1 & A3 > 100) #condition 1
x2 <- subset(x, ID == "a" & A1 >= 10 & A2 > 1 & A3 < 100) #condition 2
x3 <- subset(x, ID == "a" &...
2001 Feb 07
3
Goodness of fit to Poisson / NegBinomial
...I have some data on parasites on apple leaves and want to do a
goodness of fit test to a Poisson distribution. This seems to
do it:
mites <- c(rep(0,70),
rep(1,38),
rep(2,17),
rep(3,10),
rep(4,9),
rep(5,3),
rep(6,2),
rep(7,1))
tab <- table(mites)
NSU <- length(mites)
N <- sum(mites)
NSU.Mean <- N / NSU
exp <- dpois(as.numeric(dimnames(tab)[[1]]), NSU.Mean) * NSU
chi2 <- sum(((as.vector(tab) - exp)^2) / exp)
tab
exp
chi2
I have some small expected value...
2006 Sep 21
1
Problems with making a complex graphic
En innebygd og tegnsett-uspesifisert tekst ble skilt ut...
Navn: ikke tilgjengelig
Nettadresse: https://stat.ethz.ch/pipermail/r-help/attachments/20060921/b479a8df/attachment.ksh
2005 Mar 15
2
Asterisk Queue strange behaviour
...assume would be easy to fix, but I can't find
anything about it...
I wish to have people dialing my phone, and if it is busy, they are put
into a queue. And then I am dialed back when the previous call is
finished, and connected to the waiting caller.
Easy enough?
----------exten
exten => 6,1,Background(salesq-intro);
exten => 6,2,Queue(salesq|tT|||300);
----------queue
[salesq]
music = default
context=default
Member => SIP/99559088@future-out
----------
So.. what is the problem... The first caller gets connected to my (mobile)
phone. The second and all other caller gets tran...
2003 Jun 03
1
kmeans
Dear helpers
I was working with kmeans from package mva and found some strange situations. When I run several times the kmeans algorithm with the same dataset I get the same partition. I simulated a little example with 6 observations and run kmeans giving the centers and making just one iteration. I expected that the algorithm just allocated the observations to the nearest center but think this is not the result that I get...
Here are the simulated data
> dados<-matrix(c(-1,0,2,2.5,7,9,0,3,0,6,1,4),6,2)
&...
2003 Jun 06
1
Kmeans again
Dear helpers
I'm sorry to insist but I still think there is something wrong with the function kmeans. For instance, let's try the same small example:
> dados<-matrix(c(-1,0,2,2.5,7,9,0,3,0,6,1,4),6,2)
I will choose observations 3 and 4 for initial centers and just one iteration. The results are
> A<-kmeans(dados,dados[c(3,4),],1)
> A
$cluster
[1] 1 1 1 1 2 2
$centers
[,1] [,2]
1 0.875 2.75
2 8.000 2.50
$withinss
[1] 38.9375 6.5000
$size
[1] 4 2
If I do it by hand, aft...