[R] R solaris 64 (etc) build errors

2006-11-07 Thread elw

Hello folks,

I found the following message in the web archives from a month or so back 
- I've now encountered this same problem while trying to update our local 
builds of R (on Solaris) from ~2.2.0 to 2.4.x.

I've tried both the official 2.4.0 source tarball, as well as yesterday's 
R-patched source.

I'm doing my builds on a T2000 running Solaris 10, patched up to date as 
of a week or so back, using the Sun Studio 11 compilers.  Very generic 
build flags - the same flags worked perfectly using an older version of R. 
Nothing special going on, here.

I'd appreciate any help that listies can provide.  I'm willing to try out 
any suggestions that folks are able to come up with.

Thanks a bunch,

--elijah

School of Library and Information Science
Indiana University, Bloomington


--

From: Prof Brian Ripley 
Date: Tue 10 Oct 2006 - 10:49:01 GMT

Which Solaris is this? I am not seeing any problems with our Solaris 8 
systems. Was the compiler built on that exact system? What gcc options 
were used (-std=gnu99, as recommended, for instance)?

It looks like a system header problem: __builtin_isnan ought to be built 
in, not an external entry point. Since R does not use it, you need to 
trace through the headers to see why isnan is expanding to it.

On Thu, 5 Oct 2006, roger koenker wrote:

> We have a solaris/sparc machine that has been running an old version
> of R-devel: Version 2.2.0 Under development (unstable) (2005-06-04
> r34577)
> which was built as m64 from sources. Attempting to upgrade to 2.4.0
> the configure step
> goes ok, but I'm getting early on from make:
>
>> gcc -m64 -L/opt/sfw/lib/sparcv9 -L/usr/lib/sparcv9
>> -L/usr/openwin/lib/sparcv9 -L/usr/local/lib -o R.bin Rmain.o
>> CConverters.o CommandLineArgs.o Rdynload.o Renviron.o RNG.o apply.o
>> arithmetic.o apse.o array.o attrib.o base.o bind.o builtin.o
>> character.o coerce.o colors.o complex.o connections.o context.o cov.o
>> cum.o dcf.o datetime.o debug.o deparse.o deriv.o dotcode.o dounzip.o
>> dstruct.o duplicate.o engine.o envir.o errors.o eval.o format.o
>> fourier.o gevents.o gram.o gram-ex.o graphics.o identical.o
>> internet.o
>> iosupport.o lapack.o list.o localecharset.o logic.o main.o mapply.o
>> match.o memory.o model.o names.o objects.o optim.o optimize.o
>> options.o par.o paste.o pcre.o platform.o plot.o plot3d.o plotmath.o
>> print.o printarray.o printvector.o printutils.o qsort.o random.o
>> regex.o registration.o relop.o rlocale.o saveload.o scan.o seq.o
>> serialize.o size.o sort.o source.o split.o sprintf.o startup.o
>> subassign.o subscript.o subset.o summary.o sysutils.o unique.o util.o
>> version.o vfonts.o xxxpr.o mkdtemp.o ../unix/libunix.a
>> ../appl/libappl.a ../nmath/libnmath.a -L../../lib -lRblas
>> -L/usr/local/encap/gf7764-3.4.3+2/lib/gcc/sparc64-sun-solaris2.9/3.4.3
>> -L/usr/ccs/bin/sparcv9 -L/usr/ccs/bin -L/usr/ccs/lib
>> -L/usr/local/encap/gf7764-3.4.3+2/lib/sparcv9
>> -L/usr/local/encap/gf7764-3.4.3+2/lib -lg2c -lm -lgcc_s
>> ../extra/zlib/libz.a ../extra/bzip2/libbz2.a ../extra/pcre/libpcre.a
>> ../extra/intl/libintl.a -lreadline -ltermcap -lnsl -lsocket -ldl -lm
>
>
>> Undefined first referenced
>> symbol in file
>> __builtin_isnan arithmetic.o
>> ld: fatal: Symbol referencing errors. No output written to R.bin
>> collect2: ld returned 1 exit status

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RE : avoiding a loop: "cumsum-like"

2006-11-07 Thread Ray Brownrigg
Well, I do have a solution which works for the data set you provide, but 
possibly not in a more general case.

Firstly, tidying up your code, but using essentially the same looping 
algorithm, can provide a speed improvement of approximately 3:1.
Here is a first attempt:
mycode1 <- function(tab) {
  len <- diff(range(tab$Date)) + 1
  res <- numeric(len)
  val <- 0
  for (i in 1:len)
  {
if (is.na(tab$posit.lat[i]))
{
  val <- val + tab$x.jour[i]
}
else
{
  if (res[tab$posit.lat[i]] < 30)
  {
val <- val + tab$x.jour[i]
  }
  else
  {
val <- val + tab$x.jour[i] + 0.8*res[tab$posit.lat[i]]
  }
}
  res[i] <- val
  }
  return(res)
}

Then using a cumsum()-based algorithm can provide an overall 10:1 speed 
improvement:

mycode2 <- function(tab) {
  res0 <- cumsum(tab$x.jour)
  res1 <- cumsum(ifelse(is.na(tab$posit.lat), 0, 0.8*
(res0[tab$posit.lat] >= 30) * res0[tab$posit.lat]))
  res2 <- cumsum(ifelse(is.na(tab$posit.lat), 0, 0.8*res1[tab$posit.lat]))
  return(res0 + res1 + res2)
}

The condition is that:
res[tab$posit.lat[tab$posit.lat[tab$posit.lat[length(tab$posit.lat) < 30
where tab is the data and res is the result.  [There is also an implicit 
assumption that the result is monotonic.]

HTH
Ray Brownrigg

GOUACHE David wrote:
> Thanks Petr for taking a stab at it.
> I have yet to figure out a way to do it, but if I do I'll post it.
> Cheers
>
> David
>
> -Message d'origine-
> De : Petr Pikal [mailto:[EMAIL PROTECTED] 
> Envoyé : vendredi 3 novembre 2006 09:05
> À : GOUACHE David; r-help@stat.math.ethz.ch
> Objet : Re: [R] avoiding a loop: "cumsum-like"
>
> Hi
>
> I have not seen any answer yet so I wil try (partly).
>
> I believe that the loop can be vectorised but I am a little bit lost 
> in your fors and ifs. I found that first part of res is same as 
> cumsum(tab$x.jour) until about 81st value. However I did not decipher 
> how to compute the remaining part. I tried to add 
> cumsum(tab$posit.lat) (after changing NA to 0) what is not correct.
>
> Probably some combination of logical operation and summing can do 
> what you want. I thought that something like
> ((cumsum(tab$posit.lat)*0.8)*(cumsum(tab$x.jour)>30)+cumsum(tab$x.jour
> ))
>
> can do it but the result is defferent from your computation.
> Not much of help, but maybe you can do better with above suggestion.
>
> Petr
>
>
>
> On 2 Nov 2006 at 11:15, GOUACHE David wrote:
>
> Date sent:Thu, 2 Nov 2006 11:15:49 +0100
> From: "GOUACHE David" <[EMAIL PROTECTED]>
> To:   
> Subject:  [R] avoiding a loop: "cumsum-like"
>
>   
>> Hello Rhelpers,
>>
>> I need to run the following loop over a large number of data-sets, and
>> was wondering if it could somehow be vectorized. It's more or less a
>> cumulative sum, but slightly more complex. Here's the code, and an
>> example dataset (called tab in my code) follows. Thanks in advance for
>> any suggestions!
>>
>> res<-0
>> for (i in min(tab$Date):max(tab$Date))
>> {
>>  if (is.na(tab$posit.lat[tab$Date==i])==T)
>>  {
>>   res<-c(res,res[length(res)]+tab$x.jour[tab$Date==i])
>>  }
>>  else
>>  {
>>   if (res[tab$posit.lat[tab$Date==i]+1]<30)
>>   {
>>res<-c(res,res[length(res)]+tab$x.jour[tab$Date==i])
>>   }
>>   else
>>   {
>>res<-c(res,res[length(res)]+tab$x.jour[tab$Date==i]+0.8*res[tab$pos
>>it.lat[tab$Date==i]+1])
>>   }
>>  }
>> }
>> res[-1]
>>
>>
>> Date x.jour  posit.lat
>> 358040   NA
>> 358050   NA
>> 358060   NA
>> 358070   NA
>> 358080   NA
>> 358092.97338883  NA
>> 358102.796389915 NA
>> 358110   NA
>> 358120   NA
>> 358131.000711886 NA
>> 358140.894422571 NA
>> 358150   NA
>> 358160   NA
>> 358170   NA
>> 358180   NA
>> 358190   NA
>> 358200   NA
>> 358210   NA
>> 358220   NA
>> 358230   NA
>> 358240   NA
>> 358250   NA
>> 358260   NA
>> 358270   NA
>> 358280   NA
>> 358290   NA
>> 358300   NA
>> 358310   NA
>> 358320   NA
>> 358330   NA
>> 358340   NA
>> 358350   NA
>> 358360   NA
>> 358370   NA
>> 358380   NA
>> 358390   NA
>> 358402.47237455  NA
>> 358410   2
>> 358420   3
>> 358430   4
>> 358440   5
>> 358450   6
>> 358460   7
>> 358474.842160488 8
>> 358482.432125036 9
>> 358490   10
>> 358500   12
>> 358510   14
>> 358520   16
>> 358533.739683882 18
>> 358541.980214421 20
>> 358550   22
>> 358560   24
>> 35857   

Re: [R] chisq test with for loop

2006-11-07 Thread downunder

I have it work. so far thanks for your help. lars

working code

z<-matrix(0,d,d) 
z
for (i in 1:d)
for (j in 1:d)
z[[i,j]]<-chisq.test(x[,i], x[,j])$p.value
round(z,3)





downunder wrote:
> 
> Hi all.
> 
> i am desperating. i need a matrix of p.values from an chi square test.  i
> had it already work but than my computer collapsed when taking the whole
> data set 800x260 into account. i am sure it looked like this but it
> doesn't work now. can anybody help me? thanks in advance.
> 
> x=read.table("C:\...)
> d=ncols(x)
> z<=matrix(0,d,d)
> for(i in 1:d)
> for(j in 1:d)
> z[i,j]<=chisq.test(x[,i],x[,j])$p.value
> round(z,3)
> 

-- 
View this message in context: 
http://www.nabble.com/-R---chisq-test-with-for-loop-tf2593044.html#a7232360
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] chisq test with for loop

2006-11-07 Thread Tim Calkins
i think you need braces after your for statements.  there might be other
issues as well, but that's the first that i noticed

tim

On 11/8/06, downunder <[EMAIL PROTECTED]> wrote:
>
>
> Hi all.
>
> i am desperating. i need a matrix of p.values from an chi square test.  i
> had it already work but than my computer collapsed when taking the whole
> data set 800x260 into account. i am sure it looked like this but it
> doesn't
> work now. can anybody help me? thanks in advance.
>
> x=read.table("C:\...)
> d=ncols(x)
> z<=matrix(0,d,d)
> for(i in 1:d)
> for(j in 1:d)
> z[i,j]<=chisq.test(x[,i],x[,j])$p.value
> round(z,3)
> --
> View this message in context:
> http://www.nabble.com/-R---chisq-test-with-for-loop-tf2593044.html#a7232065
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Tim Calkins
0406 753 997

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] combining dataframes with different numbers of columns

2006-11-07 Thread Denis Chabot
Thanks you very much Hadley, Stephen, and Sundar, your suggestions  
all solve my problem, even if the narrower dataframe contains  
variables that are new to the wider dataframe.

I'm sure glad I took the time to write instead of pursuing with my  
ugly and time-consuming solution.

Denis

> Dear list members,
>
> I have to combine dataframes together. However they contain  
> different numbers of variables. It is possible that all the  
> variables in the dataframe with fewer variables are contained in  
> the dataframe with more variables, though it is not always the case.
>
> There are key variables identifying observations. These could be  
> used in a merge statement, although this won't quite work for me  
> (see below).
>
> I was hoping to find a way to combine dataframes where I needed  
> only to ensure the key variables were present. The total number of  
> variables in the final dataframe would be the total number of  
> different variables in both initial dataframes. Variables that were  
> absent in one dataframe would automatically get missing values in  
> the joint dataframe.
>
> Here is a simple example. The initial dataframes are a and b. All  
> variables in b are also in a.
>
> a <- data.frame(X=seq(1,10), matrix(runif(100, 0,15), ncol=10))
> b <- data.frame(X=seq(16,20), X4=runif(5,0,15))
>
> A merge does not work because the common variable X4 becomes 2  
> variables, X4.x and X4.y.
>
> c <- merge(a,b,by="X", all=T)
>
> This can be fixed but it requires several steps (although my  
> solution is probably not optimal):
>
> names(c)[5] <- "X4"
> c$X4[is.na(c$X4)] <- c$X4.y[is.na(c$X4)]
> c <- c[,1:11]
>
> One quickly becomes tired with this solution with my real-life  
> dataframes where different columns would require "repair" from one  
> case to the next.
>
> I think I still prefer making the narrower dataframe like the wider  
> one:
>
> b2 <- upData(b, X1=NA, X2=NA, X3=NA, X5=NA, X6=NA, X7=NA, X8=NA,  
> X9=NA, X10=NA)
> b2 <- b2[,c(1, 3:5, 2, 6:11)]
>
> d <- rbind(a, b2)
>
> But again this requires quite a bit of fine-tuning from one case to  
> the next in my real-life dataframes.
>
> I suspect R has a neat way to do this and I just cannot come up  
> with the proper search term to find help on my own.
>
> Or this can be automated: can one compare variable lists from 2  
> dataframes and add missing variables in the "narrower" dataframe?
>
> Ideally, the solution would be able to handle the situation where  
> the narrower dataframe contains one or more variables that are  
> absent from the wider one. If this was the case, I'd like the new  
> variable to be present in the combined dataframe, with missing  
> values given to the observations from the wider dataframe.
>
> Thanks in advance,
>
> Denis Chabot
>
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] query in R

2006-11-07 Thread Xiaodong Jin
how to realize the following SQL command in R?
   
  select distinct A, B, count(C)
  from TABLE
  group by A, B
  ;
  quit;
   
  Best Regards

 
-
Sponsored Link

Get a free Motorola Razr! Today Only! Choose Cingular, Sprint, Verizon, Alltel, 
or T-Mobile.
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] combining dataframes with different numbers of columns

2006-11-07 Thread hadley wickham
> Or, try this:
>
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77358.html

It's interesting to compare your implementation:

rbind.all <- function(...) {
   x <- list(...)
   cn <- unique(unlist(lapply(x, colnames)))
   for(i in seq(along = x)) {
 if(any(m <- !cn %in% colnames(x[[i]]))) {
   na <- matrix(NA, nrow(x[[i]]), sum(m))
   dimnames(na) <- list(rownames(x[[i]]), cn[m])
   x[[i]] <- cbind(x[[i]], na)
 }
   }
   do.call(rbind, x)
}

with mine:

rbind.fill <- function (...) {
dfs <- list(...)
if (length(dfs) == 0)
return(list())
all.names <- unique(unlist(lapply(dfs, names)))
do.call("rbind", compact(lapply(dfs, function(df) {
if (length(df) == 0 || nrow(df) == 0)
return(NULL)
missing.vars <- setdiff(all.names, names(df))
if (length(missing.vars) > 0)
df[, missing.vars] <- NA
df
})))
}

they're pretty similar!

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] chisq test with for loop

2006-11-07 Thread downunder

Hi all.

i am desperating. i need a matrix of p.values from an chi square test.  i
had it already work but than my computer collapsed when taking the whole
data set 800x260 into account. i am sure it looked like this but it doesn't
work now. can anybody help me? thanks in advance.

x=read.table("C:\...)
d=ncols(x)
z<=matrix(0,d,d)
for(i in 1:d)
for(j in 1:d)
z[i,j]<=chisq.test(x[,i],x[,j])$p.value
round(z,3)
-- 
View this message in context: 
http://www.nabble.com/-R---chisq-test-with-for-loop-tf2593044.html#a7232065
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] combining dataframes with different numbers of columns

2006-11-07 Thread Sundar Dorai-Raj


hadley wickham said the following on 11/7/2006 8:46 PM:
> On 11/7/06, Denis Chabot <[EMAIL PROTECTED]> wrote:
>> Dear list members,
>>
>> I have to combine dataframes together. However they contain different
>> numbers of variables. It is possible that all the variables in the
>> dataframe with fewer variables are contained in the dataframe with
>> more variables, though it is not always the case.
>>
>> There are key variables identifying observations. These could be used
>> in a merge statement, although this won't quite work for me (see below).
>>
>> I was hoping to find a way to combine dataframes where I needed only
>> to ensure the key variables were present. The total number of
>> variables in the final dataframe would be the total number of
>> different variables in both initial dataframes. Variables that were
>> absent in one dataframe would automatically get missing values in the
>> joint dataframe.
> 
> Have a look at rbind.fill in the reshape package.
> 
> library(reshape)
> rbind.fill(data.frame(a=1), data.frame(b=2))
> rbind.fill(data.frame(a=1), data.frame(a=2, b=2))
> 
> 
> Hadley
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Or, try this:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77358.html

HTH,

--sundar

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] nls

2006-11-07 Thread Xiaodong Jin
> y
[1]   1  11  42  64 108 173 214
   
  > t
[1] 1 2 3 4 5 6 7
   
  > nls(1/y ~ c*exp(-a*b*t)+1/b, start=list(a=0.001,b=250,c=5), trace=TRUE)
29.93322 :0.001 250.000   5.000 
Error in numericDeriv(form[[3]], names(ind), env) : 
Missing value or an infinity produced when evaluating the model
   
  # the start value for b is almost close to final estimates, 
  # a is usually small positive close to 0
  # c is a positive number
  # Do I need different estimation method?
   
  Regards
  xj
   
   

 
-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] combining dataframes with different numbers of columns

2006-11-07 Thread Stephen D. Weigand
Denis,

On Nov 7, 2006, at 8:30 PM, Denis Chabot wrote:

> Dear list members,
>
> I have to combine dataframes together. However they contain different
> numbers of variables. It is possible that all the variables in the
> dataframe with fewer variables are contained in the dataframe with
> more variables, though it is not always the case.
>
> There are key variables identifying observations. These could be used
> in a merge statement, although this won't quite work for me (see 
> below).
>
> I was hoping to find a way to combine dataframes where I needed only
> to ensure the key variables were present. The total number of
> variables in the final dataframe would be the total number of
> different variables in both initial dataframes. Variables that were
> absent in one dataframe would automatically get missing values in the
> joint dataframe.
>
> Here is a simple example. The initial dataframes are a and b. All
> variables in b are also in a.
>
> a <- data.frame(X=seq(1,10), matrix(runif(100, 0,15), ncol=10))
> b <- data.frame(X=seq(16,20), X4=runif(5,0,15))
>
> A merge does not work because the common variable X4 becomes 2
> variables, X4.x and X4.y.
>
> c <- merge(a,b,by="X", all=T)


[snipped]


> Thanks in advance,
>
> Denis Chabot
>

Will

   merge(a, b, by = intersect(names(a), names(b)), all = TRUE)

do what you want? (Note the 'by' argument uses the default so
it can be left out.)

Hope this helps,

Stephen

Stephen Weigand
Rochester, Minnesota, USA

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] combining dataframes with different numbers of columns

2006-11-07 Thread hadley wickham
On 11/7/06, Denis Chabot <[EMAIL PROTECTED]> wrote:
> Dear list members,
>
> I have to combine dataframes together. However they contain different
> numbers of variables. It is possible that all the variables in the
> dataframe with fewer variables are contained in the dataframe with
> more variables, though it is not always the case.
>
> There are key variables identifying observations. These could be used
> in a merge statement, although this won't quite work for me (see below).
>
> I was hoping to find a way to combine dataframes where I needed only
> to ensure the key variables were present. The total number of
> variables in the final dataframe would be the total number of
> different variables in both initial dataframes. Variables that were
> absent in one dataframe would automatically get missing values in the
> joint dataframe.

Have a look at rbind.fill in the reshape package.

library(reshape)
rbind.fill(data.frame(a=1), data.frame(b=2))
rbind.fill(data.frame(a=1), data.frame(a=2, b=2))


Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] combining dataframes with different numbers of columns

2006-11-07 Thread Denis Chabot
Dear list members,

I have to combine dataframes together. However they contain different  
numbers of variables. It is possible that all the variables in the  
dataframe with fewer variables are contained in the dataframe with  
more variables, though it is not always the case.

There are key variables identifying observations. These could be used  
in a merge statement, although this won't quite work for me (see below).

I was hoping to find a way to combine dataframes where I needed only  
to ensure the key variables were present. The total number of  
variables in the final dataframe would be the total number of  
different variables in both initial dataframes. Variables that were  
absent in one dataframe would automatically get missing values in the  
joint dataframe.

Here is a simple example. The initial dataframes are a and b. All  
variables in b are also in a.

a <- data.frame(X=seq(1,10), matrix(runif(100, 0,15), ncol=10))
b <- data.frame(X=seq(16,20), X4=runif(5,0,15))

A merge does not work because the common variable X4 becomes 2  
variables, X4.x and X4.y.

c <- merge(a,b,by="X", all=T)

This can be fixed but it requires several steps (although my solution  
is probably not optimal):

names(c)[5] <- "X4"
c$X4[is.na(c$X4)] <- c$X4.y[is.na(c$X4)]
c <- c[,1:11]

One quickly becomes tired with this solution with my real-life  
dataframes where different columns would require "repair" from one  
case to the next.

I think I still prefer making the narrower dataframe like the wider one:

b2 <- upData(b, X1=NA, X2=NA, X3=NA, X5=NA, X6=NA, X7=NA, X8=NA,  
X9=NA, X10=NA)
b2 <- b2[,c(1, 3:5, 2, 6:11)]

d <- rbind(a, b2)

But again this requires quite a bit of fine-tuning from one case to  
the next in my real-life dataframes.

I suspect R has a neat way to do this and I just cannot come up with  
the proper search term to find help on my own.

Or this can be automated: can one compare variable lists from 2  
dataframes and add missing variables in the "narrower" dataframe?

Ideally, the solution would be able to handle the situation where the  
narrower dataframe contains one or more variables that are absent  
from the wider one. If this was the case, I'd like the new variable  
to be present in the combined dataframe, with missing values given to  
the observations from the wider dataframe.

Thanks in advance,

Denis Chabot

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading VERY large binary files

2006-11-07 Thread Duncan Murdoch
On 11/7/2006 4:54 PM, Matt Anthony wrote:
> Hello, 
> 
>  
> 
> I am trying to read in elements out of a very large binary file ... the
> total file is 4 gigs. I want to select rows out of the file, and the
> current procedure I run works but is prohibitively slow (takes more than
> a day to run and still won't complete). Is there any faster way to
> accomplish this?

You are doing several things that are likely to be slow.
> 
>  
> 
> My current procedure looks like this:
> 
>  
> 
> readHH <- function(file_name, hhid_list) {
> 
> incon=file(file_name, open="rb")
> 
> result=data.frame()
> 
> tran=list()
> 
> byte_mark=0
> 
> last_1M_mod=0
> 
> file_size=file.info(file_name)$size
> 
> write.table(paste("Data pulled from", file_name, sep=" "),
> file="readHH_output.txt", sep=",", row.names=FALSE, col.names=FALSE,
> append=TRUE)
> 
> while (TRUE) {
> 
> tran$hh_id <- readBin(incon,integer(),1,size=4)

Why use a function call integer() here, rather than just the character 
string "integer"?
> 
> if(is.element(tran$hh_id, hhid_list)) {

You don't show us the is.element() function, but since it's going to be 
called a lot, it might be a place for an optimization.

> 
> tran$prov_id <- readBin(incon,integer(),1,size=2)
> 
> tran$txn_dn <- readBin(incon,integer(),1,size=2)
> 
> tran$total_dollars <- readBin(incon,integer(),1,size=4)
> 
> tran$total_items <- readBin(incon,integer(),1,size=4)
> 
> tran$order_id <- readBin(incon,integer(),1,size=4)
> 
> tran$txn_type <- readChar(incon,1)
> 
> tran$gender <- readChar(incon,1)
> 
> tran$zip_code <- readChar(incon,5)
> 
> tran$region_code <- readChar(incon,1)
> 
> tran$county_code <- readChar(incon,1)
> 
> tran$state_abbrev <- readChar(incon,2)
> 
> tran$channel_code <- readChar(incon,1)
> 
> tran$source_code <- readChar(incon,20)
> 
> tran$payment_type <- readChar(incon,1)
> 
> tran$credit_card <- readChar(incon,1)
> 
> tran$promo_type <- readChar(incon,1)
> 
> tran$flags <- readChar(incon,1)

You could probably make all of this a lot faster by combining it into 
three calls:

readBin(ints2, "integer", 2, size=2)
readBin(ints4, "integer", 4, size=4)
readChar(chars, 36)

and then extracting the elements after reading.  The extraction will 
probably be pretty fast, especially if you put the results into matrices 
rather than data.frames.  data.frames are hugely slower than matrices.

> 
> write.table(data.frame(tran), file="readHH_output", sep=",",
> row.names=FALSE, col.names=FALSE, append=TRUE)

This is going to reopen, seek, and close the file each time.  Do you 
really need to do that?  Can't you open the output file once, then just 
write the data to it?

> 
> result <- rbind(result,data.frame(tran))

This is also very slow.  It needs to grow a big list of vectors (which 
is how result is stored) every time you read a record.  It would be 
faster if you could pre-allocate the result, and just assign values into 
it, especially if you were assigning into a matrix, not a dataframe.

I don't know which of these suggestions will have the biggest effect. 
I'd suggest trying them one by one until things are fast enough, and 
then going on to something else.

Duncan Murdoch

> 
> }
> 
> else {
> 
> byte_mark=byte_mark+42
> 
> if (byte_mark>=file_size) {break}
> 
> else {seek(incon, where=byte_mark)}
> 
> }
> 
> }
> 
> return(result)
> 
> }
> 
>  
> 
> Thanks
> 
>  
> 
> Matt
> 
>  
> 
>  
> 
>  
> 
>  
> 
> Matt Anthony | Senior Statistician| 303.327.1761 |
> [EMAIL PROTECTED]
> 10155 Westmoor Drive | Westminster, CO 80021 | FAX 303.327.1650
> 
>  
> 
>  
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] have I an actual matrix?

2006-11-07 Thread Michael Kubovy
On Nov 7, 2006, at 6:25 PM, Ricardo Rodríguez - Your EPEC ICT Team  
wrote:

> library(RMySQL)
> con <- dbConnect(dbDriver
> ("MySQL"),host='localhost',username='root',dbname='ibdona')
> rs <- dbGetQuery (con,"select n,year from ibdona.library_location")
> dbDisconnect(con)
> Graph <- barplot(rs)
>
> And here the error I get...
>
> Error in barplot.default(rs) : 'height' must be a vector or a matrix
>
> paste(rs) gives me...
>
> [1] "c(307, 65, 2, 28, 3, 229, 81, 5, 7, 558, 134, 53, 9)"
> [2] "c(2002, 2002, 2002, 2002, 2002, 2003, 2003, 2003, 2003, 2004,
> 2004, 2004, 2004)"

nums <- c(307, 65, 2, 28, 3, 229, 81, 5, 7, 558, 134, 53, 9)
names(nums) <- c(2002, 2002, 2002, 2002, 2002, 2003, 2003, 2003,  
2003, 2004, 2004, 2004, 2004)
barplot(nums)

or

require(gplots)
barplot2(nums, plot.grid = TRUE, las = 1) # offers many nice options
_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] chi.test in R

2006-11-07 Thread downunder

Hi all. 

I need some help computing multidimensional pvalues of a multivariate data
set.

chisq.test(x[,1],x[,2])$p.value

i need a command or loop that creates me a vector or a matrix (each variabe
with each variable) would be even better for the p.values of the variables
of a data set.

something like 

chisq.test(x[,1:5],x[,2])$p.value or i=c(1,2,3)
chisq.test(x[,i],x[,j])$p.value doesn't work

would be pleased about every help. thanks in advance. lars


-- 
View this message in context: 
http://www.nabble.com/chi.test-in-R-tf2592507.html#a7230474
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] have I an actual matrix?

2006-11-07 Thread Ricardo Rodríguez - Your EPEC ICT Team
Hi all!

I do hope question from newcomers are wellcome here! Thanks in advance.

Trying to catch up and to acquired the needed background to easily  
read R documents it is being a bit hard to me to get into the  
required concepts to deal with data.

I am trying to get data from a MySQL database and plotting it with  
barplot. Here the code...

library(RMySQL)
con <- dbConnect(dbDriver 
("MySQL"),host='localhost',username='root',dbname='ibdona')
rs <- dbGetQuery (con,"select n,year from ibdona.library_location")
dbDisconnect(con)
Graph <- barplot(rs)

And here the error I get...

Error in barplot.default(rs) : 'height' must be a vector or a matrix

paste(rs) gives me...

[1] "c(307, 65, 2, 28, 3, 229, 81, 5, 7, 558, 134, 53, 9)"
[2] "c(2002, 2002, 2002, 2002, 2002, 2003, 2003, 2003, 2003, 2004,  
2004, 2004, 2004)"

So, I am guessing I've gotten the data but there is at least an step  
lacking to be able to use it as the entry matrix required by barplot.

Please, could you help me with this issue? What is the step/steps  
lacking in my quite short code? Thanks!!!

Best,


--
Ricardo Rodríguez
Your EPEC ICT Team




[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Reformat a data frame

2006-11-07 Thread Michael Jerosch-Herold
You want to "reshape" from "wide" into "long" format: see "help(reshape)".
 
For your example this should look something like
 
df2 <- reshape(df1, varying=list(c("resist","thick","temp")), direction="long",
   v.names=c("Value"), timevar="Param",
   idvar="ID", times=c("resist","thick","temp"))
 
will give you roughly what you want - maybe not in the exact order as listed 
below for df2, but you can "sort' then.
 
You are "merging" all value for three variables in the wide format, into one 
variable ("Value") in the "long" format...
 
Try it, I did not test the above, but have done similar things before along 
those lines.
 
Michael Jerosch-Herold

>>> "Thorsten Muehge" <[EMAIL PROTECTED]> 11/07/06 1:10 AM >>>

Hello Experts,
how do I reformat a data frame in the way described below:


df1:
ID desc resist thick temp
1 4711 100 5 20
2 4712 101 4 21
3 4711 99 3 19
4 4712 98 7 22

TO

df2:
id desc Param Value
1 4711 resist 100
1 4711 Thick 5
1 4711 temp 20
2 4712 resist 101
2 4712 Thick 4
2 4712 temp 21
3 4711 resist 99
3 4711 thick 4
3 4711 temp 19
4 4712 resist 98
4 4712 thick 7
4 4712 temp 22

Thanks a lot for your help.
With best regards
Thorsten





[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] gamm(): nested tensor product smooths

2006-11-07 Thread Fabian Scheipl
I'd like to compare tests based on the mixed model representation of additive 
models, testing among others

y=f(x1)+f(x2) vs y=f(x1)+f(x2)+f(x1,x2)
(testing for additivity)

In mixed model representation, where X represents the unpenalized part of the 
spline functions and Z the "wiggly" parts, this would be:

y=X%*%beta+ Z_1%*%b_1+ Z_2%*%b_2
vs
y=X%*%beta+ Z_1%*%b_1+ Z_2%*%b_2 + Z_12 %*% b_12

where b are random effect vectors and the hypothesis to be tested is

H_0: Var(b_12)=0 (<=> b_12_i == 0 for all i)

the problem:
gamm() does not seem to support the use of nested tensor product splines,
does anybody know how to work around this?

example code:  (you'll need to source the P-spline constructor from ?p.spline 
beforehand)

###
test1<-function(x,z,sx=0.3,sz=0.4)
 { (pi**sx*sz)*(1.2*exp(-(x-0.2)^2/sx^2-(z-0.3)^2/sz^2)+
   0.8*exp(-(x-0.7)^2/sx^2-(z-0.8)^2/sz^2))
 }
 n<-400
 x<-runif(n);z<-runif(n);
 f <- test1(x,z)
 y <- f + rnorm(n)*0.1

 
b<-gam(y~s(x,bs="ps",m=c(3,2))+s(z,bs="ps",m=c(3,2))+te(x,z,bs=c("ps","ps"),m=c(3,1),mp=F))
 

##works fine

b <- 
gamm(y~s(x,bs="ps",m=c(3,2),k=10))+s(z,bs="ps",m=c(3,2),k=10)+te(x,z,bs=c("ps","ps"),m=c(3,1),k=c(5,5)))

# : Singularity in backsolve at level 0, block 1

b <- gamm(y~te(x,z,bs=c("ps","ps"),m=c(3,0),k=c(5,5))) #works fine

# Additionallly, i'd like to work with
# just one smoothness parameter
# for the interaction, but mp=F doesn't work either:

b <- 
gamm(y~s(x,bs="ps",m=c(3,2),k=10)+s(z,bs="ps",m=c(3,2),k=10)+te(x,z,bs=c("ps","ps"),m=c(3,1),k=c(5,5),mp=F))

# Tensor product penalty rank appears to be too low

# which i don't really understand, since the penalty matrix for the
# p-spline should be

S<-t(diff(diag(5),diff=1))%*%(diff(diag(5),diff=1))   
# penalizing deviations from constant function 
# for the tensor product spline --> m=c(3,1)
S
# [,1] [,2] [,3] [,4] [,5]
#[1,]1   -1000
#[2,]   -12   -100
#[3,]0   -12   -10
#[4,]00   -12   -1
#[5,]000   -11

#and
tensor.prod.penalties(list(S,S))

#which should be the penalties for the tensor prod smooth,
# has rank 20-  that's not enough ? 
 
sum(eigen(S[[2]])$values>1e-10)
#> [1] 20

##

I hope some of the experts out there can help me out- any hints would be 
appreciated
the problem is not caused by the p-splines, it also douesn't work with bs="tp".

thank you for your time.
--

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] solve computationally singular

2006-11-07 Thread Ravi Varadhan
For heaven's sake, please stop sending repeat emails and send your R code
that can reproduce the error.

Ravi. 


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of xchen
Sent: Tuesday, November 07, 2006 2:46 PM
To: r-help@stat.math.ethz.ch
Subject: [R] solve computationally singular

Hi uRsers,

when inverting a 2 by 2 matrix using solve, I encountered a error message:
solve.default(sigma, tol = 1e-07) :
system is computationally singular: reciprocal condition number 
= 1.7671e-017

and then I test the determinant of this matrix: 6.341393e-06.

In my program, I have a condition block that whether a matrix is 
invertible like this:
if(det(sigma)<1e-7) return NULL;

but this seems doesnot work to prevent the singularity when inverting a 
matrix. I am some confused about the relationship between "reciprocal 
condition number" and determinant. Can anybody give me some idea how to 
prevent this situation?

Thanks a lot!

Xiaohui

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Reformat a data frame

2006-11-07 Thread Gabor Grothendieck
In addition to the reshape solution posted one could use melt from
the reshape package:

melt(df1, id = 1:2)



On 11/7/06, Thorsten Muehge <[EMAIL PROTECTED]> wrote:
>
> Hello Experts,
> how do I reformat a data frame in the way described below:
>
>
> df1:
> IDdesc  resist  thick temp
> 1 4711  100   5 20
> 2 4712  101   4 21
> 3 4711  993 19
> 4 4712  987 22
>
> TO
>
> df2:
> iddesc  Param Value
> 1 4711  resist  100
> 1 4711  Thick 5
> 1 4711  temp  20
> 2 4712  resist  101
> 2 4712  Thick 4
> 2 4712  temp  21
> 3 4711  resist  99
> 3 4711  thick 4
> 3 4711  temp  19
> 4 4712  resist  98
> 4 4712  thick 7
> 4 4712  temp  22
>
> Thanks a lot for your help.
> With best regards
> Thorsten
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] solve computationally singular

2006-11-07 Thread xchen
Hi uRsers,

when inverting a 2 by 2 matrix using solve, I encountered a error message:
solve.default(sigma, tol = 1e-07) :
system is computationally singular: reciprocal condition number 
= 1.7671e-017

and then I test the determinant of this matrix: 6.341393e-06.

In my program, I have a condition block that whether a matrix is 
invertible like this:
if(det(sigma)<1e-7) return NULL;

but this seems doesnot work to prevent the singularity when inverting a 
matrix. I am some confused about the relationship between "reciprocal 
condition number" and determinant. Can anybody give me some idea how to 
prevent this situation?

Thanks a lot!

Xiaohui

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] reading VERY large binary files

2006-11-07 Thread Matt Anthony
Hello, 

 

I am trying to read in elements out of a very large binary file ... the
total file is 4 gigs. I want to select rows out of the file, and the
current procedure I run works but is prohibitively slow (takes more than
a day to run and still won't complete). Is there any faster way to
accomplish this?

 

My current procedure looks like this:

 

readHH <- function(file_name, hhid_list) {

incon=file(file_name, open="rb")

result=data.frame()

tran=list()

byte_mark=0

last_1M_mod=0

file_size=file.info(file_name)$size

write.table(paste("Data pulled from", file_name, sep=" "),
file="readHH_output.txt", sep=",", row.names=FALSE, col.names=FALSE,
append=TRUE)

while (TRUE) {

tran$hh_id <- readBin(incon,integer(),1,size=4)

if(is.element(tran$hh_id, hhid_list)) {

tran$prov_id <- readBin(incon,integer(),1,size=2)

tran$txn_dn <- readBin(incon,integer(),1,size=2)

tran$total_dollars <- readBin(incon,integer(),1,size=4)

tran$total_items <- readBin(incon,integer(),1,size=4)

tran$order_id <- readBin(incon,integer(),1,size=4)

tran$txn_type <- readChar(incon,1)

tran$gender <- readChar(incon,1)

tran$zip_code <- readChar(incon,5)

tran$region_code <- readChar(incon,1)

tran$county_code <- readChar(incon,1)

tran$state_abbrev <- readChar(incon,2)

tran$channel_code <- readChar(incon,1)

tran$source_code <- readChar(incon,20)

tran$payment_type <- readChar(incon,1)

tran$credit_card <- readChar(incon,1)

tran$promo_type <- readChar(incon,1)

tran$flags <- readChar(incon,1)

write.table(data.frame(tran), file="readHH_output", sep=",",
row.names=FALSE, col.names=FALSE, append=TRUE)

result <- rbind(result,data.frame(tran))

}

else {

byte_mark=byte_mark+42

if (byte_mark>=file_size) {break}

else {seek(incon, where=byte_mark)}

}

}

return(result)

}

 

Thanks

 

Matt

 

 

 

 

Matt Anthony | Senior Statistician| 303.327.1761 |
[EMAIL PROTECTED]
10155 Westmoor Drive | Westminster, CO 80021 | FAX 303.327.1650

 

 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] solve computationally singular

2006-11-07 Thread xchen
Hi uRsers,

when inverting a 2 by 2 matrix using solve, I encountered a error message:
solve.default(sigma, tol = 1e-07) :
   system is computationally singular: reciprocal condition number
= 1.7671e-017

and then I test the determinant of this matrix: 6.341393e-06.

In my program, I have a condition block that whether a matrix is
invertible like this:
if(det(sigma)<1e-7) return NULL;

but this seems doesnot work to prevent the singularity when inverting a
matrix. I am some confused about the relationship between "reciprocal
condition number" and determinant. Can anybody give me some idea how to
prevent this situation?

Thanks a lot!

Xiaohui

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] clustering package with constraints (advice)?

2006-11-07 Thread Jeff D. Hamann
R-gurus,

I'm looking for (a) clustering method(s) (package(s)) that allow users to
add constraints. I would like to be able to use a currently existing
package and to include constraints that can be passed as functions of the
data. If that's not possible, can someone recommend a package that would
be easiest to hack on for a trial?

Thanks,
Jeff.


-- 
Forest Informatics, Inc.
PO Box 1421
Corvallis, Oregon 97339-1421

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Comparison between GARCH and ARMA

2006-11-07 Thread Leeds, Mark \(IED\)
if the return is assumed zero, the epsilon t sequared is the variance of
the return but the epsilon_t is not the return. i think we should
have a conversation off line because i don't want to bother the whole
list with this. what the original email said is still incorrect,
( see below ) but, if all you are saying that the variance,
sigma_squared,  is expectation of epslion_t squared term is when the
mean is zero, i agree with you.
 
the return  itself, r_t, is still a  normal random variable times this
"innovation" as you put it so you can't build an arma or an arima or
whatever for the return. if you want to build one for the return squared
( dont' subtract a mean because it's already zero ) , 
that's fine but then you are really building one for the variance.  so,
the original should have had epsilon_t squared in the transformed
equation,
NOT r_t ^2. r_t is still equal to epsilon_t*z_t and e(r_t)^2=
sigma_squared but r_t^2 is not the same as the epsilon_t^2.   if this
isn't clear, 
i don't know what else to say. 
 
 
 
 
 
 
 
 
 



From: Hannu Kahra [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 07, 2006 4:15 PM
To: Leeds, Mark (IED)
Cc: Wensui Liu; r-help@stat.math.ethz.ch; Megh Dal
Subject: Re: [R] Comparison between GARCH and ARMA


Except in the case of zero means, that is point (7) in your previous
mail.


On 11/7/06, Leeds, Mark (IED) < [EMAIL PROTECTED]
 > wrote: 

but not the return squared squared which is what was written
previously.
.
 



From: Hannu Kahra [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 07, 2006 3:54 PM
To: Wensui Liu
Cc: Leeds, Mark (IED); r-help@stat.math.ethz.ch; Megh Dal
Subject: Re: [R] Comparison between GARCH and ARMA



A GARCH model can be regarded as an application of the ARMA idea
to the squared innovation series. See, e.g. Ruey S. Tsay, Analysis of
Financial Time Series, Wiley, 2nd edition, page 114.

Hannu


On 11/7/06, Wensui Liu <[EMAIL PROTECTED]> wrote: 

Mark,

I totally agree that it doesn't make sense to compare
arma with garch.

but to some extent, garch can be considered arma for
conditional
variance. similarly, arch can be considered ma for
conditional 
variance.

the above is just my understanding, which might not be
correct.

thanks.

On 11/7/06, Leeds, Mark (IED)
<[EMAIL PROTECTED]> wrote: 
> Hi : I'm a R novice but I consider myself reasonably
versed in time
> series related material and
> I have never heard of an equivalence between
Garch(1,1) for volatility
> and an ARMA(1,1) in the squared returns 
> and I'm almost sure there isn't.
>
> There are various problems with what you wrote.
>
> 1) r(t) = h(t)*z(t) not h(i) but that's not a big
deal.
>
> 2) you can't write the equation in terms of r(t)
because r(t) = 
> h(t)*z(t) and h(t) is UPDATED FIRST
> And then the relation r(t) = h(t)*z(t) is true ( in
the sense of the
> model ). So, r(t) is
> a function of z(t) , a random variable, so trying to
use r(t) on the 
> left hand side of the volatility
> equation doesn't make sense at all.
>
> 3) even if your equation was valid, what you wrote is
not an ARMA(1,1).
> The AR term is there but the MA term
> ( the beta term ) Has an r_t-1 terms in it when r_t-1
is on the left
> side. An MA term in an ARMA framework
> multiples lagged noise terms not the lag of what's on
the left side.
> That's what the AR term does. 
>
> 4) even if your equation was correct in terms of it
being a true
> ARMA(1,1) , you
> Have common coefficients on The AR term and MA term (
beta ) so you
> would need contraints to tell the 
> Model that this was the same term in both places.
>
> 5) basically, you can't do what you
> Are trying to do so you shouldn't expect to any
consistency in estimates
> Of the intercept for the reasons stated above. 
> why are you trying to transform in such a way anyway ?
>
> Now back to your original garch(1,1) model
>
> 6) a garch(1,1) has a stationarity condition that
alpha + beta is less

Re: [R] Comparison between GARCH and ARMA

2006-11-07 Thread Hannu Kahra
Except in the case of zero means, that is point (7) in your previous mail.

On 11/7/06, Leeds, Mark (IED) <[EMAIL PROTECTED]> wrote:
>
>  but not the return squared squared which is what was written previously.
> .
>
>
>  --
> *From:* Hannu Kahra [mailto:[EMAIL PROTECTED]
> *Sent:* Tuesday, November 07, 2006 3:54 PM
> *To:* Wensui Liu
> *Cc:* Leeds, Mark (IED); r-help@stat.math.ethz.ch; Megh Dal
> *Subject:* Re: [R] Comparison between GARCH and ARMA
>
> A GARCH model can be regarded as an application of the ARMA idea to the
> squared innovation series. See, e.g. Ruey S. Tsay, Analysis of Financial
> Time Series, Wiley, 2nd edition, page 114.
>
> Hannu
>
> On 11/7/06, Wensui Liu <[EMAIL PROTECTED]> wrote:
> >
> > Mark,
> >
> > I totally agree that it doesn't make sense to compare arma with garch.
> >
> > but to some extent, garch can be considered arma for conditional
> > variance. similarly, arch can be considered ma for conditional
> > variance.
> >
> > the above is just my understanding, which might not be correct.
> >
> > thanks.
> >
> > On 11/7/06, Leeds, Mark (IED) <[EMAIL PROTECTED]> wrote:
> > > Hi : I'm a R novice but I consider myself reasonably versed in time
> > > series related material and
> > > I have never heard of an equivalence between Garch(1,1) for volatility
> > > and an ARMA(1,1) in the squared returns
> > > and I'm almost sure there isn't.
> > >
> > > There are various problems with what you wrote.
> > >
> > > 1) r(t) = h(t)*z(t) not h(i) but that's not a big deal.
> > >
> > > 2) you can't write the equation in terms of r(t) because r(t) =
> > > h(t)*z(t) and h(t) is UPDATED FIRST
> > > And then the relation r(t) = h(t)*z(t) is true ( in the sense of the
> > > model ). So, r(t) is
> > > a function of z(t) , a random variable, so trying to use r(t) on the
> > > left hand side of the volatility
> > > equation doesn't make sense at all.
> > >
> > > 3) even if your equation was valid, what you wrote is not an
> > ARMA(1,1).
> > > The AR term is there but the MA term
> > > ( the beta term ) Has an r_t-1 terms in it when r_t-1 is on the left
> > > side. An MA term in an ARMA framework
> > > multiples lagged noise terms not the lag of what's on the left side.
> > > That's what the AR term does.
> > >
> > > 4) even if your equation was correct in terms of it being a true
> > > ARMA(1,1) , you
> > > Have common coefficients on The AR term and MA term ( beta ) so you
> > > would need contraints to tell the
> > > Model that this was the same term in both places.
> > >
> > > 5) basically, you can't do what you
> > > Are trying to do so you shouldn't expect to any consistency in
> > estimates
> > > Of the intercept for the reasons stated above.
> > > why are you trying to transform in such a way anyway ?
> > >
> > > Now back to your original garch(1,1) model
> > >
> > > 6) a garch(1,1) has a stationarity condition that alpha + beta is less
> > > than 1
> > > So this has to be satisfied when you estimate a garch(1,1).
> > >
> > > It looks like this condition is satisfied so you should be okay there.
> > >
> > > 7) also, if you are really assuming/believe that the returns have mean
> >
> > > zero to begin with,  without subtraction,
> > > Then you shouldn't be subtracting the mean before you estimate
> > > Because eseentially you will be subtracting noise and throwing out
> > > useful
> > > Information that could used in estimating the garch(1,1) parameters.
> > > Maybe you aren't assuming that the mean is zero and you are making the
> > > mean zero which is fine.
> > >
> > > I hope this helps you. I don't mean to be rude but I am just trying to
> > > get across that what you
> > > Are doing is not valid. If you saw the equivalence somewhere in the
> > > literature,
> > > Let me know because I would be interested in looking at it.
> > >
> > >
> > > mark
> > >
> > >
> > >
> > >
> > >
> > >
> > > -Original Message-
> > > From: [EMAIL PROTECTED]
> > > [mailto: [EMAIL PROTECTED] On Behalf Of Megh Dal
> > > Sent: Tuesday, November 07, 2006 2:24 AM
> > > To: r-help@stat.math.ethz.ch
> > > Subject: [R] Comparison between GARCH and ARMA
> > >
> > > Dear all R user,
> > >
> > > Please forgive me if my problem is too simple.
> > > Actually my problem is basically Statistical rather directly R
> > related.
> > > Suppose I have return series ret
> > > with mean zero. And I want to fit a Garch(1,1)
> > > on this.
> > >
> > > my   is r[t] = h[i]*z[t]
> > >
> > > h[t] = w + alpha*r[t-1]^2 + beta*h[t-1]
> > >
> > > I want to estimate the three parameters here;
> > >
> > > the R syntax is as follows:
> > >
> > > # download data:
> > > data(EuStockMarkets)
> > > r <- diff(log(EuStockMarkets))[,"DAX"]
> > > r = r - mean(r)
> > >
> > > # fit a garch(1,1) on this:
> > > library(tseries)
> > > garch(r)
> > >
> > > The estimated parameters are given below:
> > >
> > >  * ESTIMATION WITH ANALYTICAL GRADIENT *
> > >
> > >
> > >
> > > Call:
> > > garch(x = r)
> > >

Re: [R] Comparison between GARCH and ARMA

2006-11-07 Thread Leeds, Mark \(IED\)
but not the return squared squared which is what was written previously.
.
 



From: Hannu Kahra [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 07, 2006 3:54 PM
To: Wensui Liu
Cc: Leeds, Mark (IED); r-help@stat.math.ethz.ch; Megh Dal
Subject: Re: [R] Comparison between GARCH and ARMA


A GARCH model can be regarded as an application of the ARMA idea to the
squared innovation series. See, e.g. Ruey S. Tsay, Analysis of Financial
Time Series, Wiley, 2nd edition, page 114.

Hannu


On 11/7/06, Wensui Liu <[EMAIL PROTECTED]> wrote: 

Mark,

I totally agree that it doesn't make sense to compare arma with
garch.

but to some extent, garch can be considered arma for conditional
variance. similarly, arch can be considered ma for conditional 
variance.

the above is just my understanding, which might not be correct.

thanks.

On 11/7/06, Leeds, Mark (IED) <[EMAIL PROTECTED]>
wrote: 
> Hi : I'm a R novice but I consider myself reasonably versed in
time
> series related material and
> I have never heard of an equivalence between Garch(1,1) for
volatility
> and an ARMA(1,1) in the squared returns 
> and I'm almost sure there isn't.
>
> There are various problems with what you wrote.
>
> 1) r(t) = h(t)*z(t) not h(i) but that's not a big deal.
>
> 2) you can't write the equation in terms of r(t) because r(t)
= 
> h(t)*z(t) and h(t) is UPDATED FIRST
> And then the relation r(t) = h(t)*z(t) is true ( in the sense
of the
> model ). So, r(t) is
> a function of z(t) , a random variable, so trying to use r(t)
on the 
> left hand side of the volatility
> equation doesn't make sense at all.
>
> 3) even if your equation was valid, what you wrote is not an
ARMA(1,1).
> The AR term is there but the MA term
> ( the beta term ) Has an r_t-1 terms in it when r_t-1 is on
the left
> side. An MA term in an ARMA framework
> multiples lagged noise terms not the lag of what's on the left
side.
> That's what the AR term does. 
>
> 4) even if your equation was correct in terms of it being a
true
> ARMA(1,1) , you
> Have common coefficients on The AR term and MA term ( beta )
so you
> would need contraints to tell the 
> Model that this was the same term in both places.
>
> 5) basically, you can't do what you
> Are trying to do so you shouldn't expect to any consistency in
estimates
> Of the intercept for the reasons stated above. 
> why are you trying to transform in such a way anyway ?
>
> Now back to your original garch(1,1) model
>
> 6) a garch(1,1) has a stationarity condition that alpha + beta
is less
> than 1 
> So this has to be satisfied when you estimate a garch(1,1).
>
> It looks like this condition is satisfied so you should be
okay there.
>
> 7) also, if you are really assuming/believe that the returns
have mean 
> zero to begin with,  without subtraction,
> Then you shouldn't be subtracting the mean before you estimate
> Because eseentially you will be subtracting noise and throwing
out
> useful
> Information that could used in estimating the garch(1,1)
parameters. 
> Maybe you aren't assuming that the mean is zero and you are
making the
> mean zero which is fine.
>
> I hope this helps you. I don't mean to be rude but I am just
trying to
> get across that what you 
> Are doing is not valid. If you saw the equivalence somewhere
in the
> literature,
> Let me know because I would be interested in looking at it.
>
>
> mark
>
>
>
>
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto: [EMAIL PROTECTED]
 ] On Behalf Of Megh Dal
> Sent: Tuesday, November 07, 2006 2:24 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Comparison between GARCH and ARMA 
>
> Dear all R user,
>
> Please forgive me if my problem is too simple.
> Actually my problem is basically Statistical rather directly R
related.
> Suppose I have return series ret
> with mean zero. And I want to fit a Garch(1,1)
> on this.
>
> my   is r[t] = h[i]*z[t]
>
> h[t] = w + alpha*r[t-1]^2 + beta*h[t-1]
>
> I want to estimate the three parameters here; 
>
> the R syntax is as follows:
>
> # download data:
> data(EuStockMarkets)
> r <- diff(log(EuStockMarke

Re: [R] Comparison between GARCH and ARMA

2006-11-07 Thread Hannu Kahra
A GARCH model can be regarded as an application of the ARMA idea to the
squared innovation series. See, e.g. Ruey S. Tsay, Analysis of Financial
Time Series, Wiley, 2nd edition, page 114.

Hannu

On 11/7/06, Wensui Liu <[EMAIL PROTECTED]> wrote:
>
> Mark,
>
> I totally agree that it doesn't make sense to compare arma with garch.
>
> but to some extent, garch can be considered arma for conditional
> variance. similarly, arch can be considered ma for conditional
> variance.
>
> the above is just my understanding, which might not be correct.
>
> thanks.
>
> On 11/7/06, Leeds, Mark (IED) <[EMAIL PROTECTED]> wrote:
> > Hi : I'm a R novice but I consider myself reasonably versed in time
> > series related material and
> > I have never heard of an equivalence between Garch(1,1) for volatility
> > and an ARMA(1,1) in the squared returns
> > and I'm almost sure there isn't.
> >
> > There are various problems with what you wrote.
> >
> > 1) r(t) = h(t)*z(t) not h(i) but that's not a big deal.
> >
> > 2) you can't write the equation in terms of r(t) because r(t) =
> > h(t)*z(t) and h(t) is UPDATED FIRST
> > And then the relation r(t) = h(t)*z(t) is true ( in the sense of the
> > model ). So, r(t) is
> > a function of z(t) , a random variable, so trying to use r(t) on the
> > left hand side of the volatility
> > equation doesn't make sense at all.
> >
> > 3) even if your equation was valid, what you wrote is not an ARMA(1,1).
> > The AR term is there but the MA term
> > ( the beta term ) Has an r_t-1 terms in it when r_t-1 is on the left
> > side. An MA term in an ARMA framework
> > multiples lagged noise terms not the lag of what's on the left side.
> > That's what the AR term does.
> >
> > 4) even if your equation was correct in terms of it being a true
> > ARMA(1,1) , you
> > Have common coefficients on The AR term and MA term ( beta ) so you
> > would need contraints to tell the
> > Model that this was the same term in both places.
> >
> > 5) basically, you can't do what you
> > Are trying to do so you shouldn't expect to any consistency in estimates
> > Of the intercept for the reasons stated above.
> > why are you trying to transform in such a way anyway ?
> >
> > Now back to your original garch(1,1) model
> >
> > 6) a garch(1,1) has a stationarity condition that alpha + beta is less
> > than 1
> > So this has to be satisfied when you estimate a garch(1,1).
> >
> > It looks like this condition is satisfied so you should be okay there.
> >
> > 7) also, if you are really assuming/believe that the returns have mean
> > zero to begin with,  without subtraction,
> > Then you shouldn't be subtracting the mean before you estimate
> > Because eseentially you will be subtracting noise and throwing out
> > useful
> > Information that could used in estimating the garch(1,1) parameters.
> > Maybe you aren't assuming that the mean is zero and you are making the
> > mean zero which is fine.
> >
> > I hope this helps you. I don't mean to be rude but I am just trying to
> > get across that what you
> > Are doing is not valid. If you saw the equivalence somewhere in the
> > literature,
> > Let me know because I would be interested in looking at it.
> >
> >
> > mark
> >
> >
> >
> >
> >
> >
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Megh Dal
> > Sent: Tuesday, November 07, 2006 2:24 AM
> > To: r-help@stat.math.ethz.ch
> > Subject: [R] Comparison between GARCH and ARMA
> >
> > Dear all R user,
> >
> > Please forgive me if my problem is too simple.
> > Actually my problem is basically Statistical rather directly R related.
> > Suppose I have return series ret
> > with mean zero. And I want to fit a Garch(1,1)
> > on this.
> >
> > my   is r[t] = h[i]*z[t]
> >
> > h[t] = w + alpha*r[t-1]^2 + beta*h[t-1]
> >
> > I want to estimate the three parameters here;
> >
> > the R syntax is as follows:
> >
> > # download data:
> > data(EuStockMarkets)
> > r <- diff(log(EuStockMarkets))[,"DAX"]
> > r = r - mean(r)
> >
> > # fit a garch(1,1) on this:
> > library(tseries)
> > garch(r)
> >
> > The estimated parameters are given below:
> >
> >  * ESTIMATION WITH ANALYTICAL GRADIENT *
> >
> >
> >
> > Call:
> > garch(x = r)
> >
> > Coefficient(s):
> >a0 a1 b1
> > 4.746e-06  6.837e-02  8.877e-01
> >
> > Now it is straightforward to transform Garch(1,1)
> >  to a ARMA   like this:
> >
> > r[t]^2 = w + (alpha+beta)*r[t-1]^2 + beta*(h[t-1] -
> > r[t-1]^2) - (h[t] - r[t]^2)
> >= w + (alpha+beta)*r[t-1]^2 + beta*theta[t-1] + theta[t]
> >
> > So if I fit a ARMA(1,1) on r[t]^2 I am getting following result;
> >
> > arma(r^2, order=c(1,1))
> >
> > Call:
> > arma(x = r^2, order = c(1, 1))
> >
> > Coefficient(s):
> >ar1 ma1   intercept
> >  9.157e-01  -8.398e-01   9.033e-06
> >
> > Therefore if the above derivation is correct then I should get a same
> > intercept term for both Garch and ARMA case. But here I am not getting
> > it

[R] solve computationally singular

2006-11-07 Thread xchen
Hi uRsers,

when inverting a 2 by 2 matrix using solve, I encountered a error message:
solve.default(sigma, tol = 1e-07) :
system is computationally singular: reciprocal condition number
= 1.7671e-017

and then I test the determinant of this matrix: 6.341393e-06.

In my program, I have a condition block that whether a matrix is
invertible like this:
if(det(sigma)<1e-7) return NULL;

but this seems doesnot work to prevent the singularity when inverting a
matrix. I am some confused about the relationship between "reciprocal
condition number" and determinant. Can anybody give me some idea how to
prevent this situation?

Thanks a lot!

Xiaohui

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] CPU or memory

2006-11-07 Thread bogdan romocea
> Does any one know of comparisons of the Pentium 9x0, Pentium(r)
> Extreme/Core 2 Duo, AMD(r) Athlon(r) 64 , AMD(r) Athlon(r) 64
> FX/Dual Core AM2 and similar chips when used for this kind of work.

I think your best option, by far, is to answer the question on your
own. Put R and your programs on a USB drive, go to a computer shop,
and ask the sales person to let you try a few configurations. Run your
simulations, time the results and compare. Keep in mind that the
numbers may be affected by the bus and memory frequency (and perhaps
memory size/fragmentation). With regards to single/dual core and 32/64
bit, search the archives and the documentation, it was asked before.
(I guess dual core and 64 bit would be a sound choice.) One other
thing you need to consider (if you haven't already) is ?Rprof, maybe
you can significantly improve the efficiency of your code or write
parts of it in C or Fortran.


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of John C Frain
> Sent: Tuesday, November 07, 2006 2:24 PM
> To: Taka Matzmoto
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] CPU or memory
>
> *Can I extend Taka's question?*
> **
> *Many of my programs in (mainly simulations in R which are
> cpu bound) on a
> year old PC ( Intel(R) Pentium(R) M processor 1.73GHz or Dell GX380
> with 2.8Gh Pentium) are taking hours and perhaps days to complete on a
> one year old
> PC.  I am looking at an upgrade but the variety of cpu's available is
> confusing at least.   Does any one know of comparisons of the Pentium
> 9x0, Pentium(r)
> Extreme/Core 2 Duo,   AMD(r) Athlon(r) 64 , AMD(r) Athlon(r) 64
> FX/Dual Core AM2 and
> similar chips when used for this kind of work.  Does anyone
> have any advice
> on (1)  the use of a single core or dual core cpu or (2) on
> the use of 32
> bit and 64 bit cpu.  This question is now much more difficult
> as the numbers
> on the various chips do not necessarily refer to the relative
> speed of the
> chips.
> *
> *John
>
> * On 06/11/06, Taka Matzmoto <[EMAIL PROTECTED]> wrote:
>
> > Hi R users
> >
> > Having both a faster CPU and more memory will boost
> computing power. I was
> > wondering if only adding more memory (1GB -> 2GB)  will
> significantly
> > reduce
> > R computation time?
> >
> > Taka,
> >
> > _
> > Get FREE company branded e-mail accounts and business Web site from
> > Microsoft Office Live
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> John C Frain
> Trinity College Dublin
> Dublin 2
> Ireland
> www.tcd.ie/Economics/staff/frainj/home.html
> mailto:[EMAIL PROTECTED]
> mailto:[EMAIL PROTECTED]
>
> [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Probit Scale

2006-11-07 Thread Gregor Gorjanc
nelson -  gmail.com> writes:
> Hi all!
>   i search but i found no info, so i'm heere to ask you! How can i
> plot a graph using the probit scale on y axes?

Not that I know, however you can transform y values via pnorm() i.e.

plot(x=x, y=pnorm(q=y, ...))

Gregor

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] evaluation of 2 matrices: categorical comparison

2006-11-07 Thread Dylan Beaudette
Greetings,

I have two matrices, read in from raster data stored in GRASS. Each matrix 
represents the output of a aggregation process on categorical data (Nomial / 
Ordinal) - derived from imagery.

I have compared these two data by the following methods:

* pretending the data is continuous approaches (flawed i am sure...)
1. computing a difference map by computing the absolute difference 
(cell-by-cell) between the two outputs

2. simple linear regression / scatter plot of the two outputs

3. 2D histogram via. hist2d() in the gplots package


*** categorical comparisons
4. conversion of each matrix to a vector of factors and:

5. frequency tabulation for each level

6. mosiacplot 

7. computation of Cohen's Kappa (using the cohen.kappa function from 
the 'concord' package) :
# a and b are vectors with the 'factor-ized' matrices, stored as vectors
cohen.kappa(table(a,b), type='count')


A lengthy summary of this small adventure has been recorded here:
http://casoilresource.lawr.ucdavis.edu/drupal/node/275/

Please note that I am looking for a *better?* way to compare these two 
matrices. It could be that the Cohen's Kappa, and difference maps are the 
best that I am going to get.

Thanks in advance,


-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] installing packages without being a root?

2006-11-07 Thread xchen
How about try:

R CMD INSTALL -l R_pkg_lib R_pkg

ahmet rasit wrote:
> Hi,
> I have a problem with installing packages without being a superuser(root) in 
> Linux(Suse 10.0 64bit). I've read the entire FAQ and R-admin but I couldn't 
> find a solution to my problem. I'm the admin of the computer but I want other 
> users to install whatever packages they want. Do you think that I have a 
> problem with user priviliges / directory accessin permissions?
> Thanks,
> [EMAIL PROTECTED]
>
>
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] RMySQL

2006-11-07 Thread Xiaodong Jin
  options(CRAN='http://cran.r-project.org')
  install.packages("RMySQL", type="source")
   
  Warning: unable to access index for repository 
http://www.ibiblio.org/pub/languages/R/CRAN/src/contrib
Warning: unable to access index for repository 
http://www.stats.ox.ac.uk/pub/RWin/src/contrib
Warning in download.packages(unique(pkgs), destdir = tmpd, available = 
available,  : 
 no package 'RMySQL' at the repositories

  Thanks!

 
-
Sponsored Link 

Talk more and pay less. Vonage can save you up to $300 a year on your phone 
bill. Sign up now.
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] subsetting a matrix and filling other. Solved

2006-11-07 Thread antonio rodriguez
antonio rodriguez escribió:
> Christos Hatzis escribió:
>> Use a list to store the partial matrices:
>>
>> z <- vector("list", 189)
>> for(i in 1:189)
>> z[[i]] <- subset(...)
>>   
> Hi Christos,
>
> I've tried it but it died unexpectedly with a (Killed) message and the 
> linux console prompt again. I think I have enough memory (512) and a 
> pretty good processor (P4, 2.8)
>
> Antonio
>
Hi Christos,

I apologize for the above. Don't know what happen the first time but 
it's OK now

Thanks!

Antonio


>
>
>> -Christos
>>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of antonio rodriguez
>> Sent: Tuesday, November 07, 2006 2:01 PM
>> To: R-Help
>> Subject: [R] subsetting a matrix and filling other
>>
>> Hi,
>>
>> Having a matrix F(189,6575) I want to do this:
>>
>> z1<-subset(F[,1], F[,1] >= 5 & F[,1] <= 10) .
>> .
>> .
>> z189<-subset(F[,189], F[,189] >= 5 & F[,189] <= 10)
>>
>> I would prefer to have an empty matrix, say 'z' in order to fill its 
>> columns
>> with the output of subsetting F. But each of the subsets can differ in
>> length. It's to say:
>>
>> length(z1)
>> 1189
>>
>> length(z2)
>> 1238
>>
>> Don't know how to set up this with a for loop or the use of apply:
>>
>> z<-189
>> for (i in 1:189)
>> {z[i]<-subset(F.zoo[,i], F.zoo[,i] >= 5 & z1 <= 10)}
>>
>> Error in z[i] <- subset(F.zoo[, i], F.zoo[, i] >= 5 & z1 <= 10) :
>> nothing to replace with
>>
>> or
>>
>> z<-matrix(0,6575,189)
>> for (i in 1:189)
>> {z[i]<-subset(F.zoo[,i], F.zoo[,i] >= 5 & z1 <= 10)}
>>
>> new error
>>
>>
>> Thanks,
>>
>> Antonio
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>>
>>   
>
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] wrong fill colors in polygon-map

2006-11-07 Thread Roger Bivand
On Tue, 7 Nov 2006, Frosch, Katharina wrote:

> Dear Roger: Thank you for your help and the hint with the R-sig-geo list
> (next time I'll post directly to it)!
> 
> I went again through all points you mentioned: 
> - polygons and rows of data are in the same order
> - the number of polygons and data rows is identical
> - I experimented with different values, and also defined explicit
> breakpoints without using the quantile (no effect)
> - then I added all.inside=TRUE in findIntervall (no effect)
> 
> However, adding the forcefill=FALSE option to the plot command led to a
> strange effect: three districts were left blank. Two of these districts
> were districts that are situated around another district (district
> A=city itself, district B=the countryside around). The third problematic
> district is situated close to the Swiss border and next to a big lake. I
> deleted the three districts, to see what happens. The problem is partly
> resolved, but new blank districts appear. 
> 
> Could this be caused by a corrupted shape file rathern than by R? I
> loaded the shape-file with the Program Mapviewer in MIF/MID format,
> unionized some districts, then exported it to an ESRI-shapefile and used
> it in R. 

It is at least worth trying. May I suggest reading the MIF/MID file
directly into R using the readOGR() function in the rgdal package? If you
are a Mac OSX user, there is extra help needed installing rgdal, but on
Windows it is available for binary install directly from CRAN (thanks to
Uwe Ligges). The spatial classes used there are more robust, and the data
and polygons can be kept together. Polygons may also be dissolved using
objects of the SpatialPolygons class.

Could I suggest that you move any reply to R-sig-geo, given that the 
details of spatial data formats are not of general interest?

Roger

> 
> I don't have any clue to resolve this...so any hint is very welcome!
> Katharina
> 
> 
> 
> **
> Katharina Frosch
> Rostocker Zentrum
> Konrad-Zuse-Str. 1
> 18057 Rostock
> Tel.: (0381) 2081-148
> Fax: (0381) 2081-448
> Mail: [EMAIL PROTECTED] 
> 
>  
> 
> 
> -Original Message-
> From: Roger Bivand [mailto:[EMAIL PROTECTED] 
> Sent: Dienstag, 7. November 2006 13:27
> To: Frosch, Katharina
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] wrong fill colors in polygon-map
> 
> On Tue, 7 Nov 2006, Frosch, Katharina wrote:
> 
> > Dear all,
> > 
> > I would like to produce a map with information about the patenting
> > activity in German districts, by coloring districts with different
> > degrees of patenting activity in different colors. I work with the
> > packages maptools, maps and spdep. The map data is read from an
> external
> > .shp file (+ the corresponding .shx and .dbf files). Plotting a map
> with
> > the IDs or the patenting indicator itself works fine. But coloring the
> > map leads to completely odd results (wrong colors for most of the
> > regions). I also tried simpler values (just 0 and 1 for different
> > regions), same problem. I tried to check whether there is any problem
> > with the match of data and district ids, but everything seemed to be
> > fine. 
> > 
> > Sample code: 
> > 
> > brks.pat<-quantile(patenting$patbus)
> > #palette.pat<-c("green", "blue", "grey", "darkgrey", "red")
> > palette.pat<-c(rep("green", 4), "red")
> > plot(iab7.poly, col=palette.pat[findInterval(patenting$patbus,
> > brks.pat)])
> > legend(1200, -200, fill=palette.pat, legend=round(brks.pat,2),
> cex=0.6)
> > title(main="patenting activity in german districts")
> > 
> > Data:
> > **
> > Iab7.poly contains the polygons of 343 German districts
> > patenting$patbus contains the number of corporate patents per 100.000
> > inhabitants for each district
> 
> (R-sig-geo may be a more focussed list for this kind of question)
> 
> If the polygons in Iab7.poly are in the same order as the rows of
> patenting, and the number of polygons is the same as the number of rows,
> it is possible that the breakpoints are not quite what you think (if for
> example some of the quantiles are equal, which happens with
> zero-inflated
> data). Omitting all.inside=TRUE in findInterval() can also lead to the
> insertion of NA values into the vector of colours.
> 
> Perhaps have a look at the classInt package for some examples of
> choosing 
> class intervals i.a. for map display.
> 
> Roger
> 
> > 
> > Any ideas would be appreciated!
> > 
> > Best regards,
> > Katharina
> > 
> > 
> > 
> > **
> > 
> > Katharina Frosch
> > Rostock Center for the Study of Demographic Change
> > Konrad-Zuse-Str. 1
> > 18057 Rostock
> > Tel.: (0381) 2081-148
> > Fax: (0381) 2081-448
> > Mail: [EMAIL PROTECTED] 
> > 
> > 
> > 
> > 
> > 
> > 
> > --
> > This mail has been sent through the MPI for Demographic
> Rese...{{dropped}}
> > 
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-hel

[R] installing packages without being a root?

2006-11-07 Thread ahmet rasit
Hi,
I have a problem with installing packages without being a superuser(root) in 
Linux(Suse 10.0 64bit). I've read the entire FAQ and R-admin but I couldn't 
find a solution to my problem. I'm the admin of the computer but I want other 
users to install whatever packages they want. Do you think that I have a 
problem with user priviliges / directory accessin permissions?
Thanks,
[EMAIL PROTECTED]




[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] December Courses: (1) R/Splus Fundamentals and Programming Techniques (2) Regression Modeling Strategies in R/Splus

2006-11-07 Thread Sue Turner

XLSolutions Corporation (www.xlsolutions-corp.com) is proud to announce
November - December courses: 

(1) R/Splus Fundamentals and Programming Techniques  
   
  http://www.xlsolutions-corp.com/Rfund.htm 
  
*** San Francisco / December 14-15, 2006 *** 
*** Boston / December 18-19, 2006 ***
*** Seattle / December 18-19, 2006 ***

(2) Regression Modeling Strategies in R/Splus --- by Prof Frank Harrell 
  
http://www.xlsolutions-corp.com/Rstats2.htm 
   
*** Seattle, December 7-8, 2006 *** 
  
(3) R/Splus Advanced Programming  --- by the R Development Core Team
Guru! 
  
   http://www.xlsolutions-corp.com/Radv.htm 
  
 *** Seattle / December - 2006  DTB*** 



  
Ask for group discount and reserve your seat Now - Earlybird Rates 
Payment due after the class! Email Sue Turner:  [EMAIL PROTECTED]

  
Email us for group discounts: [EMAIL PROTECTED]
Phone:  206 686 1578 
  
Visit us: www.xlsolutions-corp.com/training.htm 
  
Please let us know if you and your colleagues are interested in this
class to take advantage of group discount. Register now to secure your
seat! 
  
Cheers, 
  
Elvis Miller, PhD 
Manager Training 
XLSolutions Corporation 
206 686 1578 
www.xlsolutions-corp.com/training.htm 
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] subsetting a matrix and filling other

2006-11-07 Thread antonio rodriguez
Christos Hatzis escribió:
> Use a list to store the partial matrices:
>
> z <- vector("list", 189) 
>
> for(i in 1:189)
>   z[[i]] <- subset(...)
>   
Hi Christos,

I've tried it but it died unexpectedly with a (Killed) message and the 
linux console prompt again. I think I have enough memory (512) and a 
pretty good processor (P4, 2.8)

Antonio



> -Christos
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of antonio rodriguez
> Sent: Tuesday, November 07, 2006 2:01 PM
> To: R-Help
> Subject: [R] subsetting a matrix and filling other
>
> Hi,
>
> Having a matrix F(189,6575) I want to do this:
>
> z1<-subset(F[,1], F[,1] >= 5 & F[,1] <= 10) .
> .
> .
> z189<-subset(F[,189], F[,189] >= 5 & F[,189] <= 10)
>
> I would prefer to have an empty matrix, say 'z' in order to fill its columns
> with the output of subsetting F. But each of the subsets can differ in
> length. It's to say:
>
> length(z1)
> 1189
>
> length(z2)
> 1238
>
> Don't know how to set up this with a for loop or the use of apply:
>
> z<-189
> for (i in 1:189)
> {z[i]<-subset(F.zoo[,i], F.zoo[,i] >= 5 & z1 <= 10)}
>
> Error in z[i] <- subset(F.zoo[, i], F.zoo[, i] >= 5 & z1 <= 10) :
> nothing to replace with
>
> or
>
> z<-matrix(0,6575,189)
> for (i in 1:189)
> {z[i]<-subset(F.zoo[,i], F.zoo[,i] >= 5 & z1 <= 10)}
>
> new error
>
>
> Thanks,
>
> Antonio
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] CPU or memory

2006-11-07 Thread John C Frain
*Can I extend Taka's question?*
**
*Many of my programs in (mainly simulations in R which are cpu bound) on a
year old PC ( Intel(R) Pentium(R) M processor 1.73GHz or Dell GX380
with 2.8Gh Pentium) are taking hours and perhaps days to complete on a
one year old
PC.  I am looking at an upgrade but the variety of cpu's available is
confusing at least.   Does any one know of comparisons of the Pentium
9x0, Pentium(r)
Extreme/Core 2 Duo,   AMD(r) Athlon(r) 64 , AMD(r) Athlon(r) 64
FX/Dual Core AM2 and
similar chips when used for this kind of work.  Does anyone have any advice
on (1)  the use of a single core or dual core cpu or (2) on the use of 32
bit and 64 bit cpu.  This question is now much more difficult as the numbers
on the various chips do not necessarily refer to the relative speed of the
chips.
*
*John

* On 06/11/06, Taka Matzmoto <[EMAIL PROTECTED]> wrote:

> Hi R users
>
> Having both a faster CPU and more memory will boost computing power. I was
> wondering if only adding more memory (1GB -> 2GB)  will significantly
> reduce
> R computation time?
>
> Taka,
>
> _
> Get FREE company branded e-mail accounts and business Web site from
> Microsoft Office Live
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Date, date, POSIX question

2006-11-07 Thread Joe Byers
Martin,

Thank you for your comments.

Joe


Martin Maechler wrote:
>> "Joe" == Joe Byers <[EMAIL PROTECTED]>
>> on Sun, 05 Nov 2006 08:23:46 -0600 writes:
>> 
>
> Joe> Gabor, Thank you very much.  That is a wonderful
> Joe> article and will help very much.  Might I ask which
> Joe> date schema do you prefer?
>
> The only scheme that is part of "standard R" is the "POSIX"
> based one which (conceptually) *includes* the "Date" class.
> Use the "Date" class [i.e. first use  as.Date() ] unless you
> need times in addition to dates, where I'd recommend you
> consider 'POSIX' ...
>
> BTW: there is no 'Date' package [at least not in an official
>  place] as you claim below.
>   
This is correct, my miss-statement and oversight.
> Martin
>
> Joe> Thank you Joe
>
>
> Joe> Gabor Grothendieck wrote:
> >> See the help desk article in R News 4/1 for a discussion
> >> on how to choose.
> >> 
> >> On 11/5/06, Joe W. Byers <[EMAIL PROTECTED]> wrote:
> >>> I have been working with R extensively for several
> >>> months.  I switched from SAS and Matlab to R.  My
> >>> question is
> >>> 
> >>> Can anyone explain the benefits and detractions of the
> >>> 'Date' package verses the 'date' package and verses
> >>> 'POSIX' dates.
> >>> 
> >>> I have noticed several other packages use one or the
> >>> other.  Rmetrics seems to standardize on POSIX.  I can
> >>> only see differences in default formats, and the
> >>> starting counting number be it 1 1 1900 or something
> >>> else.
> >>> 
> >>> I am trying to standardize code that I write for
> >>> research and to provide to my students on one date
> >>> schema.  The documentation is very good on using a
> >>> specific package, but I can not tell the which one
> >>> provides the broadest coverage across R packages or is
> >>> just the better one to use.
> >>> 
> >>> I know all of you have more experience with some of
> >>> these and I am just soliciting your opinions and
> >>> comments.
> >>> 
> >>> Thank you Joe
> >>> 
> >>> __
> >>> R-help@stat.math.ethz.ch mailing list
> >>> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
> >>> read the posting guide
> >>> http://www.R-project.org/posting-guide.html and provide
> >>> commented, minimal, self-contained, reproducible code.
> >>> 
> Joe> __
> Joe> R-help@stat.math.ethz.ch mailing list
> Joe> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
> Joe> read the posting guide
> Joe> http://www.R-project.org/posting-guide.html and provide
> Joe> commented, minimal, self-contained, reproducible code.
>   

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] subsetting a matrix and filling other

2006-11-07 Thread Christos Hatzis
Use a list to store the partial matrices:

z <- vector("list", 189) 

for(i in 1:189)
z[[i]] <- subset(...)

-Christos

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of antonio rodriguez
Sent: Tuesday, November 07, 2006 2:01 PM
To: R-Help
Subject: [R] subsetting a matrix and filling other

Hi,

Having a matrix F(189,6575) I want to do this:

z1<-subset(F[,1], F[,1] >= 5 & F[,1] <= 10) .
.
.
z189<-subset(F[,189], F[,189] >= 5 & F[,189] <= 10)

I would prefer to have an empty matrix, say 'z' in order to fill its columns
with the output of subsetting F. But each of the subsets can differ in
length. It's to say:

length(z1)
1189

length(z2)
1238

Don't know how to set up this with a for loop or the use of apply:

z<-189
for (i in 1:189)
{z[i]<-subset(F.zoo[,i], F.zoo[,i] >= 5 & z1 <= 10)}

Error in z[i] <- subset(F.zoo[, i], F.zoo[, i] >= 5 & z1 <= 10) :
nothing to replace with

or

z<-matrix(0,6575,189)
for (i in 1:189)
{z[i]<-subset(F.zoo[,i], F.zoo[,i] >= 5 & z1 <= 10)}

new error


Thanks,

Antonio

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] subsetting a matrix and filling other

2006-11-07 Thread antonio rodriguez
Hi,

Having a matrix F(189,6575) I want to do this:

z1<-subset(F[,1], F[,1] >= 5 & F[,1] <= 10)
.
.
.
z189<-subset(F[,189], F[,189] >= 5 & F[,189] <= 10)

I would prefer to have an empty matrix, say 'z' in order to fill its 
columns with the output of subsetting F. But each of the subsets can 
differ in length. It's to say:

length(z1)
1189

length(z2)
1238

Don't know how to set up this with a for loop or the use of apply:

z<-189
for (i in 1:189)
{z[i]<-subset(F.zoo[,i], F.zoo[,i] >= 5 & z1 <= 10)}

Error in z[i] <- subset(F.zoo[, i], F.zoo[, i] >= 5 & z1 <= 10) :
nothing to replace with

or

z<-matrix(0,6575,189)
for (i in 1:189)
{z[i]<-subset(F.zoo[,i], F.zoo[,i] >= 5 & z1 <= 10)}

new error


Thanks,

Antonio

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Comparison between GARCH and ARMA

2006-11-07 Thread Wensui Liu
Mark,

I totally agree that it doesn't make sense to compare arma with garch.

but to some extent, garch can be considered arma for conditional
variance. similarly, arch can be considered ma for conditional
variance.

the above is just my understanding, which might not be correct.

thanks.

On 11/7/06, Leeds, Mark (IED) <[EMAIL PROTECTED]> wrote:
> Hi : I'm a R novice but I consider myself reasonably versed in time
> series related material and
> I have never heard of an equivalence between Garch(1,1) for volatility
> and an ARMA(1,1) in the squared returns
> and I'm almost sure there isn't.
>
> There are various problems with what you wrote.
>
> 1) r(t) = h(t)*z(t) not h(i) but that's not a big deal.
>
> 2) you can't write the equation in terms of r(t) because r(t) =
> h(t)*z(t) and h(t) is UPDATED FIRST
> And then the relation r(t) = h(t)*z(t) is true ( in the sense of the
> model ). So, r(t) is
> a function of z(t) , a random variable, so trying to use r(t) on the
> left hand side of the volatility
> equation doesn't make sense at all.
>
> 3) even if your equation was valid, what you wrote is not an ARMA(1,1).
> The AR term is there but the MA term
> ( the beta term ) Has an r_t-1 terms in it when r_t-1 is on the left
> side. An MA term in an ARMA framework
> multiples lagged noise terms not the lag of what's on the left side.
> That's what the AR term does.
>
> 4) even if your equation was correct in terms of it being a true
> ARMA(1,1) , you
> Have common coefficients on The AR term and MA term ( beta ) so you
> would need contraints to tell the
> Model that this was the same term in both places.
>
> 5) basically, you can't do what you
> Are trying to do so you shouldn't expect to any consistency in estimates
> Of the intercept for the reasons stated above.
> why are you trying to transform in such a way anyway ?
>
> Now back to your original garch(1,1) model
>
> 6) a garch(1,1) has a stationarity condition that alpha + beta is less
> than 1
> So this has to be satisfied when you estimate a garch(1,1).
>
> It looks like this condition is satisfied so you should be okay there.
>
> 7) also, if you are really assuming/believe that the returns have mean
> zero to begin with,  without subtraction,
> Then you shouldn't be subtracting the mean before you estimate
> Because eseentially you will be subtracting noise and throwing out
> useful
> Information that could used in estimating the garch(1,1) parameters.
> Maybe you aren't assuming that the mean is zero and you are making the
> mean zero which is fine.
>
> I hope this helps you. I don't mean to be rude but I am just trying to
> get across that what you
> Are doing is not valid. If you saw the equivalence somewhere in the
> literature,
> Let me know because I would be interested in looking at it.
>
>
> mark
>
>
>
>
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Megh Dal
> Sent: Tuesday, November 07, 2006 2:24 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Comparison between GARCH and ARMA
>
> Dear all R user,
>
> Please forgive me if my problem is too simple.
> Actually my problem is basically Statistical rather directly R related.
> Suppose I have return series ret
> with mean zero. And I want to fit a Garch(1,1)
> on this.
>
> my   is r[t] = h[i]*z[t]
>
> h[t] = w + alpha*r[t-1]^2 + beta*h[t-1]
>
> I want to estimate the three parameters here;
>
> the R syntax is as follows:
>
> # download data:
> data(EuStockMarkets)
> r <- diff(log(EuStockMarkets))[,"DAX"]
> r = r - mean(r)
>
> # fit a garch(1,1) on this:
> library(tseries)
> garch(r)
>
> The estimated parameters are given below:
>
>  * ESTIMATION WITH ANALYTICAL GRADIENT *
>
>
>
> Call:
> garch(x = r)
>
> Coefficient(s):
>a0 a1 b1
> 4.746e-06  6.837e-02  8.877e-01
>
> Now it is straightforward to transform Garch(1,1)
>  to a ARMA   like this:
>
> r[t]^2 = w + (alpha+beta)*r[t-1]^2 + beta*(h[t-1] -
> r[t-1]^2) - (h[t] - r[t]^2)
>= w + (alpha+beta)*r[t-1]^2 + beta*theta[t-1] + theta[t]
>
> So if I fit a ARMA(1,1) on r[t]^2 I am getting following result;
>
> arma(r^2, order=c(1,1))
>
> Call:
> arma(x = r^2, order = c(1, 1))
>
> Coefficient(s):
>ar1 ma1   intercept
>  9.157e-01  -8.398e-01   9.033e-06
>
> Therefore if the above derivation is correct then I should get a same
> intercept term for both Garch and ARMA case. But here I am not getting
> it. Can anyone explain why?
>
> Any input will be highly appreciated.
>
> Thanks and regards,
> Megh
>
>
>
>
>
> 
> 
> Sponsored Link
>
> Degrees online in as fast as 1 Yr - MBA, Bachelor's, Master's, Associate
> Click now to apply http://yahoo.degrees.info
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project

Re: [R] Date, date, POSIX question

2006-11-07 Thread Martin Maechler
> "Joe" == Joe Byers <[EMAIL PROTECTED]>
> on Sun, 05 Nov 2006 08:23:46 -0600 writes:

Joe> Gabor, Thank you very much.  That is a wonderful
Joe> article and will help very much.  Might I ask which
Joe> date schema do you prefer?

The only scheme that is part of "standard R" is the "POSIX"
based one which (conceptually) *includes* the "Date" class.
Use the "Date" class [i.e. first use  as.Date() ] unless you
need times in addition to dates, where I'd recommend you
consider 'POSIX' ...

BTW: there is no 'Date' package [at least not in an official
 place] as you claim below.

Martin

Joe> Thank you Joe


Joe> Gabor Grothendieck wrote:
>> See the help desk article in R News 4/1 for a discussion
>> on how to choose.
>> 
>> On 11/5/06, Joe W. Byers <[EMAIL PROTECTED]> wrote:
>>> I have been working with R extensively for several
>>> months.  I switched from SAS and Matlab to R.  My
>>> question is
>>> 
>>> Can anyone explain the benefits and detractions of the
>>> 'Date' package verses the 'date' package and verses
>>> 'POSIX' dates.
>>> 
>>> I have noticed several other packages use one or the
>>> other.  Rmetrics seems to standardize on POSIX.  I can
>>> only see differences in default formats, and the
>>> starting counting number be it 1 1 1900 or something
>>> else.
>>> 
>>> I am trying to standardize code that I write for
>>> research and to provide to my students on one date
>>> schema.  The documentation is very good on using a
>>> specific package, but I can not tell the which one
>>> provides the broadest coverage across R packages or is
>>> just the better one to use.
>>> 
>>> I know all of you have more experience with some of
>>> these and I am just soliciting your opinions and
>>> comments.
>>> 
>>> Thank you Joe
>>> 
>>> __
>>> R-help@stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
>>> read the posting guide
>>> http://www.R-project.org/posting-guide.html and provide
>>> commented, minimal, self-contained, reproducible code.
>>> 
Joe> __
Joe> R-help@stat.math.ethz.ch mailing list
Joe> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
Joe> read the posting guide
Joe> http://www.R-project.org/posting-guide.html and provide
Joe> commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] snow's makeCluster hanging (using Rmpi)

2006-11-07 Thread Randall C Johnson [Contr.]

On 11/7/06 11:28 AM, "Ramon Diaz-Uriarte" <[EMAIL PROTECTED]> wrote:

> On Tuesday 07 November 2006 15:56, Randall C Johnson [Contr.] wrote:
>> Hello everyone,
>> I've been fiddling around with the snow and Rmpi packages on my new Intel
>> Mac, and have run into a few problems. When I make a cluster on my machine,
>> both slaves start up just fine, and everything works as expected. When I
>> try to make a cluster including another networked machine it hangs. I've
>> followed the suggestions at
>> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/83086.html and
>> http://www.stat.uiowa.edu/~luke/R/cluster/cluster.html but to no avail.
>> Everything seems to start up fine using lamboot, but then hangs when making
>> the cluster in R. Making a cluster with 2 slaves seems to work fine, but if
>> I increase the number (to use the networked machines) it hangs again.
>> 
>> I've tried networking to another Mac, and also to a machine running Red Hat
>> Linux. Both machines can set up their own local clusters. Does anyone have
>> any ideas?
> 
> Dear Randy,
> 
> A few suggestions:
> 
> a) make sure there are no firewalls; I assume this is actually the case, but
> anyway;

I don't think I have any firewalls running. I checked and they all seem to
be disabled...
 
> b) what happens if you lamboot outside R (and create a universe with a local
> and a networked machine) and then you do: "lamexec -np 6 hostname"?

This prints out the host names of each machine as expected.
 
> c) are the Rmpi and snow installed in the same directories in the different
> machines? are there version differences in Rmpi (or Snow) between machines?

I've installed the same versions, but they are in different directories...

I also tried an example per Luke Tierney's suggestion using only Rmpi, and I
get the following error when trying to spawn the Rslaves after starting up
with lamboot (outside of R). I tried to use laminfo, but I'm not sure what
I'm looking for or how to use the information given...

> library(Rmpi)
> mpi.spawn.Rslaves()


It seems that [at least] one of the child processes that was started
by MPI_Comm_spawn* chose a different RPI than the parent MPI
application.  For example, one (of the) child process(es) that
differed from the parent is shown below:

Parent application: MPI_Comm_spawn
Child MPI_COMM_WORLD rank usysv (v7.1.0): 0

All MPI processes must choose the same RPI module and version when
they start.  Check your SSI settings and/or the local environment
variables on each node.

R(26444) malloc: ***  Deallocation of a pointer not malloced: 0x16379a0;
This could be a double free(), or free() called with the middle of an
allocated block; Try setting environment variable MallocHelp to see tools to
help debug
Error in mpi.comm.spawn(slave = system.file("Rslaves.sh", package = "Rmpi"),
: 
MPI_Error_string: unclassified

 
> 
> HTH,
> 
> R.
> 
> 
> 
>> 
>> Thanks,
>> Randy
>> 
>>> sessionInfo()
>> 
>> R version 2.4.0 Patched (2006-10-03 r39576)
>> i386-apple-darwin8.8.2
>> 
>> locale:
>> C
>> 
>> attached base packages:
>> [1] "methods"   "stats" "graphics"  "grDevices" "utils" "datasets"
>> [7] "base"
>> 
>> other attached packages:
>>Rmpisnow
>> "0.5-3" "0.2-2"
>> 
>>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] stacking the data elements in the list

2006-11-07 Thread Im, Kelly
Hello, 

I have a (rather simple) data manipulation question.. I have a list with
many datasets within, each dataset has observations in a format which
looks like

id x1 x2 x3 x4 x5 x6 y1 y2 y3 y4 y5 y6

how can I stack them so that it'll be 

id x1 x2 x3 x4 x5 x6
id y1 y2 y3 y4 y5 y6

for each patient,

I would very much appreciate your help,

thanks so much

kelly

-
KyungAh (Kelly)  Im   
Epidemiology Data Center
Graduate School of Public Health
Department of Epidemiology
University of Pittsburgh
PA 15261
PHONE:(412) 624- 4612 FAX: (412) 624- 3775
Email: [EMAIL PROTECTED]
http://www.edc.gsph.pitt.edu

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help on processing an in-house apps timer file

2006-11-07 Thread Bin Chen
Hi,

Our in-house AS400 based application produce a timer file as follows:

TranName,Date Time, TimeA,A+B, TimeB
MAC00029,20061027 112500.030,703,703,0
MAC00029,20061027 112500.342,703,719,16
MAC00056,20061027 112500.920,484,500,16
MAC00029,20061027 112501.186,812,812,0
MAC00029,20061027 112502.092,672,672,0
MAC00029,20061027 112502.264,687,687,0
MAC00056,20061027 112503.264,453,453,0
MAC00029,20061027 112502.920,1000,1000,0
MAC00029,20061027 112502.967,937,953,16
MAC00062,20061027 112503.592,515,515,0
MAC00054,20061027 112503.873,1047,1078,31
MAC00029,20061027 112503.857,1094,1110,16
MAC00029,20061027 112504.029,1094,1094,0
MAC00029,20061027 112504.029,1297,1313,16
MAC00029,20061027 112504.373,969,969,0
MAC00056,20061027 112505.373,453,453,0
MAC00029,20061027 112504.670,1219,1219,0
MAC00029,20061027 112505.061,968,968,0
MAC00029,20061027 112504.873,1297,1312,15
MAC00029,20061027 112505.029,1141,1156,15
MAC00029,20061027 112505.342,843,843,0
MAC00029,20061027 112505.560,844,844,0
MAC00029,20061027 112505.701,891,891,0
MAC00029,20061027 112505.623,969,969,0
MAC00029,20061027 112506.076,1016,1016,0
MAC00029,20061027 112506.185,907,907,0
MAC00056,20061027 112506.404,844,859,15
MAC00029,20061027 112506.232,1110,1125,15
MAC00029,20061027 112506.310,1032,1047,15
MAC00029,20061027 112506.701,703,703,0
MAC00029,20061027 112506.107,1391,1391,0
MAC00029,20061027 112506.264,1234,1234,0
MAC00029,20061027 112506.514,984,984,0
MAC00056,20061027 112506.904,750,766,16
MAC00045,20061027 112507.420,359,359,0
MAC00029,20061027 112506.810,1032,1032,0
MAC00029,20061027 112507.154,688,688,0

How do I user R to sort out by Transaction name, then average the TimeA and 
TimeB over 30 seconds
interval?

I have just started to lear R, but this task seems to be hard to me, so I would 
like to know if
this is possible at all. Thanks a lot for your help.





 

Sponsored Link

Degrees online in as fast as 1 Yr - MBA, Bachelor's, Master's, Associate
Click now to apply http://yahoo.degrees.info

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Nemenyi test for two way layout data.

2006-11-07 Thread Oscar Camilo Ortiz Ortega
I am trying to do a Nonparametric Nemenyi test for multiple comparison in a two 
way layout data because I need to know the exact distribution. I don´t know if 
this test is in the R software. I just found a Nemenyi test for a one way 
design. But in Hollander book the Nemenyi test is in page 253 for to way layout 
data. 
Thank you for your help.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] snow's makeCluster hanging (using Rmpi)

2006-11-07 Thread Luke Tierney
The most likely culprit is firewall settings. Something like tcpdump
may help to confirm that.  Working with a stand-alone example from
Rmpi may also help.

Best,

luke

On Tue, 7 Nov 2006, Randall C Johnson [Contr.] wrote:

> Hello everyone,
> I've been fiddling around with the snow and Rmpi packages on my new Intel
> Mac, and have run into a few problems. When I make a cluster on my machine,
> both slaves start up just fine, and everything works as expected. When I try
> to make a cluster including another networked machine it hangs. I've
> followed the suggestions at
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/83086.html and
> http://www.stat.uiowa.edu/~luke/R/cluster/cluster.html but to no avail.
> Everything seems to start up fine using lamboot, but then hangs when making
> the cluster in R. Making a cluster with 2 slaves seems to work fine, but if
> I increase the number (to use the networked machines) it hangs again.
>
> I've tried networking to another Mac, and also to a machine running Red Hat
> Linux. Both machines can set up their own local clusters. Does anyone have
> any ideas?
>
> Thanks,
> Randy
>
>> sessionInfo()
> R version 2.4.0 Patched (2006-10-03 r39576)
> i386-apple-darwin8.8.2
>
> locale:
> C
>
> attached base packages:
> [1] "methods"   "stats" "graphics"  "grDevices" "utils" "datasets"
> [7] "base"
>
> other attached packages:
>   Rmpisnow
> "0.5-3" "0.2-2"
>
>
> ~~
> Randall C Johnson
> Bioinformatics Analyst
> SAIC-Frederick, Inc (Contractor)
> Laboratory of Genomic Diversity
> NCI-Frederick, P.O. Box B
> Bldg 560, Rm 11-85
> Frederick, MD 21702
> Phone: (301) 846-1304
> Fax: (301) 846-1686
> ~~
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Complex plotting problem

2006-11-07 Thread Greg Snow
Others have given some fairly basic solutions, but if you want the lines
to change color along their length instead of each segment being a
constant color, then there are a couple of other options.

One is to create the plot using a solid color, then use image
manipulation software like imagemagick or gimp to replace the solid
color with a gradient.

Another option is to use the clipplot function in the most recent
version of the TeachingDemos Package (just updated on CRAN).

An example would be:

> library(TeachingDemos)
> x <- sort(runif(100))
> y <- rnorm(100)
> plot(x,y,type='b')
>
> tmp <- seq(par('usr')[3],par('usr')[4], length=11)
> tmp2 <- topo.colors(10) # replace with your color gradient
> for(i in 1:10) {
+   clipplot( points(x,y,type='b', col=tmp2[i]), ylim= tmp[ c(i,i+1)
] )
+ }
>

Hope this helps,


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Wee-Jin Goh
Sent: Thursday, November 02, 2006 1:55 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Complex plotting problem

Hello,

I would like to make a plot (preferably lines, but points will do too),
where the line segment changes color depending on the value of the
y-axis. For example, let's suppose the y-axis range is from -1 to 1.
Points close to -1 would be colored blue, while points close to 1 will
be colored red. Points in between will be varying degrees of blue/red
depending on how close they are to -1 or +1.

If the above is not possible, would it be possible to set a decision
boundary on the plot, where any point above this boundary will be a
particular color, and any point below will be a different color?

Any suggestions as to how I might accomplish this would be much
appreciated.

Regards,
Wee-Jin

p.s. The data set I'm talking about has about 20,000 points.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] reading data in extreme toolkit

2006-11-07 Thread amna khan
Sir I am very new user  of R language. I have a problem. I have imported
data on R console and then i used "save workspace" option to save data. Is
it right way to save data. Then to read data in extremes toolkit using saved
workspace I got the following messages

 Package extRemes: For a tutorial and more information go to
http://www.esig.ucar.edu/extremevalues/evtk.html
[1] "Successfully opened file: lahore"
   X...
NNA
mean NA
Std.Dev. NA
min  NA
Q1   NA
median   NA
Q3   NA
max  NA
missing values   NA

 Saving workspace (may take a few moments for large workspaces) ...

 Workspace saved.
 Sir I request you to please guide to me in very simple way.
Thank You
-- 
AMINA SHAHZADI
Department of Statistics
GC University Lahore, Pakistan.
Email:
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] snow's makeCluster hanging (using Rmpi)

2006-11-07 Thread Ramon Diaz-Uriarte
On Tuesday 07 November 2006 15:56, Randall C Johnson [Contr.] wrote:
> Hello everyone,
> I've been fiddling around with the snow and Rmpi packages on my new Intel
> Mac, and have run into a few problems. When I make a cluster on my machine,
> both slaves start up just fine, and everything works as expected. When I
> try to make a cluster including another networked machine it hangs. I've
> followed the suggestions at
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/83086.html and
> http://www.stat.uiowa.edu/~luke/R/cluster/cluster.html but to no avail.
> Everything seems to start up fine using lamboot, but then hangs when making
> the cluster in R. Making a cluster with 2 slaves seems to work fine, but if
> I increase the number (to use the networked machines) it hangs again.
>
> I've tried networking to another Mac, and also to a machine running Red Hat
> Linux. Both machines can set up their own local clusters. Does anyone have
> any ideas?

Dear Randy,

A few suggestions:

a) make sure there are no firewalls; I assume this is actually the case, but 
anyway;

b) what happens if you lamboot outside R (and create a universe with a local 
and a networked machine) and then you do: "lamexec -np 6 hostname"?

c) are the Rmpi and snow installed in the same directories in the different 
machines? are there version differences in Rmpi (or Snow) between machines?


HTH,

R.



>
> Thanks,
> Randy
>
> > sessionInfo()
>
> R version 2.4.0 Patched (2006-10-03 r39576)
> i386-apple-darwin8.8.2
>
> locale:
> C
>
> attached base packages:
> [1] "methods"   "stats" "graphics"  "grDevices" "utils" "datasets"
> [7] "base"
>
> other attached packages:
>Rmpisnow
> "0.5-3" "0.2-2"
>
>
> ~~
> Randall C Johnson
> Bioinformatics Analyst
> SAIC-Frederick, Inc (Contractor)
> Laboratory of Genomic Diversity
> NCI-Frederick, P.O. Box B
> Bldg 560, Rm 11-85
> Frederick, MD 21702
> Phone: (301) 846-1304
> Fax: (301) 846-1686
> ~~
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented, minimal,
> self-contained, reproducible code.

-- 
Ramón Díaz-Uriarte
Bioinformatics 
Centro Nacional de Investigaciones Oncológicas (CNIO)
(Spanish National Cancer Center)
Melchor Fernández Almagro, 3
28029 Madrid (Spain)
Fax: +-34-91-224-6972
Phone: +-34-91-224-6900

http://ligarto.org/rdiaz
PGP KeyID: 0xE89B3462
(http://ligarto.org/rdiaz/0xE89B3462.asc)



**NOTA DE CONFIDENCIALIDAD** Este correo electrónico, y en s...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Using Teststatistics (F-Test, T.Test, Wilcox test) and recommended graph

2006-11-07 Thread Benjamin Dickgiesser

Hi

it would be nice if someone could tell me if I used the tests
correctly in the following code. I am trying to create a 2-tailed
i) F test for equality of variances
ii) t-test for equality of means
iii) Wilcoxon test for equality of means

data.ceramic <- read.table("ceramic.dat",header=TRUE)
ftest <- var.test(data.ceramic[ data.ceramic$Batch == "1",
]$Y,data.ceramic[ data.ceramic$Batch == "2", ]$Y)
ttest <- t.test(data.ceramic[ data.ceramic$Batch == "1",
]$Y,data.ceramic[ data.ceramic$Batch == "2", ]$Y,var.equal=TRUE)
wtest <- wilcox.test(data.ceramic[ data.ceramic$Batch == "1",
]$Y,data.ceramic[ data.ceramic$Batch == "2", ]$Y)
print(data.frame(Statistic=c(ftest$statistic,ttest$statistic,wtest$statistic),P=c(ftest$p.value,ttest$p.value,wtest$p.value),row.names=c("Equal
Variances", "Equal Means","Nonparametric")))

The data comes in this format:
   Run Lab Batch   Y
1 1   1 1 608.781
2 2   1 2 569.670
3 3   1 1 689.556
4 4   1 2 747.541
5 5   1 1 618.134
6 6   1 2 612.182
7 7   1 1 680.203
8 8   1 2 607.766
9 9   1 1 726.232
10   10   1 2 605.380

and I am comparing the two Batches ignoring any potential differences
between laboratories.

The output my code produces is:

  StatisticP
Equal Variances 1.123038 3.703829e-01
Equal Means13.380581 6.618687e-35
Nonparametric   47635.50 0.00e+00


I would also appreciate it very much if someone could recommend me a
type of graph to illustrate the results from the tests. At the moment
I am simply using a boxplot for each batch.
boxplot(Y ~ Batch, data = data.ceramic, horizontal = TRUE,
names=c("Batch1","Batch2"),xlab="Y")

Thank you again!
Benjamin
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] wrong fill colors in polygon-map

2006-11-07 Thread Frosch, Katharina
Dear Roger: Thank you for your help and the hint with the R-sig-geo list
(next time I'll post directly to it)!

I went again through all points you mentioned: 
- polygons and rows of data are in the same order
- the number of polygons and data rows is identical
- I experimented with different values, and also defined explicit
breakpoints without using the quantile (no effect)
- then I added all.inside=TRUE in findIntervall (no effect)

However, adding the forcefill=FALSE option to the plot command led to a
strange effect: three districts were left blank. Two of these districts
were districts that are situated around another district (district
A=city itself, district B=the countryside around). The third problematic
district is situated close to the Swiss border and next to a big lake. I
deleted the three districts, to see what happens. The problem is partly
resolved, but new blank districts appear. 

Could this be caused by a corrupted shape file rathern than by R? I
loaded the shape-file with the Program Mapviewer in MIF/MID format,
unionized some districts, then exported it to an ESRI-shapefile and used
it in R. 

I don't have any clue to resolve this...so any hint is very welcome!
Katharina



**
Katharina Frosch
Rostocker Zentrum
Konrad-Zuse-Str. 1
18057 Rostock
Tel.: (0381) 2081-148
Fax: (0381) 2081-448
Mail: [EMAIL PROTECTED] 

 


-Original Message-
From: Roger Bivand [mailto:[EMAIL PROTECTED] 
Sent: Dienstag, 7. November 2006 13:27
To: Frosch, Katharina
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] wrong fill colors in polygon-map

On Tue, 7 Nov 2006, Frosch, Katharina wrote:

> Dear all,
> 
> I would like to produce a map with information about the patenting
> activity in German districts, by coloring districts with different
> degrees of patenting activity in different colors. I work with the
> packages maptools, maps and spdep. The map data is read from an
external
> .shp file (+ the corresponding .shx and .dbf files). Plotting a map
with
> the IDs or the patenting indicator itself works fine. But coloring the
> map leads to completely odd results (wrong colors for most of the
> regions). I also tried simpler values (just 0 and 1 for different
> regions), same problem. I tried to check whether there is any problem
> with the match of data and district ids, but everything seemed to be
> fine. 
> 
> Sample code: 
> 
> brks.pat<-quantile(patenting$patbus)
> #palette.pat<-c("green", "blue", "grey", "darkgrey", "red")
> palette.pat<-c(rep("green", 4), "red")
> plot(iab7.poly, col=palette.pat[findInterval(patenting$patbus,
> brks.pat)])
> legend(1200, -200, fill=palette.pat, legend=round(brks.pat,2),
cex=0.6)
> title(main="patenting activity in german districts")
> 
> Data:
> **
> Iab7.poly contains the polygons of 343 German districts
> patenting$patbus contains the number of corporate patents per 100.000
> inhabitants for each district

(R-sig-geo may be a more focussed list for this kind of question)

If the polygons in Iab7.poly are in the same order as the rows of
patenting, and the number of polygons is the same as the number of rows,
it is possible that the breakpoints are not quite what you think (if for
example some of the quantiles are equal, which happens with
zero-inflated
data). Omitting all.inside=TRUE in findInterval() can also lead to the
insertion of NA values into the vector of colours.

Perhaps have a look at the classInt package for some examples of
choosing 
class intervals i.a. for map display.

Roger

> 
> Any ideas would be appreciated!
> 
> Best regards,
> Katharina
> 
> 
> 
> **
> 
> Katharina Frosch
> Rostock Center for the Study of Demographic Change
> Konrad-Zuse-Str. 1
> 18057 Rostock
> Tel.: (0381) 2081-148
> Fax: (0381) 2081-448
> Mail: [EMAIL PROTECTED] 
> 
> 
> 
> 
> 
> 
> --
> This mail has been sent through the MPI for Demographic
Rese...{{dropped}}
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]


--
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] help

2006-11-07 Thread liu, jcheng
hi, experts

i do additive models analysis by mgcv. i want to extract every
smoothing componets from the gam object. how can i do ?
Thanks!

-- 

Sincerely yours,

Liu, jcheng

Department of Biomedical Engineering,

School of Medicine, Tsinghua University,

Beijing, 100084, China.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] OBS in Column 1

2006-11-07 Thread Chuck Cleland
Thorsten Muehge wrote:
> Hello R Freaks,

  I think it's been a few years since we were last referred to as freaks
(http://finzi.psych.upenn.edu/R/Rhelp02a/archive/4433.html).

> is there a way to omit the counts in the first column of a data.frame.

  I'm not sure what you mean, but does this help?

> df <- as.data.frame(matrix(rpois(110, 5), ncol=10))

> df
   V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
1   5  3  6  3  4  6  6  5  5   8
2   3  7  7  2  5  2  4  8  2   4
3   4  5  3 10  5  9  4  7  8   3
4   7  5  4  4  3  1  1  3  3   6
5   5  4  4  5  5  4  4  6  6   7
6   2  8  5  6  7  3  6  4  3   4
7   2  6  3  4  6  6  4  7  1   3
8   7  1  5  2  5  4  6  5  3   9
9   4  6  4  5  4  7  5  6  6   5
10  6  2  5  3  2  4  5  5  4   6
11  2  1  8  3  5  4  2  4  4   9

> df[,-1]
   V2 V3 V4 V5 V6 V7 V8 V9 V10
1   3  6  3  4  6  6  5  5   8
2   7  7  2  5  2  4  8  2   4
3   5  3 10  5  9  4  7  8   3
4   5  4  4  3  1  1  3  3   6
5   4  4  5  5  4  4  6  6   7
6   8  5  6  7  3  6  4  3   4
7   6  3  4  6  6  4  7  1   3
8   1  5  2  5  4  6  5  3   9
9   6  4  5  4  7  5  6  6   5
10  2  5  3  2  4  5  5  4   6
11  1  8  3  5  4  2  4  4   9

> rowSums(df[,-1])
 1  2  3  4  5  6  7  8  9 10 11
46 41 54 30 45 46 40 40 48 36 40

> Thanks a lot for your help
> Thorsten
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] RE : avoiding a loop: "cumsum-like"

2006-11-07 Thread GOUACHE David
Thanks Petr for taking a stab at it.
I have yet to figure out a way to do it, but if I do I'll post it.
Cheers

David

-Message d'origine-
De : Petr Pikal [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 3 novembre 2006 09:05
À : GOUACHE David; r-help@stat.math.ethz.ch
Objet : Re: [R] avoiding a loop: "cumsum-like"

Hi

I have not seen any answer yet so I wil try (partly).

I believe that the loop can be vectorised but I am a little bit lost 
in your fors and ifs. I found that first part of res is same as 
cumsum(tab$x.jour) until about 81st value. However I did not decipher 
how to compute the remaining part. I tried to add 
cumsum(tab$posit.lat) (after changing NA to 0) what is not correct.

Probably some combination of logical operation and summing can do 
what you want. I thought that something like
((cumsum(tab$posit.lat)*0.8)*(cumsum(tab$x.jour)>30)+cumsum(tab$x.jour
))

can do it but the result is defferent from your computation.
Not much of help, but maybe you can do better with above suggestion.

Petr



On 2 Nov 2006 at 11:15, GOUACHE David wrote:

Date sent:  Thu, 2 Nov 2006 11:15:49 +0100
From:   "GOUACHE David" <[EMAIL PROTECTED]>
To: 
Subject:[R] avoiding a loop: "cumsum-like"

> Hello Rhelpers,
> 
> I need to run the following loop over a large number of data-sets, and
> was wondering if it could somehow be vectorized. It's more or less a
> cumulative sum, but slightly more complex. Here's the code, and an
> example dataset (called tab in my code) follows. Thanks in advance for
> any suggestions!
> 
> res<-0
> for (i in min(tab$Date):max(tab$Date))
> {
>  if (is.na(tab$posit.lat[tab$Date==i])==T)
>  {
>   res<-c(res,res[length(res)]+tab$x.jour[tab$Date==i])
>  }
>  else
>  {
>   if (res[tab$posit.lat[tab$Date==i]+1]<30)
>   {
>res<-c(res,res[length(res)]+tab$x.jour[tab$Date==i])
>   }
>   else
>   {
>res<-c(res,res[length(res)]+tab$x.jour[tab$Date==i]+0.8*res[tab$pos
>it.lat[tab$Date==i]+1])
>   }
>  }
> }
> res[-1]
> 
> 
> Date  x.jour  posit.lat
> 35804 0   NA
> 35805 0   NA
> 35806 0   NA
> 35807 0   NA
> 35808 0   NA
> 35809 2.97338883  NA
> 35810 2.796389915 NA
> 35811 0   NA
> 35812 0   NA
> 35813 1.000711886 NA
> 35814 0.894422571 NA
> 35815 0   NA
> 35816 0   NA
> 35817 0   NA
> 35818 0   NA
> 35819 0   NA
> 35820 0   NA
> 35821 0   NA
> 35822 0   NA
> 35823 0   NA
> 35824 0   NA
> 35825 0   NA
> 35826 0   NA
> 35827 0   NA
> 35828 0   NA
> 35829 0   NA
> 35830 0   NA
> 35831 0   NA
> 35832 0   NA
> 35833 0   NA
> 35834 0   NA
> 35835 0   NA
> 35836 0   NA
> 35837 0   NA
> 35838 0   NA
> 35839 0   NA
> 35840 2.47237455  NA
> 35841 0   2
> 35842 0   3
> 35843 0   4
> 35844 0   5
> 35845 0   6
> 35846 0   7
> 35847 4.842160488 8
> 35848 2.432125036 9
> 35849 0   10
> 35850 0   12
> 35851 0   14
> 35852 0   16
> 35853 3.739683882 18
> 35854 1.980214421 20
> 35855 0   22
> 35856 0   24
> 35857 5.953444078 27
> 35858 6.455722475 29
> 35859 0   31
> 35860 3.798690334 32
> 35861 6.222993364 34
> 35862 3.746243098 35
> 35863 0   35
> 35864 0   36
> 35865 0   37
> 35866 0   38
> 35867 0   38
> 35868 0   39
> 35869 0   40
> 35870 0   41
> 35871 0   42
> 35872 0   43
> 35873 0   44
> 35874 0   45
> 35875 0   46
> 35876 0   47
> 35877 1.951774892 48
> 35878 0   49
> 35879 0   50
> 35880 1.702837643 50
> 35881 0   52
> 35882 0   53
> 35883 0   54
> 35884 0   55
> 35885 5.953444078 57
> 35886 0   58
> 35887 5.737515358 59
> 35888 0   61
> 35889 6.215941227 63
> 35890 4.731576675 64
> 35891 0   66
> 35892 2.255448314 66
> 35893 3.782283008 67
> 35894 3.244474546 68
> 35895 1.808553193 69
> 35896 2.622680002 70
> 35897 0   71
> 35898 0   72
> 35899 0   72
> 35900 1.7084177   73
> 35901 1.28455982  74
> 35902 2.320013736 76
> 35903 0   77
> 35904 0   78
> 35905 0   79
> 35906 0   79
> 35907 0   80
> 35908 6.716812458 81
> 35909 0   82
> 35910 6.796571531 84
> 35911 5.573668337 85
> 35912 5.42513958  86
> 35913 3.774513877 86
> 35914 0   87
> 35915 0   89
> 35916 0   90
> 35917 4.208252725 91
> 35918 0   92
> 35919 0   93
> 35920 0   95
> 35921 5.70023661  97
> 35922 0   98
> 35923 0   100
> 35924 0   102
> 35925 0   103
> 35926 0   104
> 
> David Gouache
> Arvalis - Institut du Végétal
> Station de La Miničre
> 78280 Guyancourt
> Tel: 01.30.12.96.22 / Port: 06.86.08.94.32
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting gu

[R] OBS in Column 1

2006-11-07 Thread Thorsten Muehge

Hello R Freaks,

is there a way to omit the counts in the first column of a data.frame.

Thanks a lot for your help
Thorsten

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Extracting parameters for Gamma Distribution

2006-11-07 Thread yongchuan
I'm doing a cox regression with frailty:

model <- coxph(Surv(Start,Stop,Terminated)~ X + frailty(id),table)

I understand that model$frail returns the group level frailty 
terms. Does this mean this is the average of the frailty 
values for the respective groups? Also, if I'm fitting it to
a gamma frailty, how do I extract the rate and scale 
parameters for the different gamma distributions fit to each
group? Thanks.

Yongchuan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] error in format.df when using dec

2006-11-07 Thread Dieter Menne
Rainer M Krug  sun.ac.za> writes:

> 
> When using format.df with dec, the formating does not work (see code 
> below).

 
>  > format.df(x, dec=2)
>a   b   m 1 m 2
> 1 "1.120" "3" "5" "7"
> 2 "2.230" "4" "6" "8"

This is the same bug introduced in the latest version of Hmisc as reported in 

http://article.gmane.org/gmane.comp.lang.r.general/73186


Dieter

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] data frames re-ordering and naming columns

2006-11-07 Thread Jabez Wilson
Dear all, I have read in a table using read.table(). The data frame looks like 
this:
  > my_table
 V1   V2
1 3  320
2 2  230
3 3  300
4 2  220
5 3  320
6 2  210
7  freq size
8 00
9 2  220
102  210
112  220
121  110
132  240
141  110
I then remove the duplicate lines with unique(my_table) and get this:
   V1   V2
1 3  320
2 2  230
3 3  300
4 2  220
6 2  210
7  freq size
8 00
121  110
132  240
I have two questions:
  1. what is the purpose of the numbers on the LHS, and how can I reorder them 
so that they read in ascending order?
  2. how can I extract the line "freq size" and make it the column names?
   
  TIA
  Jab.


-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Better way to create tables of mean & standard deviations

2006-11-07 Thread hadley wickham
> With the reshape package, I'd do it like this:
>
> df <- data.frame(LAB = rep(1:8, each=60), BATCH = rep(c(1,2), 240), Y
> =rnorm(480))
> dfm <- melt(df, measured="Y")

Should be
dfm <- melt(df, measure.var="Y")

(thanks to Chuck for pointing that out)

>
> cast(dfm, LAB  ~ ., c(mean, sd, length))
> cast(dfm, LAB + BATCH ~ ., c(mean, sd, length))
> cast(dfm, LAB + BATCH ~ ., c(mean, sd, length), margins=T)
>
> Regards,
>
> Hadley
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] snow's makeCluster hanging (using Rmpi)

2006-11-07 Thread Randall C Johnson [Contr.]
Hello everyone,
I've been fiddling around with the snow and Rmpi packages on my new Intel
Mac, and have run into a few problems. When I make a cluster on my machine,
both slaves start up just fine, and everything works as expected. When I try
to make a cluster including another networked machine it hangs. I've
followed the suggestions at
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/83086.html and
http://www.stat.uiowa.edu/~luke/R/cluster/cluster.html but to no avail.
Everything seems to start up fine using lamboot, but then hangs when making
the cluster in R. Making a cluster with 2 slaves seems to work fine, but if
I increase the number (to use the networked machines) it hangs again.

I've tried networking to another Mac, and also to a machine running Red Hat
Linux. Both machines can set up their own local clusters. Does anyone have
any ideas?

Thanks,
Randy

> sessionInfo()
R version 2.4.0 Patched (2006-10-03 r39576)
i386-apple-darwin8.8.2

locale:
C

attached base packages:
[1] "methods"   "stats" "graphics"  "grDevices" "utils" "datasets"
[7] "base"

other attached packages:
   Rmpisnow 
"0.5-3" "0.2-2" 


~~
Randall C Johnson
Bioinformatics Analyst
SAIC-Frederick, Inc (Contractor)
Laboratory of Genomic Diversity
NCI-Frederick, P.O. Box B
Bldg 560, Rm 11-85
Frederick, MD 21702
Phone: (301) 846-1304
Fax: (301) 846-1686
~~

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Better way to create tables of mean & standard deviations

2006-11-07 Thread Benjamin Dickgiesser
Thank you, that was exactly what I was looking for.

On 11/7/06, hadley wickham <[EMAIL PROTECTED]> wrote:
> > > I can only think of  rather complex ways to solve the labeling issue...
> > >
> > > I would appreciate it if someone could point out if there are
> > > better/cleaner/easier ways of achieving what I'm trying todo.
> >
> >   Does this help?
> >
> > g <- function(y) {
> >   s <- apply(y, 2,
> >  function(z) {
> >z <- z[!is.na(z)]
> >n <- length(z)
> >if(n==0) c(NA,NA,NA,0) else
> >if(n==1) c(z, NA,NA,1) else {
> >  m <- mean(z)
> >  s <- sd(z)
> >  c(Mean=m, SD=s, N=n)
> >}
> >  })
> >   w <- as.vector(s)
> >   names(w) <-  as.vector(outer(rownames(s), colnames(s), paste, sep=''))
> >   w
> > }
> >
> > df <- data.frame(LAB = rep(1:8, each=60), BATCH = rep(c(1,2), 240), Y =
> > rnorm(480))
> >
> > library(Hmisc)
> >
> > with(df, summarize(cbind(Y),
> >llist(LAB, BATCH),
> >FUN = g,
> >stat.name=c("mean", "stdev", "n")))
> >
> >LAB BATCHmean stdev  n
> > 11 1  0.13467569 1.0623188 30
> > 21 2  0.15204232 1.0464287 30
> > 32 1 -0.14470044 0.7881942 30
> > 42 2 -0.34641739 0.9997924 30
> > 53 1 -0.17915298 0.9720036 30
> > 63 2 -0.13942702 0.8166447 30
> > 74 1  0.08761900 0.9046908 30
> > 84 2  0.27103640 0.7692970 30
> > 95 1  0.08017377 1.1537611 30
> > 10   5 2  0.01475674 1.0598336 30
> > 11   6 1  0.29208572 0.8006171 30
> > 12   6 2  0.10239509 1.1632274 30
> > 13   7 1 -0.35550603 1.2016190 30
> > 14   7 2 -0.33692452 1.0458184 30
> > 15   8 1 -0.03779253 1.0385098 30
> > 16   8 2 -0.18652758 1.1768540 30
> >
> > with(df, summarize(cbind(Y),
> >llist(LAB),
> >FUN = g,
> >stat.name=c("mean", "stdev", "n")))
> >
> >   LABmean stdev  n
> > 1   1  0.14335900 1.0454666 60
> > 2   2 -0.24555892 0.8983465 60
> > 3   3 -0.15929000 0.8902766 60
> > 4   4  0.17932770 0.8377011 60
> > 5   5  0.04746526 1.0988603 60
> > 6   6  0.19724041 0.9946316 60
> > 7   7 -0.34621527 1.1168682 60
> > 8   8 -0.11216005 1.1029466 60
> >
> >   Once you write the summary function g, it's not that complex.  See
> > ?summarize in the Hmisc package for more detail.  Also, you might take a
> > look at the doBy and reshape packages.
>
> With the reshape package, I'd do it like this:
>
> df <- data.frame(LAB = rep(1:8, each=60), BATCH = rep(c(1,2), 240), Y
> =rnorm(480))
> dfm <- melt(df, measured="Y")
>
> cast(dfm, LAB  ~ ., c(mean, sd, length))
> cast(dfm, LAB + BATCH ~ ., c(mean, sd, length))
> cast(dfm, LAB + BATCH ~ ., c(mean, sd, length), margins=T)
>
> Regards,
>
> Hadley
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] question on multilevel modeling

2006-11-07 Thread Dave Atkins

Christine--

You have two and only two individuals per dyad; when you try to fit random 
slopes at level-2 (within couples), you are attempting to estimate an 
intercept, 
slope, and covariance for each individual.  Basically, you don't have enough 
data to do it.  If you restrict yourself to a single random-effect at level-2, 
you shouldn't have any problems.  So, it's not a code problem; it's an issue of 
the amount of data (or nature of your data) relative to the model you're 
attempting to fit.

You might want to see a paper I wrote on HLM with dyadic data (which has an 
appendix with R code); I discuss this issue some and various strategies for 
dealing with it:

Atkins, D. C. (2005).  Using multilevel models to analyze marital and family 
treatment data: Basic and advanced issues.  Journal of Family Psychology, 19, 
98-110.

Hope that helps.

cheers, Dave


Hi,

I am trying to run a multilevel model with time nested in people and
people nested in dyads (3 levels of nesting) by initially running a
series of models to test whether the slope/intercept should be fixed or
random.  The problem that I am experiencing appears to arise between the
random intercept, fixed slope equation AND.

(syntax:
rint<-lme(BDIAFTER~BDI+WEEK+CORUMTO, random=~1|DYADID/PARTICIP,
data=new)
summary(rint))

the random slope, random intercept model

(syntax:
rslint<-lme(BDIAFTER~BDI+WEEK+CORUMTO, random=~CORUMTO|DYADID/PARTICIP,
data=new)
summary(rslint))

at which point I obtain the exact same results for each model suggesting
that one of the model is not properly specifying the slope or intercept.

Or, I receive the following error message when I try to run the random
slope/random intercept model.

Error in solve.default(pdMatrix(a, fact = TRUE)) :
 system is computationally singular: reciprocal condition number
= 6.77073e-017

(whether I receive an error message or the same results depends on the
specific variables in the model).

It has been suggested that I may need to change the default starting
values in the model because I may be approaching a boundary-is this a
plausible explanation for my difficulties?  If so, how do I do this in R
and can you refer me to a source that might highlight what would be
reasonable starting values?
If this does not seem like the problem, any idea what the problem may be
and how I might fix it?

Thank you so much for your assistance,
Christine Calmes


Christine A. Calmes, MA
Dept of Psychology
University at Buffalo: The State University of New York
Park Hall 216
Buffalo, NY 14260
[EMAIL PROTECTED]
(716) 645-3650 x578

-- 
Dave Atkins, PhD
Assistant Professor in Clinical Psychology
Fuller Graduate School of Psychology
Email: [EMAIL PROTECTED]
Phone: 626.584.5554

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Comparison between GARCH and ARMA

2006-11-07 Thread Leeds, Mark \(IED\)
Hi : I'm a R novice but I consider myself reasonably versed in time
series related material and
I have never heard of an equivalence between Garch(1,1) for volatility
and an ARMA(1,1) in the squared returns 
and I'm almost sure there isn't.

There are various problems with what you wrote.

1) r(t) = h(t)*z(t) not h(i) but that's not a big deal.

2) you can't write the equation in terms of r(t) because r(t) =
h(t)*z(t) and h(t) is UPDATED FIRST
And then the relation r(t) = h(t)*z(t) is true ( in the sense of the
model ). So, r(t) is
a function of z(t) , a random variable, so trying to use r(t) on the
left hand side of the volatility
equation doesn't make sense at all.

3) even if your equation was valid, what you wrote is not an ARMA(1,1).
The AR term is there but the MA term
( the beta term ) Has an r_t-1 terms in it when r_t-1 is on the left
side. An MA term in an ARMA framework
multiples lagged noise terms not the lag of what's on the left side.
That's what the AR term does.

4) even if your equation was correct in terms of it being a true
ARMA(1,1) , you
Have common coefficients on The AR term and MA term ( beta ) so you
would need contraints to tell the
Model that this was the same term in both places.

5) basically, you can't do what you
Are trying to do so you shouldn't expect to any consistency in estimates
Of the intercept for the reasons stated above.
why are you trying to transform in such a way anyway ? 

Now back to your original garch(1,1) model 

6) a garch(1,1) has a stationarity condition that alpha + beta is less
than 1
So this has to be satisfied when you estimate a garch(1,1).

It looks like this condition is satisfied so you should be okay there.

7) also, if you are really assuming/believe that the returns have mean
zero to begin with,  without subtraction,
Then you shouldn't be subtracting the mean before you estimate
Because eseentially you will be subtracting noise and throwing out
useful 
Information that could used in estimating the garch(1,1) parameters.
Maybe you aren't assuming that the mean is zero and you are making the
mean zero which is fine.

I hope this helps you. I don't mean to be rude but I am just trying to
get across that what you
Are doing is not valid. If you saw the equivalence somewhere in the
literature,
Let me know because I would be interested in looking at it.

 
mark




 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Megh Dal
Sent: Tuesday, November 07, 2006 2:24 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Comparison between GARCH and ARMA

Dear all R user,

Please forgive me if my problem is too simple.
Actually my problem is basically Statistical rather directly R related.
Suppose I have return series ret
with mean zero. And I want to fit a Garch(1,1)  
on this.

my   is r[t] = h[i]*z[t]

h[t] = w + alpha*r[t-1]^2 + beta*h[t-1]

I want to estimate the three parameters here;

the R syntax is as follows:

# download data:
data(EuStockMarkets)
r <- diff(log(EuStockMarkets))[,"DAX"]
r = r - mean(r)

# fit a garch(1,1) on this:
library(tseries)
garch(r)

The estimated parameters are given below:

 * ESTIMATION WITH ANALYTICAL GRADIENT * 



Call:
garch(x = r)

Coefficient(s):
   a0 a1 b1  
4.746e-06  6.837e-02  8.877e-01  

Now it is straightforward to transform Garch(1,1) 
 to a ARMA   like this:

r[t]^2 = w + (alpha+beta)*r[t-1]^2 + beta*(h[t-1] -
r[t-1]^2) - (h[t] - r[t]^2)
   = w + (alpha+beta)*r[t-1]^2 + beta*theta[t-1] + theta[t]

So if I fit a ARMA(1,1) on r[t]^2 I am getting following result;

arma(r^2, order=c(1,1))

Call:
arma(x = r^2, order = c(1, 1))

Coefficient(s):
   ar1 ma1   intercept  
 9.157e-01  -8.398e-01   9.033e-06  

Therefore if the above derivation is correct then I should get a same
intercept term for both Garch and ARMA case. But here I am not getting
it. Can anyone explain why?

Any input will be highly appreciated.

Thanks and regards,
Megh




 


Sponsored Link

Degrees online in as fast as 1 Yr - MBA, Bachelor's, Master's, Associate
Click now to apply http://yahoo.degrees.info

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Data frames in files - and - SQL with data frames

2006-11-07 Thread Jerome Asselin
On Mon, 2006-11-06 at 15:57 -0300, Eduardo Henrique Altieri wrote:
> Since the databases that I handle with are very large, I need answers
> to some questions: 
> 
> 1) Can I work with R data frames like databases in SAS, that is,
> storing data frames in files instead of in memory?
> 
> 2) Can I use SQL codes to work with R data frames? Note that I ask for
> the direct use, with no need to use a “channel” or to export data
> frames to a DBMS.

Interesting questions... I see that nobody has replied and I was
interested to read other thoughts about it.

I'm curious to know under what scenario you require these features.

To answer your question, personally I don't think it's possible to do
that with R. If I had a very large database, I'd probably focus on
interfacing R with other database system (e.g. MySQL) to which I'd
connect through a channel.

Regards,
-- 
Jerome Asselin, M.Sc., Agent de recherche, RHCE
CHUM -- Centre de recherche
3875 rue St-Urbain, 3e etage // Montreal QC  H2W 1V1
Tel.: 514-890-8000 Poste 15914; Fax: 514-412-7106

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] question on multilevel modeling

2006-11-07 Thread Christine A. Calmes
Thank you for your quick response.  Basically, I am trying to test a
psychological model in which a person's level of passive, negative
communication with others in their environment (CORUMTO) on one week
predicts their level of depression on the following week (BDIAFTER)
controlling for their level of depression on the same week that that
they co-ruminate (BDI).  The WEEK variable accounts for the fact that
there are 7 weeks worth of data in the model and that scores on adjacent
weeks are more closer related than scores on weeks that are further
apart.
Here is the output for the following models--thanks again for your help!
 
#random slope on corumination but fixed intercept

rslope<-lme(BDIAFTER~BDI+WEEK+CORUMTO,
random=~CORUMTO-1|DYADID/PARTICIP, data=new) 
summary(rslope)

Linear mixed-effects model fit by REML
 Data: new 
   AIC  BIClogLik
  5340.796 5375.016 -2663.398

Random effects:
 Formula: ~CORUMTO - 1 | DYADID
 CORUMTO
StdDev: 0.0001230839

 Formula: ~CORUMTO - 1 | PARTICIP %in% DYADID
 CORUMTO Residual
StdDev: 2.160106e-07   3.5853

Fixed effects: BDIAFTER ~ BDI + WEEK + CORUMTO 
 Value Std.Error  DF  t-value p-value
(Intercept)  1.0536425 0.4055838 808  2.59784  0.0096
BDI  0.7343608 0.0219012 808 33.53056  0.
WEEK 0.0260517 0.0678471 808  0.38398  0.7011
CORUMTO -0.0093802 0.0065327 808 -1.43589  0.1514
 Correlation: 
(Intr) BDIWEEK  
BDI -0.259  
WEEK-0.689  0.119   
CORUMTO -0.703 -0.062  0.115

Standardized Within-Group Residuals:
   Min Q1Med Q3Max 
-5.3790151 -0.3774653 -0.1883441  0.3183254  6.6093553 

Number of Observations: 985
Number of Groups: 
  DYADID PARTICIP %in% DYADID 
  87  174

#random intercept & fixed slope

rint<-lme(BDIAFTER~BDI+WEEK+CORUMTO, random=~1|DYADID/PARTICIP,
data=new) 
summary(rint)

Linear mixed-effects model fit by REML
 Data: new 
   AIC  BIClogLik
  5332.942 5367.162 -2659.471

Random effects:
 Formula: ~1 | DYADID
(Intercept)
StdDev:1.435454

 Formula: ~1 | PARTICIP %in% DYADID
(Intercept) Residual
StdDev:2.607136 3.042346

Fixed effects: BDIAFTER ~ BDI + WEEK + CORUMTO 
 Value Std.Error  DF   t-value p-value
(Intercept)  3.1159915 0.5394972 808  5.775733  0.
BDI  0.2937769 0.0308994 808  9.507528  0.
WEEK-0.1406907 0.0597295 808 -2.355464  0.0187
CORUMTO  0.037 0.0087027 808  0.000427  0.9997
 Correlation: 
(Intr) BDIWEEK  
BDI -0.269  
WEEK-0.562  0.193   
CORUMTO -0.713 -0.073  0.192

Standardized Within-Group Residuals:
   Min Q1Med Q3Max 
-5.6443060 -0.3649701 -0.1069800  0.2750957  5.5662019 

Number of Observations: 985
Number of Groups: 
  DYADID PARTICIP %in% DYADID 
  87  174 

#random intercept and random slope 

rslint<-lme(BDIAFTER~BDI+WEEK+CORUMTO, random=~CORUMTO|DYADID/PARTICIP,
data=new) 
summary(rslint)


Linear mixed-effects model fit by REML
 Data: new 
   AIC  BIClogLik
  5340.949 5394.724 -2659.475

Random effects:
 Formula: ~CORUMTO + 1 | DYADID
 Structure: General positive-definite, Log-Cholesky parametrization
StdDev  Corr  
(Intercept) 1.438559367 (Intr)
CORUMTO 0.002629201 -0.068

 Formula: ~CORUMTO + 1 | PARTICIP %in% DYADID
 Structure: General positive-definite, Log-Cholesky parametrization
StdDev  Corr  
(Intercept) 2.606533039 (Intr)
CORUMTO 0.001218270 -0.014
Residual3.042301836   

Fixed effects: BDIAFTER ~ BDI + WEEK + CORUMTO 
 Value Std.Error  DF   t-value p-value
(Intercept)  3.1154427 0.5396189 808  5.773413  0.
BDI  0.2938990 0.0308987 808  9.511686  0.
WEEK-0.1405892 0.0597340 808 -2.353590  0.0188
CORUMTO -0.028 0.0087093 808 -0.000324  0.9997
 Correlation: 
(Intr) BDIWEEK  
BDI -0.269  
WEEK-0.561  0.193   
CORUMTO -0.713 -0.073  0.192

Standardized Within-Group Residuals:
   Min Q1Med Q3Max 
-5.6453974 -0.3656707 -0.1070803  0.2746329  5.5665960 

Number of Observations: 985
Number of Groups: 
  DYADID PARTICIP %in% DYADID 
  87  174



Christine A. Calmes, MA
Dept of Psychology
University at Buffalo: The State University of New York
Park Hall 216
Buffalo, NY 14260
[EMAIL PROTECTED]
(716) 645-3650 x578


-Original Message-
From: Chuck Cleland [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 07, 2006 5:00 AM
To: Christoph Buser
Cc: Christine A. Calmes; R-help@stat.math.ethz.ch
Subject: Re: [R] question on multilevel modeling

Christoph Buser wrote:
> Dear Christine
> 
> I think the problem in your second model is that you are
> including "CORUMTO" both as a fixed effect and as a random
> effect. 


Re: [R] Boxplot

2006-11-07 Thread Chuck Cleland
Benjamin Dickgiesser wrote:
> Hi,
> I am new to R and am still trying to get a grip of it.
> 
> I have data in this format:
> 
> Run Lab Batch  Y
> 1 1   1 1 608.781
> 2 2   1 2 569.670
> 3 3   1 1 689.556
> 4 4   1 2 747.541
> 5 5   1 1 618.134
> 6 6   1 2 612.182
> 7 7   1 1 680.203
> 8 8   1 2 607.766
> 9 9   1 1 726.232
> 
> and I want to make a boxplot of the Y values for each Batch. How would
> I go about this?
> I tried
> boxplot(data.ceramic[ data.ceramic$Batch == "1", ]$Y ~ data.ceramic[
> data.ceramic$Batch == "2", ]$Y, horizontal=T,xlab="Y", ylab="Batch")
> 
> but was completley wrong

  Here are a few ideas, assuming your data are in the df data.frame:

par(las=1, mar=c(7,10,7,7))

boxplot(Y ~ BATCH, data = df, horizontal = TRUE, names=c("Batch1",
"Batch2"))

boxplot(Y ~ BATCH, data = subset(df, LAB == 1), horizontal = TRUE,
names=c("Batch1", "Batch2"))

boxplot(Y ~ BATCH + LAB, data = df, horizontal = TRUE, names =
paste("Lab", rep(1:8, each = 2), "/Batch", rep(1:2, 8), sep = ""))

library(lattice)

bwplot(BATCH ~ Y, data = df, horizontal=TRUE)

bwplot(BATCH ~ Y | LAB, data = df, horizontal=TRUE, layout=c(1,8,1))

> Thank you for your help.
> 
> Ben
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Which genetic optimization package allows customized crossover and mutation operation

2006-11-07 Thread sun
Hi,

  I am looking for genetic optimization package that allow to define my own 
chromosome solution and crossover/mutation opoerations. I checked genoud and 
genopt, not with much effort of 'cause, with no luck.

 Any one can shed some light on this? thanks.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Boxplot

2006-11-07 Thread Benjamin Dickgiesser
Ah I think I've got it:

boxplot(Y ~ Batch, data=data, horizontal=T,xlab="Y", ylab="Batch")


On 11/7/06, Benjamin Dickgiesser <[EMAIL PROTECTED]> wrote:
> Hi,
> I am new to R and am still trying to get a grip of it.
>
> I have data in this format:
>
> Run Lab Batch  Y
> 1 1   1 1 608.781
> 2 2   1 2 569.670
> 3 3   1 1 689.556
> 4 4   1 2 747.541
> 5 5   1 1 618.134
> 6 6   1 2 612.182
> 7 7   1 1 680.203
> 8 8   1 2 607.766
> 9 9   1 1 726.232
>
> and I want to make a boxplot of the Y values for each Batch. How would
> I go about this?
> I tried
> boxplot(data.ceramic[ data.ceramic$Batch == "1", ]$Y ~ data.ceramic[
> data.ceramic$Batch == "2", ]$Y, horizontal=T,xlab="Y", ylab="Batch")
>
> but was completley wrong
>
> Thank you for your help.
>
> Ben
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Boxplot

2006-11-07 Thread Benjamin Dickgiesser
Hi,
I am new to R and am still trying to get a grip of it.

I have data in this format:

Run Lab Batch  Y
1 1   1 1 608.781
2 2   1 2 569.670
3 3   1 1 689.556
4 4   1 2 747.541
5 5   1 1 618.134
6 6   1 2 612.182
7 7   1 1 680.203
8 8   1 2 607.766
9 9   1 1 726.232

and I want to make a boxplot of the Y values for each Batch. How would
I go about this?
I tried
boxplot(data.ceramic[ data.ceramic$Batch == "1", ]$Y ~ data.ceramic[
data.ceramic$Batch == "2", ]$Y, horizontal=T,xlab="Y", ylab="Batch")

but was completley wrong

Thank you for your help.

Ben

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Gregexpr - extract results with lapply

2006-11-07 Thread Gabor Grothendieck
Try this:

library(gsubfn)
s <-c("ABC", "this WOUld be gOOD")
strapply(s, "[A-Z]{3}", perl = TRUE)

See:
http://code.google.com/p/gsubfn/

On 11/7/06, Lapointe, Pierre <[EMAIL PROTECTED]> wrote:
> Gregexpr - extract results with lapply
>
> Hello,
>
> I need to extract sequences of three upper case letters in a string. In
> other words, in this string:
>
>str <-c("ABC", "this WOUld be gOOD")
>
> The result I'm looking for is ABC WOU OOD.
>
> With gregexpr, I can get the position and length of the sequences
>
>gregexpr('[A-Z]{3}',str,perl=TRUE)
>
>[[1]]
>[1] 1
>attr(,"match.length")
>[1] 3
>
>[[2]]
>[1]  6 16
>attr(,"match.length")
>[1] 3 3
>
> and with substr, I can extract  the data.  (I use 1 and 3 as start and stop
> in this example, since I haven't figured out how to use the gregexpr
> results.
>
>substr(str,1,3)
>
> My problem is linking it all together.  I know the answer is probably with
> lapply
>
>lapply(str,substr,1,3)
>
> but I don't know how to specify the right start and stop positions from the
> gregexpr results.
>
>
> **
> AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}}
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] error in format.df when using dec

2006-11-07 Thread Rainer M Krug
When using format.df with dec, the formating does not work (see code 
below).

Any help appreciated how I could do the formating (I want to export to 
LaTeX),

Rainer

I am using the newest version of Hmisc from CRAN, R version:

 > version
_
platform   i686-pc-linux-gnu
arch   i686
os linux-gnu
system i686, linux-gnu
status
major  2
minor  4.0
year   2006
month  10
day03
svn rev39566
language   R
version.string R version 2.4.0 (2006-10-03)


 > x <- data.frame(a=c(1.12345812,2.225415478547775566), b=3:4)
 > x$m <- matrix(5:8,nrow=2)
 > dim(x)
[1] 2 3
 > x
  a b m.1 m.2
1 1.123458 3   5   7
2 2.225415 4   6   8
 > format.df(x)
   a  b   m 1 m 2
1 "1.123458" "3" "5" "7"
2 "2.225415" "4" "6" "8"
attr(,"col.just")
[1] "r" "r" "r" "r"
 > format.df(x, dec=2)
   a   b   m 1 m 2
1 "1.120" "3" "5" "7"
2 "2.230" "4" "6" "8"
attr(,"col.just")
[1] "r" "r" "r" "r"
 >



-- 
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Department of Conservation Ecology and Entomology
University of Stellenbosch
Matieland 7602
South Africa

Tel:+27 - (0)72 808 2975 (w)
Fax:+27 - (0)21 808 3304
Cell:   +27 - (0)83 9479 042

email:  [EMAIL PROTECTED]
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Scan or read.table bug in R?

2006-11-07 Thread Duncan Murdoch
Please post general R help questions to the R-help mailing list.

The likely problem here is that your file isn't in the current working 
directory.  To avoid this problem, I often use the file.choose() 
function to obtain a full path to the file, rather than typing the name 
out myself.

Duncan Murdoch

On 11/7/2006 8:48 AM, Satya Pimputkar wrote:
> Hello R-Team,
> 
>  
> 
> I’m a student of the University of Zurich studing Finances.
> 
> I just installed R for Windows (2.4.0) on my tablet pc (windows pro tablet 
> edition).
> 
> After reboot I ran the program and changed the directory to my used folder.
> 
> Using a .txt file named “a.txt” and stored in the entered directory I tried 
> the function:
> 
>  
> 
> scan(“a.txt”) and read.table(“a.txt”)
> 
>  
> 
> Following error report encountered:
> 
>  
> 
> scann("a.txt")
> 
> Fehler in file(file, "r") : kann Verbindung nicht öffnen
> 
> Zusätzlich: Warning message:
> 
> kann Datei 'a.txt' nicht öffnen. Grund 'No such file or directory'
> 
>  
> 
> Where is the problem? 
> 
> I tried, reinstalling, turing off virus scan/firewall, run program alone w/o 
> other applications
> behind.
> 
>  
> 
> Please help me out, our local “R-professionals” including the doc can’t fix 
> this problem
> 
> Thank you in advance!
> 
>  
> 
> Kind regards
> 
> Satya Pimputkar
> 
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] changing image dimensions

2006-11-07 Thread hadley wickham
> I'd get an external program to do it (e.g. ImageMagick) rather than
> reinventing.  But if I had to reinvent, I'd do it by creating a function
> to interpolate [0,1] x [0,1] values from within the original image, and
> evaluate that function at the appropriate spots within the bigger one.
>
> Choosing which kind of interpolation could be tricky, especially if the
> image is in colour:  that's why I'd suggest using someone else's work.

Bicubic interpolation
(http://en.wikipedia.org/wiki/Bicubic_interpolation) is pretty good,
and might not be too hard to implement.  High-end image software use
more complicated algorithms:
http://www.americaswonderlands.com/digital_photo_interpolation.htm

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Display problems X11 device

2006-11-07 Thread Prof Brian Ripley
On Tue, 7 Nov 2006, Nicolas Mazziotta wrote:

>> Hello,
>>
>> I am running R Version 2.3.1 (2006-06-01) on Kubuntu Edgy Eft 6.10
>> (problems appreared after upgrading from previous version, but I don't know
>> which version of R was included then).
>>
>> I have very weird problems with X11 device: it seems that it cannot display
>> correctly. For instance,
>>
>>  x<-1:10
>>  plot(x)
>>
>> opens the X11 plotting window, but points are not displayed, only box
>> tickmarks. The margin are missing too.
>
> It seems to be an encoding problem: if I set
>
> LC_ALL=C (I used UTF-8)
>
> Plotting works well... But then, my data files (which are utf8) are not
> imported correctly any longer. Is it possible to use UTF-8, so that I don't
> have to change the environment before I launch R?

Yes, it is possible, but you do need your X11 system set up correctly for 
your UTF-8 locale (unstated).  It looks like you have no suitable mappings 
of UTF-8 fonts in X11, or you are running in a locale unknown to X11. (Try 
using en_US.utf8 to test the latter possibility.)  This is not an R issue.

Remote debugging of X11 problems is virtually impossible: please check 
with local expertise.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Better way to create tables of mean & standard deviations

2006-11-07 Thread hadley wickham
> > I can only think of  rather complex ways to solve the labeling issue...
> >
> > I would appreciate it if someone could point out if there are
> > better/cleaner/easier ways of achieving what I'm trying todo.
>
>   Does this help?
>
> g <- function(y) {
>   s <- apply(y, 2,
>  function(z) {
>z <- z[!is.na(z)]
>n <- length(z)
>if(n==0) c(NA,NA,NA,0) else
>if(n==1) c(z, NA,NA,1) else {
>  m <- mean(z)
>  s <- sd(z)
>  c(Mean=m, SD=s, N=n)
>}
>  })
>   w <- as.vector(s)
>   names(w) <-  as.vector(outer(rownames(s), colnames(s), paste, sep=''))
>   w
> }
>
> df <- data.frame(LAB = rep(1:8, each=60), BATCH = rep(c(1,2), 240), Y =
> rnorm(480))
>
> library(Hmisc)
>
> with(df, summarize(cbind(Y),
>llist(LAB, BATCH),
>FUN = g,
>stat.name=c("mean", "stdev", "n")))
>
>LAB BATCHmean stdev  n
> 11 1  0.13467569 1.0623188 30
> 21 2  0.15204232 1.0464287 30
> 32 1 -0.14470044 0.7881942 30
> 42 2 -0.34641739 0.9997924 30
> 53 1 -0.17915298 0.9720036 30
> 63 2 -0.13942702 0.8166447 30
> 74 1  0.08761900 0.9046908 30
> 84 2  0.27103640 0.7692970 30
> 95 1  0.08017377 1.1537611 30
> 10   5 2  0.01475674 1.0598336 30
> 11   6 1  0.29208572 0.8006171 30
> 12   6 2  0.10239509 1.1632274 30
> 13   7 1 -0.35550603 1.2016190 30
> 14   7 2 -0.33692452 1.0458184 30
> 15   8 1 -0.03779253 1.0385098 30
> 16   8 2 -0.18652758 1.1768540 30
>
> with(df, summarize(cbind(Y),
>llist(LAB),
>FUN = g,
>stat.name=c("mean", "stdev", "n")))
>
>   LABmean stdev  n
> 1   1  0.14335900 1.0454666 60
> 2   2 -0.24555892 0.8983465 60
> 3   3 -0.15929000 0.8902766 60
> 4   4  0.17932770 0.8377011 60
> 5   5  0.04746526 1.0988603 60
> 6   6  0.19724041 0.9946316 60
> 7   7 -0.34621527 1.1168682 60
> 8   8 -0.11216005 1.1029466 60
>
>   Once you write the summary function g, it's not that complex.  See
> ?summarize in the Hmisc package for more detail.  Also, you might take a
> look at the doBy and reshape packages.

With the reshape package, I'd do it like this:

df <- data.frame(LAB = rep(1:8, each=60), BATCH = rep(c(1,2), 240), Y
=rnorm(480))
dfm <- melt(df, measured="Y")

cast(dfm, LAB  ~ ., c(mean, sd, length))
cast(dfm, LAB + BATCH ~ ., c(mean, sd, length))
cast(dfm, LAB + BATCH ~ ., c(mean, sd, length), margins=T)

Regards,

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Reformat a data frame

2006-11-07 Thread Dimitris Rizopoulos
try the following

df2 <- reshape(df1[-1], idvar = "id", direction = "long",
timevar = "Param", times = c("resist", "thick", "temp"),
varying = list(c("resist", "thick", "temp")))
df2 <- df2[order(df2$id, df2$desc), ]
rownames(df2) <- 1:nrow(df2)
df2


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: "Thorsten Muehge" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, November 07, 2006 10:10 AM
Subject: [R] Reformat a data frame


>
> Hello Experts,
> how do I reformat a data frame in the way described below:
>
>
> df1:
> IDdesc  resist  thick temp
> 1 4711  100   5 20
> 2 4712  101   4 21
> 3 4711  993 19
> 4 4712  987 22
>
> TO
>
> df2:
> iddesc  Param Value
> 1 4711  resist  100
> 1 4711  Thick 5
> 1 4711  temp  20
> 2 4712  resist  101
> 2 4712  Thick 4
> 2 4712  temp  21
> 3 4711  resist  99
> 3 4711  thick 4
> 3 4711  temp  19
> 4 4712  resist  98
> 4 4712  thick 7
> 4 4712  temp  22
>
> Thanks a lot for your help.
> With best regards
> Thorsten
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Better way to create tables of mean & standard deviations

2006-11-07 Thread Chuck Cleland
Benjamin Dickgiesser wrote:
> Hi
> 
> I'm trying to create tables of means, standard deviations and numbers
> of observations (i) for
> each laboratory (ii) for each batch number (iii) for each batch at
> each laboratory for the attached data.
> 
> I created these functions:
> summary.aggregate <- function(y, label, ...)
> {
> temp.mean <- aggregate(y, FUN=mean, ...)
> temp.sd  <- aggregate(y, FUN=sd, ...)
> temp.length <- aggregate(y, FUN=length, ...)
> txtlabs <-makeLabel(label,length(temp.mean$x))
> 
> temp <-
> data.frame(mean=temp.mean$x,stdev=temp.sd$x,n=temp.length$x,row.names=txtlabs)
> 
> }
> makeLabel <- function(label,llength,increaseLag=FALSE)
> {
> x <- c()
> for(cnt in 1:llength)
> {
> if(increaseLag == TRUE && mode(cnt/2))
> {
>
> }
> x[cnt] <- paste(label,cnt)
> }
> x
> }
> 
> and can use the following commands to create tables of means etc.
> 
> print(summary.aggregate(data.ceramic$Y,"Lab",by=list(data.ceramic$Lab)))
> 
> to create output like this:
> 
>  meanstdev  n
> Lab 1 645.6125 65.94129 60
> Lab 2 655.2121 70.64094 60
> Lab 3 633.3161 80.48620 60
> Lab 4 650.3897 77.59191 60
> Lab 5 630.4955 84.9 60
> Lab 6 656.2608 66.16100 60
> Lab 7 666.1775 74.39796 60
> Lab 8 663.1543 71.10769 60
> 
> 
> The purpose of the first function is to calculate the mean, stdev etc.
> and the second is simply to create a labelling vector e.g c(Lab1,
> Lab2, ..., Lab 8)
> 
> 
> 
> This seems rather complex to me for what I am trying to achieve. Is
> there a better way to do this?
> Also I am having some trouble getting the labelling right for iii
> since it should look like:
> 
>   Batchmeanstdev  n
> Lab 1 1 686.7179 53.37582 30
> Lab 1 2 695.8710 62.08583 30
> Lab 2 1 654.5317 94.19746 30
> Lab 2 2 702.9095 51.44984 30
> Lab 3 1 676.2975 69.13784 30
> Lab 3 2 692.1952 57.27212 30
> Lab 4 1 700.8995 56.91608 30
> Lab 4 2 702.5668 62.36488 30
> Lab 5 1 604.5070 50.01621 30
> Lab 52 614.5532 53.64149 30
> Lab 61 612.1006 58.09503 30
> Lab 6   2 597.8699 62.40710 30
> Lab 71 584.6934 74.66537 30
> Lab 72 620.3263 54.34871 30
> Lab 81 631.4555 74.34480 30
> Lab 8   2 623.7419 56.42492 30
> 
> Currentley I'm using:
> temp <-
> summary.aggregate(data.ceramic$Y,"Lab",by=list(data.ceramic$Lab,data.ceramic$Batch))
> 
> batchcnt <- c(1,2)
> print(data.frame(Batc=batchcnt,temp))
> 
> But that produces this output:
>   Batc meanstdev  n
> Lab 1 1 686.7179 53.37582 30
> Lab 2 2 695.8710 62.08583 30
> Lab 3 1 654.5317 94.19746 30
> Lab 4 2 702.9095 51.44984 30
> Lab 5 1 676.2975 69.13784 30
> Lab 6 2 692.1952 57.27212 30
> Lab 7 1 700.8995 56.91608 30
> Lab 8 2 702.5668 62.36488 30
> Lab 9 1 604.5070 50.01621 30
> Lab 102 614.5532 53.64149 30
> Lab 111 612.1006 58.09503 30
> Lab 122 597.8699 62.40710 30
> Lab 131 584.6934 74.66537 30
> Lab 142 620.3263 54.34871 30
> Lab 151 631.4555 74.34480 30
> Lab 162 623.7419 56.42492 30
> 
> I can only think of  rather complex ways to solve the labeling issue...
> 
> I would appreciate it if someone could point out if there are
> better/cleaner/easier ways of achieving what I'm trying todo.

  Does this help?

g <- function(y) {
  s <- apply(y, 2,
 function(z) {
   z <- z[!is.na(z)]
   n <- length(z)
   if(n==0) c(NA,NA,NA,0) else
   if(n==1) c(z, NA,NA,1) else {
 m <- mean(z)
 s <- sd(z)
 c(Mean=m, SD=s, N=n)
   }
 })
  w <- as.vector(s)
  names(w) <-  as.vector(outer(rownames(s), colnames(s), paste, sep=''))
  w
}

df <- data.frame(LAB = rep(1:8, each=60), BATCH = rep(c(1,2), 240), Y =
rnorm(480))

library(Hmisc)

with(df, summarize(cbind(Y),
   llist(LAB, BATCH),
   FUN = g,
   stat.name=c("mean", "stdev", "n")))

   LAB BATCHmean stdev  n
11 1  0.13467569 1.0623188 30
21 2  0.15204232 1.0464287 30
32 1 -0.14470044 0.7881942 30
42 2 -0.34641739 0.9997924 30
53 1 -0.17915298 0.9720036 30
63 2 -0.13942702 0.8166447 30
74 1  0.08761900 0.9046908 30
84 2  0.27103640 0.7692970 30
95 1  0.08017377 1.1537611 30
10   5 2  0.01475674 1.0598336 30
11   6 1  0.29208572 0.8006171 30
12   6 2  0.10239509 1.1632274 30
13   7 1 -0.35550603 1.2016190 30
14   7 2 -0.33692452 1.0458184 30
15   8 1 -0.03779253 1.0385098 30
16   8 2 -0.18652758 1.1768540 30

with(df, summarize(cbind(Y),
   llist(LAB),
   FUN = g,
   stat.name=c("mean", "stdev", "n")))

  LABmean stdev  n
1   1  0.14335900 1.0454666 60
2   2 -0.24555892 0.8983465 60
3   3 -0.15929000 0.8902766 60
4   4  0.17932770 0.8377011 60
5   5  0.04746526 1.09

Re: [R] S-poetry as book

2006-11-07 Thread Patrick Burns
As far as I know, you are on your own.  And it seems
like I would know.

Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Benjamin Otto wrote:

>Hi,
>
> 
>
>Is there a printed version of S-poetry which can purchased or would I have
>to print out and bind it myself?
>
> 
>
>Regards,
>
> 
>
>Benjamin
>
> 
>
>--
>Benjamin Otto
>Universitaetsklinikum Eppendorf Hamburg
>Institut fuer Klinische Chemie
>Martinistrasse 52
>20246 Hamburg
>
> 
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
>
>
>  
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Gregexpr - extract results with lapply

2006-11-07 Thread Lapointe, Pierre
Gregexpr - extract results with lapply

Hello,

I need to extract sequences of three upper case letters in a string. In
other words, in this string:

str <-c("ABC", "this WOUld be gOOD")

The result I'm looking for is ABC WOU OOD.

With gregexpr, I can get the position and length of the sequences

gregexpr('[A-Z]{3}',str,perl=TRUE)

[[1]]
[1] 1
attr(,"match.length")
[1] 3

[[2]]
[1]  6 16
attr(,"match.length")
[1] 3 3

and with substr, I can extract  the data.  (I use 1 and 3 as start and stop
in this example, since I haven't figured out how to use the gregexpr
results.

substr(str,1,3)

My problem is linking it all together.  I know the answer is probably with
lapply

lapply(str,substr,1,3)

but I don't know how to specify the right start and stop positions from the
gregexpr results.


**
AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] wrong fill colors in polygon-map

2006-11-07 Thread Roger Bivand
On Tue, 7 Nov 2006, Frosch, Katharina wrote:

> Dear all,
> 
> I would like to produce a map with information about the patenting
> activity in German districts, by coloring districts with different
> degrees of patenting activity in different colors. I work with the
> packages maptools, maps and spdep. The map data is read from an external
> .shp file (+ the corresponding .shx and .dbf files). Plotting a map with
> the IDs or the patenting indicator itself works fine. But coloring the
> map leads to completely odd results (wrong colors for most of the
> regions). I also tried simpler values (just 0 and 1 for different
> regions), same problem. I tried to check whether there is any problem
> with the match of data and district ids, but everything seemed to be
> fine. 
> 
> Sample code: 
> 
> brks.pat<-quantile(patenting$patbus)
> #palette.pat<-c("green", "blue", "grey", "darkgrey", "red")
> palette.pat<-c(rep("green", 4), "red")
> plot(iab7.poly, col=palette.pat[findInterval(patenting$patbus,
> brks.pat)])
> legend(1200, -200, fill=palette.pat, legend=round(brks.pat,2), cex=0.6)
> title(main="patenting activity in german districts")
> 
> Data:
> **
> Iab7.poly contains the polygons of 343 German districts
> patenting$patbus contains the number of corporate patents per 100.000
> inhabitants for each district

(R-sig-geo may be a more focussed list for this kind of question)

If the polygons in Iab7.poly are in the same order as the rows of
patenting, and the number of polygons is the same as the number of rows,
it is possible that the breakpoints are not quite what you think (if for
example some of the quantiles are equal, which happens with zero-inflated
data). Omitting all.inside=TRUE in findInterval() can also lead to the
insertion of NA values into the vector of colours.

Perhaps have a look at the classInt package for some examples of choosing 
class intervals i.a. for map display.

Roger

> 
> Any ideas would be appreciated!
> 
> Best regards,
> Katharina
> 
> 
> 
> **
> 
> Katharina Frosch
> Rostock Center for the Study of Demographic Change
> Konrad-Zuse-Str. 1
> 18057 Rostock
> Tel.: (0381) 2081-148
> Fax: (0381) 2081-448
> Mail: [EMAIL PROTECTED] 
> 
> 
> 
> 
> 
> 
> --
> This mail has been sent through the MPI for Demographic Rese...{{dropped}}
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] S-poetry as book

2006-11-07 Thread Benjamin Otto
Hi,

 

Is there a printed version of S-poetry which can purchased or would I have
to print out and bind it myself?

 

Regards,

 

Benjamin

 

--
Benjamin Otto
Universitaetsklinikum Eppendorf Hamburg
Institut fuer Klinische Chemie
Martinistrasse 52
20246 Hamburg

 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] changing image dimensions

2006-11-07 Thread Duncan Murdoch
On 11/7/2006 6:57 AM, Milton Cezar Ribeiro wrote:
> Hi there,
>
>   I have some 1024x1024 binary images (as matrix), and I need change the 
> dimensions to 1280x1280. 
>
>   Any idea?

I'd get an external program to do it (e.g. ImageMagick) rather than 
reinventing.  But if I had to reinvent, I'd do it by creating a function 
to interpolate [0,1] x [0,1] values from within the original image, and 
evaluate that function at the appropriate spots within the bigger one.

Choosing which kind of interpolation could be tricky, especially if the 
image is in colour:  that's why I'd suggest using someone else's work.

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] changing image dimensions

2006-11-07 Thread Milton Cezar Ribeiro
Hi there,
   
  I have some 1024x1024 binary images (as matrix), and I need change the 
dimensions to 1280x1280. 
   
  Any idea?
   
  Regards,
   
  Miltinho
  Brazil


-

 Música para ver e ouvir: You're Beautiful, do James Blunt
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Draw a circle with a given radius in an existing map

2006-11-07 Thread Duncan Murdoch
On 11/7/2006 12:11 AM, Xiaomei Ma wrote:
> I have drawn a map in which the X and Y axes are latitude and 
> longitude. Now I need to draw one circle on the map - the center is a 
> point with specific latitude and longitude, but the challenge is that 
> the radius is in miles. Is there a way to do this? I'd very much 
> appreciate your response.

You want the circle to appear to be a circle on the plot, or an accurate 
representation of a circle on the ground (which may not be circular when 
plotted)?

Uwe answered the former.  I don't know the answer to the latter, but 
surely someone does...

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] wrong fill colors in polygon-map

2006-11-07 Thread Frosch, Katharina
Dear all,

I would like to produce a map with information about the patenting
activity in German districts, by coloring districts with different
degrees of patenting activity in different colors. I work with the
packages maptools, maps and spdep. The map data is read from an external
.shp file (+ the corresponding .shx and .dbf files). Plotting a map with
the IDs or the patenting indicator itself works fine. But coloring the
map leads to completely odd results (wrong colors for most of the
regions). I also tried simpler values (just 0 and 1 for different
regions), same problem. I tried to check whether there is any problem
with the match of data and district ids, but everything seemed to be
fine. 

Sample code: 

brks.pat<-quantile(patenting$patbus)
#palette.pat<-c("green", "blue", "grey", "darkgrey", "red")
palette.pat<-c(rep("green", 4), "red")
plot(iab7.poly, col=palette.pat[findInterval(patenting$patbus,
brks.pat)])
legend(1200, -200, fill=palette.pat, legend=round(brks.pat,2), cex=0.6)
title(main="patenting activity in german districts")

Data:
**
Iab7.poly contains the polygons of 343 German districts
patenting$patbus contains the number of corporate patents per 100.000
inhabitants for each district

Any ideas would be appreciated!

Best regards,
Katharina



**

Katharina Frosch
Rostock Center for the Study of Demographic Change
Konrad-Zuse-Str. 1
18057 Rostock
Tel.: (0381) 2081-148
Fax: (0381) 2081-448
Mail: [EMAIL PROTECTED] 






--
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Probit Scale

2006-11-07 Thread nelson -
Hi all!
  i search but i found no info, so i'm heere to ask you! How can i
plot a graph using the probit scale on y axes?


thanks,
  nelson

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] comparing 2 dataframes

2006-11-07 Thread Priya Kanhai
Hi

The problem is I'm first connecting to the Access database with
odbcConnectAccess and then select with a sqlQuery the dataframe.
In your solution you are typing it. But mine databases consist of
approximately 6 records.

Maybe you have another solution? Thanks in advance.

Regards,

Priya

On 11/7/06, Christoph Buser <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> Maybe this example can help you to find your solution:
>
> dat1 <- data.frame(CUSTOMER_ID = c("1000786BR", "1002047BR", "10127BR",
>  "1004166834BR"," 1004310897BR", "1006180BR",
>  "10064798BR", "1007311BR", "1007621BR",
>  "1008195BR", "10126BR", "95323994BR"),
>CUSTOMER_RR = c("5+", "4", "5+", "2", "X", "4", "4",
> "5+",
>  "4", "4-", "5+", "4"))
>
> dat2 <- data.frame(CUSTOMER_ID = c("1200786BR", "1802047BR", "1027BR",
>  "10166834BR", "107BR", "100BR", "164798BR",
> "1008195BR",
>  "10126BR"),
>CUSTOMER_RR = c("6+", "4", "1+", "2", "X", "4", "4",
> "4",
>  "5+"))
>
> ## Merge, but only by "CUSTOMER_ID"
> datM <- merge(dat1, dat2, by = "CUSTOMER_ID")
> datM
> ## Select only cases that have a similar "CUSTOMER_RR"
> datM1 <- datM[as.character(datM[, "CUSTOMER_RR.x"]) %in%
>   as.character(datM[,"CUSTOMER_RR.y"]), ]
> datM1
>
> Regards,
>
> Christoph
>
> --
>
> Credit and Surety PML study: visit our web page www.cs-pml.org
>
> --
> Christoph Buser <[EMAIL PROTECTED]>
> Seminar fuer Statistik, LEO C13
> ETH Zurich  8092 Zurich  SWITZERLAND
> phone: x-41-44-632-4673 fax: 632-1228
> http://stat.ethz.ch/~buser/
> --
>
>
>
> Priya Kanhai writes:
> > Hi,
> >
> > I''ve a question about comparing 2 dataframes: RRC_db1 and RRC_db2 of
> > different length.
> >
> > For example:
> >
> > RRC_db1:
> >
> > CUSTOMER_ID CUSTOMER_RR
> > 1 1000786BR   5+
> > 2 1002047BR4
> > 3   10127BR   5+
> > 4  1004166834BR2
> > 5  1004310897BRX
> > 6 1006180BR4
> > 710064798BR4
> > 8 1007311BR   5+
> > 9 1007621BR4
> > 101008195BR   4-
> > 11  10126BR   5+
> > 12   95323994BR4
> >
> >  RRC_db2:
> >
> > CUSTOMER_ID CUSTOMER_RR
> > 1 1200786BR   6+
> > 2 1802047BR4
> > 3  1027BR 1+
> > 4   10166834BR2
> > 5   107BR  X
> > 6 100BR4
> > 7164798BR4
> > 81008195BR   4-
> > 9  10126BR   5+
> >
> >
> > I want to pick the CUSTOMER_ID of RRC_db1 which also exist in RRC_db2:
> > third <- merge(RRC_db1, RRC_db2) or  third <-subset(RRC_db1,
> CUSTOMER_ID%in%
> > RRC_db2$CUSTOMER_ID)
> >
> > But I also want to check if the CUSTOMER_RR is correct. I had tried
> this:
> >
> > > test <- function(RRC_db1,RRC_db2)
> > + {
> > + noteq <- c()
> > + for( i in 1:length(RRC_db1$CUSTOMER_ID)){
> > + for( j in 1:length(RRC_db2$CUSTOMER_ID)){
> > + if(RRC_db1$CUSTOMER_ID[i] == RRC_db2$CUSTOMER_ID[j]){
> > + if(RRC_db1$CUSTOMER_RR[i] != RRC_db2$CUSTOMER_RR[j]){
> > + noteq <- c(noteq,RRC_db1$CUSTOMER_ID[i]);
> > + }
> > + }
> > + }
> > + }
> > + noteq;
> > + }
> > >
> > > test(RRC_db1, RRC_db2)
> > Error in Ops.factor(RRC_db1$CUSTOMER_ID[i], RRC_db2$CUSTOMER_ID[j]) :
> > level sets of factors are different
> >
> >
> > But then I got this error.
> >
> > I don't only want the CUSTOMER_ID to be the same but also the
> CUSTOMER_RR.
> >
> > Can you please help me?
> >
> > Thanks in advance.
> >
> > Regards,
> >
> > Priya
> >
> >  [[alternative HTML version deleted]]
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Display problems X11 device

2006-11-07 Thread Nicolas Mazziotta
> Hello,
>
> I am running R Version 2.3.1 (2006-06-01) on Kubuntu Edgy Eft 6.10
> (problems appreared after upgrading from previous version, but I don't know
> which version of R was included then).
>
> I have very weird problems with X11 device: it seems that it cannot display
> correctly. For instance,
>
>  x<-1:10
>  plot(x)
>
> opens the X11 plotting window, but points are not displayed, only box
> tickmarks. The margin are missing too.

It seems to be an encoding problem: if I set 

 LC_ALL=C (I used UTF-8)

Plotting works well... But then, my data files (which are utf8) are not 
imported correctly any longer. Is it possible to use UTF-8, so that I don't 
have to change the environment before I launch R?

-- 
Nicolas Mazziotta

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plot questions?-errors in persp(x1, x2, y) and contour(x1, x2, y)

2006-11-07 Thread Uwe Ligges


zhijie zhang wrote:
> Dear Uwe Ligges ,
>  I still can't finish it.
> *> aa*   #my data
>x1 x2  y
> 50.05  6 4.4180
> 10.50  3 2.6979
> 40.50  9 2.9000
> 70.95  6 2.6230
> 80.95  6 2.9078
> 90.95  6 2.6727
> 31.40  3 2.4203
> 21.40  9 2.5329
> 6   1.85  6 2.4867
> *> attach(aa)*
> *> persp(x1,x2,y*
> error in persp.default(x1, x2, y) : increasing 'x' and 'y' values expected
> *> contour(x1,x2,y)*
> error in contour.default(x1, x2, y) : increasing 'x' and 'y' values 
> expected
> What's the problem? And could u recommend a book for me?
> Thanks again.


Well, your x and y coordinates must be equidistant and z a corresponding 
matrix. Please read the help files. If you cannot provide this data, a 
grid seems inappropriate.

For a book: Paul Murrell wrote some nice book about "R Graphics".

Uwe Ligges


> 
> On 11/7/06, Uwe Ligges <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> zhijie zhang wrote:
>> > Dear Rusers,
>> >   I want to know which function in R can perform the following tasks:
>> > 1.surface-data grid(x,y,z)  #which could be done in splus, the name was
>> from
>> > splus's options of graph
>> > 2. contourplot(x,y,z) #which could be done in splus
>> > By the way, where can i find some useful materials to learn to plot
>> > 3-dimensionel graphs?
>> > Thanks!
>> >
>>
>> 1. persp()
>> 2. contour()
>> 3. E.g., look into a good book about R.
>>
>> Uwe Ligges
>>
> 
> 
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Display problems X11 device

2006-11-07 Thread Nicolas Mazziotta
Hello,

I am running R Version 2.3.1 (2006-06-01) on Kubuntu Edgy Eft 6.10 (problems 
appreared after upgrading from previous version, but I don't know which 
version of R was included then).

I have very weird problems with X11 device: it seems that it cannot display 
correctly. For instance, 

 x<-1:10
 plot(x)

opens the X11 plotting window, but points are not displayed, only box 
tickmarks. The margin are missing too.

However, if I input

 dev.print(pdf)

R outputs a complete plot in a pdf file (with points, margins, etc.).

Any idea?

-- 
Nicolas Mazziotta

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plot questions?-errors in persp(x1, x2, y) and contour(x1, x2, y)

2006-11-07 Thread zhijie zhang
 Dear Uwe Ligges ,
  I still can't finish it.
*> aa*   #my data
x1 x2  y
50.05  6 4.4180
10.50  3 2.6979
40.50  9 2.9000
70.95  6 2.6230
80.95  6 2.9078
90.95  6 2.6727
31.40  3 2.4203
21.40  9 2.5329
6   1.85  6 2.4867
*> attach(aa)*
*> persp(x1,x2,y*
error in persp.default(x1, x2, y) : increasing 'x' and 'y' values expected
*> contour(x1,x2,y)*
error in contour.default(x1, x2, y) : increasing 'x' and 'y' values expected
What's the problem? And could u recommend a book for me?
Thanks again.


On 11/7/06, Uwe Ligges <[EMAIL PROTECTED]> wrote:
>
>
>
> zhijie zhang wrote:
> > Dear Rusers,
> >   I want to know which function in R can perform the following tasks:
> > 1.surface-data grid(x,y,z)  #which could be done in splus, the name was
> from
> > splus's options of graph
> > 2. contourplot(x,y,z) #which could be done in splus
> > By the way, where can i find some useful materials to learn to plot
> > 3-dimensionel graphs?
> > Thanks!
> >
>
> 1. persp()
> 2. contour()
> 3. E.g., look into a good book about R.
>
> Uwe Ligges
>



-- 
With Kind Regards,

oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:
[***]
Zhi Jie,Zhang ,PHD
Tel:86-21-54237149   [EMAIL PROTECTED]
Dept. of Epidemiology,school of public health,Fudan University
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
[***]
oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Re : Draw a circle with a given radius in an existing map

2006-11-07 Thread Arien Lam
A function that works for me, assuming the Earth is close 
enough to a sphere (which may or may not be true in your 
application), follows below.

Hope this helps, Arien

# computes the place where you end up, if you travel a 
certain distance along a great circle,
# which is uniquely defined by a point (your starting point)
# and an angle with the meridian at that point (your direction).
# the travelvector is actually a dataframe with at least the 
colums
# magnitude and direction.
# n.b. earth radius is the "ellipsoidal quadratic mean 
radius" of the earht, in m.

vectordestination <- function(lonlatpoint, travelvector) {
 Rearth <- 6372795
 Dd <- travelvector$magnitude / Rearth
 Cc <- travelvector$direction

 if (class(lonlatpoint) == "SpatialPoints") {
 lata <- coordinates(lonlatpoint)[1,2] * (pi/180)
 lona <- coordinates(lonlatpoint)[1,1] * (pi/180)
 }
 else {
 lata <- lonlatpoint[2] * (pi/180)
 lona <- lonlatpoint[1] * (pi/180)
 }
 latb <- asin(cos(Cc) * cos(lata) * sin(Dd) + sin(lata) 
* cos(Dd))
 dlon <- atan2(cos(Dd) - sin(lata) * sin(latb), sin(Cc) 
* sin(Dd) * cos(lata))
 lonb <- lona - dlon + pi/2

 lonb[lonb >  pi] <- lonb[lonb >  pi] - 2 * pi
 lonb[lonb < -pi] <- lonb[lonb < -pi] + 2 * pi

 latb <- latb * (180 / pi)
 lonb <- lonb * (180 / pi)

 cbind(longitude = lonb, latitude = latb)
}


# You can use this function to draw a circle with radius of 
ten kilometer around a point:

radius <- 1 # in meter
NewHaven <- c(-72.9,41.3) #c(lon,lat)
circlevector <- as.data.frame(cbind(direction = seq(0, 2*pi, 
by=2*pi/100), magnitude = radius))

mycircle <- vectordestination(NewHaven, circlevector)

plot(mycircle,type="l")





Roger Bivand schreef:
> On Tue, 7 Nov 2006, justin bem wrote:
> 
>> Try this :
>> >it<-seq(0,2*pi, l=100)
>> >xt<-r*cos(it)
>> >yt<-r*sin(it)
>> >points(xt,yt,type="l",col="blue")
>>
>> a circle of radium r is define by
>>xt=r*cos(t)
>>yt=r*sin(t) 
> 
> Isn't this suggestion on the plane, when the question was about finding
> the coordinates on the surface of the sphere (globe) in degrees of
> longitude and latitute that are x miles from the centre?
> 
> If the area is not large, then projecting the centre point to a suitable 
> planar projection, making the circle on the plane as above, and inverse 
> projecting back to geographical coordinates should work (function 
> project() in package rgdal). If the radius is in thousands of miles, the 
> projection distortion would be considerable, though.
> 
>> Justin BEM
>> Elève Ingénieur Statisticien Economiste
>> BP 294 Yaoundé.
>> Tél (00237)9597295.
>>
>>
>>
>> - Message d'origine 
>> De : Xiaomei Ma <[EMAIL PROTECTED]>
>> À : R-help@stat.math.ethz.ch
>> Envoyé le : Mardi, 7 Novembre 2006, 6h11mn 27s
>> Objet : [R] Draw a circle with a given radius in an existing map
>>
>>
>> I have drawn a map in which the X and Y axes are latitude and 
>> longitude. Now I need to draw one circle on the map - the center is a 
>> point with specific latitude and longitude, but the challenge is that 
>> the radius is in miles. Is there a way to do this? I'd very much 
>> appreciate your response.
>>
>> XM
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>  
>>
>>  
>>  
>> ___ 
>> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
>> Profitez des connaissances, des opinions et des expériences des internaut
>>
>>  [[alternative HTML version deleted]]
>>
>>
> 

-- 
drs. H.A. (Arien) Lam (Ph.D. student)
Department of Physical Geography
Faculty of Geosciences
Utrecht University, The Netherlands

E-mail: [EMAIL PROTECTED]
Web:http://www.geo.uu.nl/staff/a.lam

Telephone:  +31(0)30-253 2988 (direct), 2749 (secretary)
Fax:+31(0)30-2531145

Visiting address: Room Zon-121, Heidelberglaan 2, Utrecht
Postal address: P.O.Box 80.115, 3508 TC Utrecht

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Better way to create tables of mean & standard deviations

2006-11-07 Thread Benjamin Dickgiesser

Hi

I'm trying to create tables of means, standard deviations and numbers
of observations (i) for
each laboratory (ii) for each batch number (iii) for each batch at
each laboratory for the attached data.

I created these functions:
summary.aggregate <- function(y, label, ...)
{
temp.mean   <- aggregate(y, FUN=mean, ...)
temp.sd <- aggregate(y, FUN=sd, ...)
temp.length <- aggregate(y, FUN=length, ...)
txtlabs <-makeLabel(label,length(temp.mean$x))

temp <- 
data.frame(mean=temp.mean$x,stdev=temp.sd$x,n=temp.length$x,row.names=txtlabs)
}
makeLabel <- function(label,llength,increaseLag=FALSE)
{
x <- c()
for(cnt in 1:llength)
{
if(increaseLag == TRUE && mode(cnt/2))
{

}
x[cnt] <- paste(label,cnt)
}
x
}

and can use the following commands to create tables of means etc.

print(summary.aggregate(data.ceramic$Y,"Lab",by=list(data.ceramic$Lab)))

to create output like this:

 meanstdev  n
Lab 1 645.6125 65.94129 60
Lab 2 655.2121 70.64094 60
Lab 3 633.3161 80.48620 60
Lab 4 650.3897 77.59191 60
Lab 5 630.4955 84.9 60
Lab 6 656.2608 66.16100 60
Lab 7 666.1775 74.39796 60
Lab 8 663.1543 71.10769 60


The purpose of the first function is to calculate the mean, stdev etc.
and the second is simply to create a labelling vector e.g c(Lab1,
Lab2, ..., Lab 8)



This seems rather complex to me for what I am trying to achieve. Is
there a better way to do this?
Also I am having some trouble getting the labelling right for iii
since it should look like:

  Batchmeanstdev  n
Lab 1 1 686.7179 53.37582 30
Lab 1 2 695.8710 62.08583 30
Lab 2 1 654.5317 94.19746 30
Lab 2 2 702.9095 51.44984 30
Lab 3 1 676.2975 69.13784 30
Lab 3 2 692.1952 57.27212 30
Lab 4 1 700.8995 56.91608 30
Lab 4 2 702.5668 62.36488 30
Lab 5 1 604.5070 50.01621 30
Lab 52 614.5532 53.64149 30
Lab 61 612.1006 58.09503 30
Lab 6   2 597.8699 62.40710 30
Lab 71 584.6934 74.66537 30
Lab 72 620.3263 54.34871 30
Lab 81 631.4555 74.34480 30
Lab 8   2 623.7419 56.42492 30

Currentley I'm using:
temp <- 
summary.aggregate(data.ceramic$Y,"Lab",by=list(data.ceramic$Lab,data.ceramic$Batch))
batchcnt <- c(1,2)
print(data.frame(Batc=batchcnt,temp))

But that produces this output:
  Batc meanstdev  n
Lab 1 1 686.7179 53.37582 30
Lab 2 2 695.8710 62.08583 30
Lab 3 1 654.5317 94.19746 30
Lab 4 2 702.9095 51.44984 30
Lab 5 1 676.2975 69.13784 30
Lab 6 2 692.1952 57.27212 30
Lab 7 1 700.8995 56.91608 30
Lab 8 2 702.5668 62.36488 30
Lab 9 1 604.5070 50.01621 30
Lab 102 614.5532 53.64149 30
Lab 111 612.1006 58.09503 30
Lab 122 597.8699 62.40710 30
Lab 131 584.6934 74.66537 30
Lab 142 620.3263 54.34871 30
Lab 151 631.4555 74.34480 30
Lab 162 623.7419 56.42492 30

I can only think of  rather complex ways to solve the labeling issue...

I would appreciate it if someone could point out if there are
better/cleaner/easier ways of achieving what I'm trying todo.

Benjamin
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] question on multilevel modeling

2006-11-07 Thread Chuck Cleland
Christoph Buser wrote:
> Dear Christine
> 
> I think the problem in your second model is that you are
> including "CORUMTO" both as a fixed effect and as a random
> effect. 

  That by itself should not be a problem.  Here is an example in which
age appears in both the fixed and random part of a model:

> fm1 <- lme(distance ~ age, random = ~ age | Subject, data = Orthodont)

> fm1
Linear mixed-effects model fit by REML
  Data: Orthodont
  Log-restricted-likelihood: -221.3183
  Fixed: distance ~ age
(Intercept) age
 16.761   0.6601852

Random effects:
 Formula: ~age | Subject
 Structure: General positive-definite, Log-Cholesky parametrization
StdDevCorr
(Intercept) 2.3270340 (Intr)
age 0.2264278 -0.609
Residual1.3100397

Number of Observations: 108
Number of Groups: 27

  I think it's actually quite common to have the same variable appear in
the fixed and random parts of a model.
  Christine, to better understand what's happening it would be useful to
know a bit more about what BDIAFTER, BDI, WEEK, and CORUMTO are and see
the model summaries.  The fact that the error message depends on the
specific variables in the model may mean that one of the variables is a
linear combination of other variables.

> Regards,
> 
> Christoph 
> 
> --
> 
> Credit and Surety PML study: visit our web page www.cs-pml.org
> 
> --
> Christoph Buser <[EMAIL PROTECTED]>
> Seminar fuer Statistik, LEO C13
> ETH Zurich8092 Zurich  SWITZERLAND
> phone: x-41-44-632-4673   fax: 632-1228
> http://stat.ethz.ch/~buser/
> --
> 
> 
> Christine A. Calmes writes:
>  > Hi,
>  >  
>  > I am trying to run a multilevel model with time nested in people and
>  > people nested in dyads (3 levels of nesting) by initially running a
>  > series of models to test whether the slope/intercept should be fixed or
>  > random.  The problem that I am experiencing appears to arise between the
>  > random intercept, fixed slope equation AND.
>  >  
>  > (syntax:
>  > rint<-lme(BDIAFTER~BDI+WEEK+CORUMTO, random=~1|DYADID/PARTICIP,
>  > data=new) 
>  > summary(rint))
>  >  
>  > the random slope, random intercept model 
>  >  
>  > (syntax: 
>  > rslint<-lme(BDIAFTER~BDI+WEEK+CORUMTO, random=~CORUMTO|DYADID/PARTICIP,
>  > data=new) 
>  > summary(rslint))
>  >  
>  > at which point I obtain the exact same results for each model suggesting
>  > that one of the model is not properly specifying the slope or intercept.
>  >  
>  > Or, I receive the following error message when I try to run the random
>  > slope/random intercept model.
>  >  
>  > Error in solve.default(pdMatrix(a, fact = TRUE)) : 
>  > system is computationally singular: reciprocal condition number
>  > = 6.77073e-017
>  >  
>  > (whether I receive an error message or the same results depends on the
>  > specific variables in the model).
>  >  
>  > It has been suggested that I may need to change the default starting
>  > values in the model because I may be approaching a boundary-is this a
>  > plausible explanation for my difficulties?  If so, how do I do this in R
>  > and can you refer me to a source that might highlight what would be
>  > reasonable starting values?
>  > If this does not seem like the problem, any idea what the problem may be
>  > and how I might fix it?
>  >  
>  > Thank you so much for your assistance,
>  > Christine Calmes
>  >  
>  >  
>  > Christine A. Calmes, MA
>  > Dept of Psychology
>  > University at Buffalo: The State University of New York
>  > Park Hall 216
>  > Buffalo, NY 14260
>  > [EMAIL PROTECTED]
>  > (716) 645-3650 x578
>  >  
>  > 
>  >[[alternative HTML version deleted]]
>  > 
>  > __
>  > R-help@stat.math.ethz.ch mailing list
>  > https://stat.ethz.ch/mailman/listinfo/r-help
>  > PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
>  > and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Reformat a data frame

2006-11-07 Thread Thorsten Muehge

Hello Experts,
how do I reformat a data frame in the way described below:


df1:
IDdesc  resist  thick temp
1 4711  100   5 20
2 4712  101   4 21
3 4711  993 19
4 4712  987 22

TO

df2:
iddesc  Param Value
1 4711  resist  100
1 4711  Thick 5
1 4711  temp  20
2 4712  resist  101
2 4712  Thick 4
2 4712  temp  21
3 4711  resist  99
3 4711  thick 4
3 4711  temp  19
4 4712  resist  98
4 4712  thick 7
4 4712  temp  22

Thanks a lot for your help.
With best regards
Thorsten

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


  1   2   >