Odp: How to still processing despite bug errors?
Hi Look at function ?try Regards Petr r-help-bounces at r-project.org napsal dne 17.01.2011 21:57:42:
Hi, everybody. I am working processing EEG data from 1000 pacients. I have a specific syntax to perform the Spectral Analysis and a loop to analyse all
subjects.
each subject data are in separate folders (P1, P2 P3...) My question is: in some cases, some errors can appear in one subject. I
want
to know if is possible to jump to the next subject and perform the same syntax , exibiting an error like: Working on P1 Error "X" in P1 Working on P2... The idea is to let the computer processing continuosly all the subjects
and
at the end only see the problems in the subjects that R could not
perform
the analysis. Each Subject takes 20 minutes to perform the analysis and I don't want
to
stay days in front of PC, waiting for the next error in order to start
the
syntax again with the next subject. Any ideas? Thanks in Advance. Altay Lino de Souza. On Mon, Jan 17, 2011 at 9:00 AM, <r-help-request at r-project.org> wrote:
Send R-help mailing list submissions to
r-help at r-project.org
To subscribe or unsubscribe via the World Wide Web, visit
https://stat.ethz.ch/mailman/listinfo/r-help or, via email, send a message with subject or body 'help' to r-help-request at r-project.org You can reach the person managing the list at r-help-owner at r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of R-help digest..." Today's Topics: 1. Re: Displaying ylab in mfrow (Peter Ehlers) 2. Re: \examples{} in Rd file (Peter Ehlers) 3. Re: data prep question (Bill.Venables at csiro.au) 4. problem installing rgdal (alessandro.sarretta at inwind.it) 5. rootogram for normal distributions (Hugo Mildenberger) 6. Help in Coxme (Nelson Martins) 7. Re: how to add a derived column to a data frame? (Petr Savicky) 8. Re: \examples{} in Rd file (Prof Brian Ripley) 9. Re: Time and xts (Gabor Grothendieck) 10. Re: problem installing rgdal (Prof Brian Ripley) 11. Hausman Test (Holger Steinmetz) 12. Re: fgev_error_matrix_singular (Uwe Ligges) 13. transform a df with a condition (Patrick Hausmann) 14. Re: transform a df with a condition (Patrick Hausmann) 15. Re: rootogram for normal distributions (Achim Zeileis) 16. Re: Hausman Test (Achim Zeileis) 17. Re: rootogram for normal distributions (Hadley Wickham) 18. Re: transform a df with a condition (Henrique Dallazuanna) 19. Re: Hausman Test (Holger Steinmetz) 20. Re: transform a df with a condition (Duncan Murdoch) 21. Re: rootogram for normal distributions (Achim Zeileis) 22. Re: data prep question (Gabor Grothendieck) 23. Re: Hausman Test (Arne Henningsen) 24. Re: Hausman Test (Achim Zeileis) 25. Re: Hausman Test (Achim Zeileis) 26. Re: holding objects in dataframes (Uwe Ligges) 27. Re: Hausman Test (Arne Henningsen) 28. Re: Hausman Test (Holger Steinmetz) 29. ODD ODD ODD stuff!! (Freddy Gamma) 30. xyplot: modify axis tick marks (Kang Min) 31. Getting Synonyms using wordnet (Nick) 32. Re: ODD ODD ODD stuff!! (Sarah Goslee) 33. Re: xyplot: modify axis tick marks (Dennis Murphy) 34. Re: Random Effects Meta Regression (Viechtbauer Wolfgang (STAT)) 35. Re: ODD ODD ODD stuff!! (Jim Holtman) 36. Re: data prep question (rstrothe) 37. grid.table with head of two rows (victor) 38. Re: xyplot: modify axis tick marks (Gabor Grothendieck) 39. Re: data prep question (Hadley Wickham) 40. Re: xyplot: modify axis tick marks (Dennis Murphy) 41. Memory issues (Emmanuel Bellity) 42. Re: xyplot: modify axis tick marks (Hugo Mildenberger) 43. Please ask R questions on StackOverflow.com (Prasad Chalasani) 44. Re: Help in Coxme (Nelson Martins) 45. Re: rootogram for normal distributions (Hugo Mildenberger) 46. a remove question (Erin Hodgess) 47. Re: a remove question (David Winsemius) 48. Re: a remove question (Joshua Wiley) 49. Re: a remove question (David Winsemius) 50. Re: a remove question (Hugo Mildenberger) 51. Computing and Finding (ufuk beyaztas) 52. WORK AREA TO SAVE (Barbara.Rogo at uniroma1.it) 53. Re: WORK AREA TO SAVE (Duncan Murdoch) 54. Re: a remove question (Pete Brecknock) 55. Re: Memory issues (Chris Howden) 56. Re: how to calculate the consistency of different clusterings (Michael Bedward) 57. Re: ODD ODD ODD stuff!! (Sarah Goslee) 58. Re: rootogram for normal distributions (Deepayan Sarkar) 59. effects packages for mixed model? (array chip) 60. Using summaryBy with weighted data (Solomon Messing) 61. Re: Using summaryBy with weighted data (Joshua Wiley) 62. Equivalent to Stata egen tag (Denis Kazakevich) 63. data frame column name change (eric) 64. R looks for a folder not specified (l.chhay) 65. Re: Selecting the first occurrence of a value after an occurrence of a different value (surreyj) 66. Re: data frame column name change (Jorge Ivan Velez) 67. Re: R looks for a folder not specified (Jim Lemon) 68. Re: Truetype and Opentype font in pdf device (Prof Brian Ripley) 69. Finding NAs in DF (Johannes Graumann) 70. Re: Finding NAs in DF (Ivan Calandra) 71. Re: median by geometric mean (S Ellison) ---------------------------------------------------------------------- Message: 1 Date: Sun, 16 Jan 2011 03:40:40 -0800 From: Peter Ehlers <ehlers at ucalgary.ca> To: Kumar Mainali <kpmainali at gmail.com> Cc: "r-help at r-project.org" <r-help at r-project.org> Subject: Re: [R] Displaying ylab in mfrow Message-ID: <4D32D938.4080908 at ucalgary.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 2011-01-15 18:54, Kumar Mainali wrote: Dear R users, I cannot display ylab with the following code while trying to stack
7
rows
of 3 histograms each. Thanks in advance! par(mfrow=c(7,3)) par(mar=c(2,2,2,2)) par(oma=c(5,5,0,0)) with (newdata<- subset(table, Month1 == "1"), hist(newdata$CarapWid, breaks=5*(0:80), col="gray80", main="All individuals", xlab="", xlim =c(15,85), ylab="April 2007"))
Your code is neither reproducible nor minimal.
And it doesn't look as though it would produce
anything like what you seem to want.
I suspect that you may wish to look at ?title
and in particular at the 'ylab' and 'outer'
arguments.
Or you might consider using lattice or ggplot2.
Peter Ehlers
------------------------------
Message: 2
Date: Sun, 16 Jan 2011 03:46:12 -0800
From: Peter Ehlers <ehlers at ucalgary.ca>
To: Adelchi Azzalini <azzalini at stat.unipd.it>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Subject: Re: [R] \examples{} in Rd file
Message-ID: <4D32DA84.60002 at ucalgary.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Adelchi,
Since % is the LaTeX comment character, you may want to
try escaping it.
Peter Ehlers
On 2011-01-16 02:35, Adelchi Azzalini wrote:
[Hope this is the right list where to send...] An attempt to update package 'mnormt' involves the addition of a small new function called 'pd.solve'. When I come to the package checking stage, an error occurs in parsing pd.solve.Rd. The full transcript of the outcome is copied below (it includes
details
on my installation) but the critical point is where the \examples{}
section includes a %*%. The relevant portion of the source file is
\examples{
x<- toeplitz(rev(1:4))
x.inv<- pd.solve(x)
print(x.inv %*% x)
logDet<- attr(x.inv, "log.det")
print(abs(logDet - determinant(x, logarithm=TRUE)$modulus))
}
which leads to the message
### ** Examples
> > x<- toeplitz(rev(1:4)) > x.inv<- pd.solve(x) > print(x.inv
+ logDet<- attr(x.inv, "log.det")
Error: unexpected symbol in:
" print(x.inv
logDet"
When I install the package, it works, except that the documentation
portion looks like:
Examples
x<- toeplitz(rev(1:4))
x.inv<- pd.solve(x)
print(x.inv
logDet<- attr(x.inv, "log.det")
print(abs(logDet - determinant(x, logarithm=TRUE)$modulus))
It seems that the examples are parsed as ordinary text, not R
commands.
I am really puzzled. Any explanation? Adelchi Azzalini
[... snip ...]
------------------------------
Message: 3
Date: Sun, 16 Jan 2011 22:48:46 +1100
From: <Bill.Venables at csiro.au>
To: <rstrothe at gmail.com>, <r-help at r-project.org>
Subject: Re: [R] data prep question
Message-ID:
<
1BDAE2969943D540934EE8B4EF68F95FB27A48C274 at EXNSW-MBX03.nexus.csiro.au>
Content-Type: text/plain; charset="us-ascii"
Here is one way
Here is one way:
con <- textConnection("
+ ID TIME OBS + 001 2200 23 + 001 2400 11 + 001 3200 10 + 001 4500 22 + 003 3900 45 + 003 5605 32 + 005 1800 56 + 005 1900 34 + 005 2300 23")
dat <- read.table(con, header = TRUE,
+ colClasses = c("factor", "numeric", "numeric"))
closeAllConnections() tmp <- lapply(split(dat, dat$ID),
+ function(x) within(x, TIME <- TIME - min(TIME)))
split(dat, dat$ID) <- tmp dat
ID TIME OBS 1 001 0 23 2 001 200 11 3 001 1000 10 4 001 2300 22 5 003 0 45 6 003 1705 32 7 005 0 56 8 005 100 34 9 005 500 23
________________________________________ From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Matthew Strother [rstrothe at gmail.com] Sent: 16 January 2011 07:26 To: r-help at r-project.org Subject: [R] data prep question I have a data set with several thousand observations across time,
grouped
by subject (example format below) ID TIME OBS 001 2200 23 001 2400 11 001 3200 10 001 4500 22 003 3900 45 003 5605 32 005 1800 56 005 1900 34 005 2300 23 ... I would like to identify the first time for each subject, and then
subtract
this value from each subsequent time. However, the number of
observations
per subject varies widely (from 1 to 20), and the intervals between
times
varies widely. Is there a package that can help do this, or a loop
that
can be set up to evaluate ID, then calculate the values? The outcome
I
would like is presented below. ID TIME OBS 001 0 23 001 200 11 001 1000 10 001 2300 22 003 0 45 003 1705 32 005 0 56 005 100 34 005 500 23 ... Any help appreciated.
______________________________________________ R-help at r-project.org 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. ------------------------------ Message: 4 Date: Sun, 16 Jan 2011 11:28:13 +0100 (CET) From: "alessandro.sarretta at inwind.it" <alessandro.sarretta at inwind.it> To: r-help at r-project.org Subject: [R] problem installing rgdal Message-ID: <23477963.3728391295173693963.JavaMail.defaultUser at defaultHost> Content-Type: text/plain;charset="UTF-8" Dear R experts, I'm trying to install rgdal in my R 2.11.1 (Ubuntu 10.10). I have as an ouput the following messages. It seems that there are
problems
with libgdal1.7.0 or sqlite3... Could someboby help me? Thanks a lot! Ale
install.packages()
Warning in install.packages() : argument 'lib' is missing: using
'/home/ale/R/i686-pc-linux-gnu-library/2.
11' trying URL ' http://rm.mirror.garr.it/mirrors/CRAN/src/contrib/RSQLite_0.9-4. tar.gz' Content type 'application/x-gzip' length 1298948 bytes (1.2 Mb) opened URL ================================================== downloaded 1.2 Mb * installing *source* package ?RSQLite? ... checking for gcc... gcc -std=gnu99 checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for gcc... (cached) gcc -std=gnu99 checking whether we are using the GNU C compiler... (cached) yes checking whether gcc -std=gnu99 accepts -g... (cached) yes checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed checking for library containing fdatasync... none required configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -std=gnu99 -I/usr/share/R/include -DRSQLITE_USE_BUNDLED_SQLITE - DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS3
-DSQLITE_ENABLE_FTS3_PARENTHESIS
- DSQLITE_SOUNDEX -DTHREADSAFE=0 -fpic -g -O2 -c RS-DBI.c -o
RS-DBI.o
gcc -std=gnu99 -I/usr/share/R/include -DRSQLITE_USE_BUNDLED_SQLITE - DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS3
-DSQLITE_ENABLE_FTS3_PARENTHESIS
- DSQLITE_SOUNDEX -DTHREADSAFE=0 -fpic -g -O2 -c RS-SQLite.c -o RS-SQLite.o gcc -std=gnu99 -I/usr/share/R/include -DRSQLITE_USE_BUNDLED_SQLITE - DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS3
-DSQLITE_ENABLE_FTS3_PARENTHESIS
- DSQLITE_SOUNDEX -DTHREADSAFE=0 -fpic -g -O2 -c param_binding.c -o param_binding.o gcc -std=gnu99 -I/usr/share/R/include -DRSQLITE_USE_BUNDLED_SQLITE - DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS3
-DSQLITE_ENABLE_FTS3_PARENTHESIS
- DSQLITE_SOUNDEX -DTHREADSAFE=0 -fpic -g -O2 -c sqlite-all.c -o sqlite-all. o sqlite-all.c:1: warning: extra tokens at end of #ifdef directive mkdir -p ../inst/include cp sqlite/sqlite3.h ../inst/include cp sqlite/sqlite3ext.h ../inst/include gcc -std=gnu99 -shared -o RSQLite.so RS-DBI.o RS-SQLite.o
param_binding.o
sqlite-all.o -L/usr/lib/R/lib -lR
installing to /home/ale/R/i686-pc-linux-gnu-library/2.11/RSQLite/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
* DONE (RSQLite)
The downloaded packages are in
?/tmp/RtmprTwixW/downloaded_packages?
install.packages()
Warning in install.packages() : argument 'lib' is missing: using
'/home/ale/R/i686-pc-linux-gnu-library/2.
11' trying URL ' http://rm.mirror.garr.it/mirrors/CRAN/src/contrib/rgdal_0.6-33.tar. gz' Content type 'application/x-gzip' length 1422992 bytes (1.4 Mb) opened URL ================================================== downloaded 1.4 Mb * installing *source* package ?rgdal? ... gdal-config: gdal-config checking for gcc... gcc -std=gnu99 checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking proj_api.h usability... yes checking proj_api.h presence... yes checking for proj_api.h... yes checking for pj_init_plus in -lproj... yes /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_int' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_double'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_exec' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_column_text' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_double' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_blob' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_step' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_get_table' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_open' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_free_table' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_reset' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_bytes'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_column_blob' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_last_insert_rowid' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_column_name' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_prepare' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_column_int' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_finalize' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_text' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_count'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_close' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_decltype'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_column_type' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_errmsg' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_free' collect2: ld returned 1 exit status ./configure: line 3065: ./proj_conf_test: No such file or directory /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_int' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_double'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_exec' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_column_text' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_double' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_blob' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_step' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_get_table' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_open' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_free_table' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_reset' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_bytes'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_column_blob' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_last_insert_rowid' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_column_name' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_prepare' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_column_int' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_finalize' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_text' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_count'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_close' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_decltype'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_column_type' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_errmsg' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_free' collect2: ld returned 1 exit status ./configure: line 3099: ./proj_conf_test: No such file or directory Package CPP flags: -I/usr/include/gdal Package LIBS: -L/usr/lib -lgdal1.7.0 configure: creating ./config.status config.status: creating src/Makevars ** libs g++ -I/usr/share/R/include -I/usr/include/gdal -I"/home/ale/R/i686-pc-linux- gnu-library/2.11/sp/include" -fpic -g -O2 -c OGR_write.cpp -o OGR_write.o g++ -I/usr/share/R/include -I/usr/include/gdal -I"/home/ale/R/i686-pc-linux- gnu-library/2.11/sp/include" -fpic -g -O2 -c gdal-bindings.cpp -o
gdal-
bindings.o gcc -std=gnu99 -I/usr/share/R/include -I/usr/include/gdal -I"/home/ale/R/i686- pc-linux-gnu-library/2.11/sp/include" -fpic -g -O2 -c local_stubs.c
-o
local_stubs.o g++ -I/usr/share/R/include -I/usr/include/gdal -I"/home/ale/R/i686-pc-linux- gnu-library/2.11/sp/include" -fpic -g -O2 -c ogr_geom.cpp -o
ogr_geom.o
gcc -std=gnu99 -I/usr/share/R/include -I/usr/include/gdal -I"/home/ale/R/i686- pc-linux-gnu-library/2.11/sp/include" -fpic -g -O2 -c
ogr_polygons.c -o
ogr_polygons.o g++ -I/usr/share/R/include -I/usr/include/gdal -I"/home/ale/R/i686-pc-linux- gnu-library/2.11/sp/include" -fpic -g -O2 -c ogr_proj.cpp -o
ogr_proj.o
g++ -I/usr/share/R/include -I/usr/include/gdal -I"/home/ale/R/i686-pc-linux- gnu-library/2.11/sp/include" -fpic -g -O2 -c ogrdrivers.cpp -o ogrdrivers.o g++ -I/usr/share/R/include -I/usr/include/gdal -I"/home/ale/R/i686-pc-linux- gnu-library/2.11/sp/include" -fpic -g -O2 -c ogrsource.cpp -o ogrsource.o g++ -I/usr/share/R/include -I/usr/include/gdal -I"/home/ale/R/i686-pc-linux- gnu-library/2.11/sp/include" -fpic -g -O2 -c projectit.cpp -o projectit.o g++ -shared -o rgdal.so OGR_write.o gdal-bindings.o local_stubs.o ogr_geom.o ogr_polygons.o ogr_proj.o ogrdrivers.o ogrsource.o projectit.o
-L/usr/lib -
lgdal1.7.0 -lproj -L/usr/lib/R/lib -lR installing to /home/ale/R/i686-pc-linux-gnu-library/2.11/rgdal/libs ** R ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ... ** testing if installed package can be loaded Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared library
'/home/ale/R/i686-pc-linux-gnu-library/2.
11/rgdal/libs/rgdal.so':
/usr/lib/libgdal1.7.0.so.1: undefined symbol: sqlite3_bind_int
ERROR: loading failed
* removing ?/home/ale/R/i686-pc-linux-gnu-library/2.11/rgdal?
The downloaded packages are in
?/tmp/RtmprTwixW/downloaded_packages?
Warning message:
In install.packages() :
installation of package 'rgdal' had non-zero exit status
------------------------------
Message: 5
Date: Sun, 16 Jan 2011 11:45:27 +0100
From: Hugo Mildenberger <Hugo.Mildenberger at web.de>
To: r-help at r-project.org
Subject: [R] rootogram for normal distributions
Message-ID: <201101161145.28281.Hugo.Mildenberger at web.de>
Content-Type: text/plain; charset="us-ascii"
Using R-2.12.1 and latticeExtra-0.6-14, I would like to understand
why a rootogram displaying samples from the Poisson distribution looks
like
I expected it, whereas a rootogram using the normal distribution does
not:
library(latticeExtra) rootogram(~rpois(1000, lambda = 50), dfun = function(x) dpois(x,
lambda =
50)) rootogram(~rnorm(1000), dfun = function(x) dnorm(x,mean(x),sd(x))) I probably can't attach figures here. Thus a textual description of
what I
get may suffice: With increasing sample size, the rootogram using random
samples
from the Poisson distribution shows decreasing differences (bars are quickly approaching the zero line), whereas the displayed differences for
random
samples of the normal distribution are always large. The differences
even
increase
with sample size, i.e, the hanging bars tend to vanish for very large
samples.
------------------------------
Message: 6
Date: Sun, 16 Jan 2011 10:07:30 +0000
From: Nelson Martins <nelson.e.v.martins at gmail.com>
To: r-help at r-project.org
Subject: [R] Help in Coxme
Message-ID:
<AANLkTimQCz9bOm-b5XhgvKSDh7_cz71dVqiRf1mkMT-Z at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
I am a relative newbie to survival analysis and R in general, but
would like to use the coxme package to analyse some data I currently
have.
The data is relative to survival times of drosophila melanogaster
populations to infection with pathogens, and has the variables:
Time,
Status,
Treatment (4 treatments + 2 controls)
Population
Replicate
?and I'm currently using the following call
mixed<- coxme(formula = Surv(Time, Status) ~ strata(Treatment) + (1 |
Population/Replicate),x=T,y=T)
The treatments have very different mortality profiles, that's why I'm
using stratification.
I have several problems:
1 - I'm able to get the results, and to compare the different
treatments
using glht (e.g. - glht(mixed,mcp(Treatment="Tukey"))), only if I don't stratify the treatments 2 - I'm ?unable to plot the results as in other cox models (cph,coxph) using survplot/survfit. The other models don't allow specifying random variables (Populations and Replicates), which is of great importance to me. 3 - One other problem I'm having is in plotting the hazard curves (i.e. the instantaneous risk at each day). Is it possible to do it using these functions, hopefully with the associated standard errors? Thank you for your time and help Best regards Nelson Martins ------------------------------ Message: 7 Date: Sun, 16 Jan 2011 10:59:27 +0100 From: Petr Savicky <savicky at praha1.ff.cuni.cz> To: r-help at r-project.org Subject: Re: [R] how to add a derived column to a data frame? Message-ID: <20110116095927.GA6767 at praha1.ff.cuni.cz> Content-Type: text/plain; charset=us-ascii On Sun, Jan 16, 2011 at 03:01:49PM +0800, r-help wrote:
I have a data frame with 10 columns: A:J and I want to have the
output as
a data frame with 11 columns, the value of 11th column is??
for each row, if any column can be divided by 13, then the 11th
column
has a values of 1, otherwise, it has a value of 0. How to do that?
input is a=matrix(1:10000,1000,10) dimnames(a)=list(NULL,LETTERS[1:10])
I am sorry for an error in the previous solution for a general
matrix. It should be, for example
x <- as.numeric(rowSums(a %% 13 == 0) != 0)
b <- cbind(a, x)
or
x <- (rowSums(a %% 13 == 0) != 0) + 0
Petr Savicky.
------------------------------
Message: 8
Date: Sun, 16 Jan 2011 12:51:00 +0000 (GMT)
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
To: Peter Ehlers <ehlers at ucalgary.ca>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Subject: Re: [R] \examples{} in Rd file
Message-ID:
<alpine.LFD.2.00.1101161246530.10278 at gannet.stats.ox.ac.uk>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
On Sun, 16 Jan 2011, Peter Ehlers wrote:
Adelchi, Since % is the LaTeX comment character, you may want to try escaping it.
As package 'base' does at https://svn.r-project.org/R/trunk/src/library/base/man/matmult.Rd
Peter Ehlers On 2011-01-16 02:35, Adelchi Azzalini wrote:
[Hope this is the right list where to send...]
Either R-devel or this -- I would probably send questions about preparing packages to R-devel as you are more likely to catch the attention of active developers there.
An attempt to update package 'mnormt' involves the addition of a small new function called 'pd.solve'. When I come to the package checking stage, an error occurs in parsing pd.solve.Rd. The full transcript of the outcome is copied below (it includes
details
on my installation) but the critical point is where the \examples{}
section includes a %*%. The relevant portion of the source file is
\examples{
x<- toeplitz(rev(1:4))
x.inv<- pd.solve(x)
print(x.inv %*% x)
logDet<- attr(x.inv, "log.det")
print(abs(logDet - determinant(x, logarithm=TRUE)$modulus))
}
which leads to the message
### ** Examples
> > x<- toeplitz(rev(1:4)) > x.inv<- pd.solve(x) > print(x.inv
+ logDet<- attr(x.inv, "log.det")
Error: unexpected symbol in:
" print(x.inv
logDet"
When I install the package, it works, except that the documentation
portion looks like:
Examples
x<- toeplitz(rev(1:4))
x.inv<- pd.solve(x)
print(x.inv
logDet<- attr(x.inv, "log.det")
print(abs(logDet - determinant(x, logarithm=TRUE)$modulus))
It seems that the examples are parsed as ordinary text, not R
commands.
I am really puzzled. Any explanation? Adelchi Azzalini
[... snip ...]
______________________________________________ R-help at r-project.org 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. -- Brian D. Ripley, ripley at stats.ox.ac.uk 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, UK Fax: +44 1865 272595 ------------------------------ Message: 9 Date: Sun, 16 Jan 2011 08:03:53 -0500 From: Gabor Grothendieck <ggrothendieck at gmail.com> To: rnick <nikos.rachmanis at gmail.com> Cc: r-help at r-project.org Subject: Re: [R] Time and xts Message-ID: <AANLkTikAdjJ0pXVL-qcZMCWHqx5n3Q-Fs-JRj6MptgVJ at mail.gmail.com> Content-Type: text/plain; charset=windows-1252 On Sat, Jan 15, 2011 at 11:20 PM, rnick <nikos.rachmanis at gmail.com>
wrote:
Hi all, I have run into a problem and some help would be highly appreciated. I have a .csv with the following columns: Date ? ?Time ? ?Open ? ?High ? ?Low ? ? Close 1/2/2005 ? ? ? ?17:05 ? 1.3546 ?1.3553 ?1.3546 ?1.35495 1/2/2005 ? ? ? ?17:10 ? 1.3553 ?1.3556 ?1.3549 ?1.35525 1/2/2005 ? ? ? ?17:15 ? 1.3556 ?1.35565 1.35515 1.3553 1/2/2005 ? ? ? ?17:25 ? 1.355 ? ? ? ? ? 1.3556 ?1.355 ? ? ? ? ?
1.3555
?. ?.. 2/13/2006 ? ? ? 5:20 ? ?1.18895 1.18925 1.18835 1.1885 1) ? ? ?Without using zoo, xts or any other time series object, I am
trying to
run this code but fails to pass the argument to the function
#n is the length of the series
for (t in seq(from=10,to=n,by=1))
{
? ? ? ?while (time[t]=='02:00:00')
? ? ? ?{
? ? ? ? ? ? ? ?entrytrade(t)
? ? ? ?}
}
Is this possible to do? If yes, any ideas what I am doing wrong?
Posted code needs to be self contained and reproducible so that others can copy it from your post, paste it into R and see the same problem you are seeing. See last line to every r-help message.
2) ? ? ?I have also tried with xts by creating the object like this lines<-data.frame(date,time,open,high,low,close) z <- read.zoo(lines, header = TRUE, index = list(1, 2), FUN =
function(d,t)
as.POSIXct(paste(date,time), format = "%m/%d/%Y %H:%M")) x<-as.xts(z) However, I am unable to call just the time and run the above for
loop.
any
ideas here?
If by "calling" the time is intended to refer to "extracting" the time
then time(x) gives a vector of times.
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
------------------------------
Message: 10
Date: Sun, 16 Jan 2011 13:08:17 +0000 (GMT)
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
To: "alessandro.sarretta at inwind.it" <alessandro.sarretta at inwind.it>
Cc: r-help at r-project.org, Roger Bivand <Roger.Bivand at nhh.no>
Subject: Re: [R] problem installing rgdal
Message-ID:
<alpine.LFD.2.00.1101161251370.10278 at gannet.stats.ox.ac.uk>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
On Sun, 16 Jan 2011, alessandro.sarretta at inwind.it wrote:
Dear R experts, I'm trying to install rgdal in my R 2.11.1 (Ubuntu 10.10). I have as an ouput the following messages. It seems that there are
problems
with libgdal1.7.0 or sqlite3... Could someboby help me?
You would do better to ask on R-sig-geo for this particular package, and ask the maintainer or on R-devel more generally about installing source packages (see the posting guide). But - Your R is need of updating (see the posting guide) - GDAL 1.7.0 is really rather old - The bug seems to be in your libgdal installation: if libgdal was compiled with sqlite support, libgdal.so should be linked to libsqlite3. Do you have sqlite3 installed (not the RSQLite package, but the uduntu package)? If not, please install it. You can check for missing dependencies by (in the terminal) ldd /usr/lib/libgdal.so If 'libsqlite3.so.0' is not there, you need to modify rgdal (I know, because you need to do similar things with a static libgdal). On my Mac I need to alter rgdal/src/Makevars.in to be PKG_LIBS=@PKG_LIBS@ -lproj -lsqlite3 -lexpat -ltiff -ljpeg -lpng -lz
-ldl
-lcurl -lssl -lcrypto -lz and so I guess you need at least PKG_LIBS=@PKG_LIBS@ -lsqlite3 But because GDAL can be installed with lots of optional facilities (one of which is sqlite3), you may need to ask Ubuntu support for exactly what is needed to link against their build. Or compile current GDAL from the sources for yourself.
Thanks a lot! Ale
install.packages()
Warning in install.packages() : argument 'lib' is missing: using
'/home/ale/R/i686-pc-linux-gnu-library/2.
11' trying URL '
tar.gz' Content type 'application/x-gzip' length 1298948 bytes (1.2 Mb) opened URL ================================================== downloaded 1.2 Mb * installing *source* package ?RSQLite? ... checking for gcc... gcc -std=gnu99 checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for gcc... (cached) gcc -std=gnu99 checking whether we are using the GNU C compiler... (cached) yes checking whether gcc -std=gnu99 accepts -g... (cached) yes checking for gcc -std=gnu99 option to accept ISO C89... (cached)
none
needed
checking for library containing fdatasync... none required configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -std=gnu99 -I/usr/share/R/include -DRSQLITE_USE_BUNDLED_SQLITE - DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS3
-DSQLITE_ENABLE_FTS3_PARENTHESIS -
DSQLITE_SOUNDEX -DTHREADSAFE=0 -fpic -g -O2 -c RS-DBI.c -o
RS-DBI.o
gcc -std=gnu99 -I/usr/share/R/include -DRSQLITE_USE_BUNDLED_SQLITE - DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS3
-DSQLITE_ENABLE_FTS3_PARENTHESIS -
DSQLITE_SOUNDEX -DTHREADSAFE=0 -fpic -g -O2 -c RS-SQLite.c -o
RS-SQLite.o
gcc -std=gnu99 -I/usr/share/R/include -DRSQLITE_USE_BUNDLED_SQLITE - DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS3
-DSQLITE_ENABLE_FTS3_PARENTHESIS -
DSQLITE_SOUNDEX -DTHREADSAFE=0 -fpic -g -O2 -c param_binding.c
-o
param_binding.o gcc -std=gnu99 -I/usr/share/R/include -DRSQLITE_USE_BUNDLED_SQLITE - DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS3
-DSQLITE_ENABLE_FTS3_PARENTHESIS -
DSQLITE_SOUNDEX -DTHREADSAFE=0 -fpic -g -O2 -c sqlite-all.c -o
sqlite-all.
o sqlite-all.c:1: warning: extra tokens at end of #ifdef directive mkdir -p ../inst/include cp sqlite/sqlite3.h ../inst/include cp sqlite/sqlite3ext.h ../inst/include gcc -std=gnu99 -shared -o RSQLite.so RS-DBI.o RS-SQLite.o
param_binding.o
sqlite-all.o -L/usr/lib/R/lib -lR installing to
/home/ale/R/i686-pc-linux-gnu-library/2.11/RSQLite/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
* DONE (RSQLite)
The downloaded packages are in
?/tmp/RtmprTwixW/downloaded_packages?
install.packages()
Warning in install.packages() : argument 'lib' is missing: using
'/home/ale/R/i686-pc-linux-gnu-library/2.
11' trying URL '
gz' Content type 'application/x-gzip' length 1422992 bytes (1.4 Mb) opened URL ================================================== downloaded 1.4 Mb * installing *source* package ?rgdal? ... gdal-config: gdal-config checking for gcc... gcc -std=gnu99 checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking proj_api.h usability... yes checking proj_api.h presence... yes checking for proj_api.h... yes checking for pj_init_plus in -lproj... yes /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_int' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_double'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_exec' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_text'
/usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_bind_double'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_blob' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_step' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_get_table' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_open' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_free_table'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_reset' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_bytes'
/usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_blob'
/usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_last_insert_rowid'
/usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_name'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_prepare' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_int'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_finalize' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_text' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_count'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_close' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_decltype'
/usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_type'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_errmsg' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_free' collect2: ld returned 1 exit status ./configure: line 3065: ./proj_conf_test: No such file or directory /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_int' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_double'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_exec' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_text'
/usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_bind_double'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_blob' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_step' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_get_table' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_open' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_free_table'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_reset' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_bytes'
/usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_blob'
/usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_last_insert_rowid'
/usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_name'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_prepare' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_int'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_finalize' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_bind_text' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_count'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_close' /usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_decltype'
/usr/lib/libgdal1.7.0.so: undefined reference to
`sqlite3_column_type'
/usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_errmsg' /usr/lib/libgdal1.7.0.so: undefined reference to `sqlite3_free' collect2: ld returned 1 exit status ./configure: line 3099: ./proj_conf_test: No such file or directory Package CPP flags: -I/usr/include/gdal Package LIBS: -L/usr/lib -lgdal1.7.0 configure: creating ./config.status config.status: creating src/Makevars ** libs g++ -I/usr/share/R/include -I/usr/include/gdal
-I"/home/ale/R/i686-pc-linux-
gnu-library/2.11/sp/include" -fpic -g -O2 -c OGR_write.cpp -o
OGR_write.o
g++ -I/usr/share/R/include -I/usr/include/gdal
-I"/home/ale/R/i686-pc-linux-
gnu-library/2.11/sp/include" -fpic -g -O2 -c gdal-bindings.cpp -o
gdal-
bindings.o gcc -std=gnu99 -I/usr/share/R/include -I/usr/include/gdal
-I"/home/ale/R/i686-
pc-linux-gnu-library/2.11/sp/include" -fpic -g -O2 -c
local_stubs.c -o
local_stubs.o g++ -I/usr/share/R/include -I/usr/include/gdal
-I"/home/ale/R/i686-pc-linux-
gnu-library/2.11/sp/include" -fpic -g -O2 -c ogr_geom.cpp -o
ogr_geom.o
gcc -std=gnu99 -I/usr/share/R/include -I/usr/include/gdal
-I"/home/ale/R/i686-
pc-linux-gnu-library/2.11/sp/include" -fpic -g -O2 -c
ogr_polygons.c
-o
ogr_polygons.o g++ -I/usr/share/R/include -I/usr/include/gdal
-I"/home/ale/R/i686-pc-linux-
gnu-library/2.11/sp/include" -fpic -g -O2 -c ogr_proj.cpp -o
ogr_proj.o
g++ -I/usr/share/R/include -I/usr/include/gdal
-I"/home/ale/R/i686-pc-linux-
gnu-library/2.11/sp/include" -fpic -g -O2 -c ogrdrivers.cpp -o
ogrdrivers.o
g++ -I/usr/share/R/include -I/usr/include/gdal
-I"/home/ale/R/i686-pc-linux-
gnu-library/2.11/sp/include" -fpic -g -O2 -c ogrsource.cpp -o
ogrsource.o
g++ -I/usr/share/R/include -I/usr/include/gdal
-I"/home/ale/R/i686-pc-linux-
gnu-library/2.11/sp/include" -fpic -g -O2 -c projectit.cpp -o
projectit.o
g++ -shared -o rgdal.so OGR_write.o gdal-bindings.o local_stubs.o
ogr_geom.o
ogr_polygons.o ogr_proj.o ogrdrivers.o ogrsource.o projectit.o
-L/usr/lib
-
lgdal1.7.0 -lproj -L/usr/lib/R/lib -lR installing to /home/ale/R/i686-pc-linux-gnu-library/2.11/rgdal/libs ** R ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ... ** testing if installed package can be loaded Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared library
'/home/ale/R/i686-pc-linux-gnu-library/2.
11/rgdal/libs/rgdal.so':
/usr/lib/libgdal1.7.0.so.1: undefined symbol: sqlite3_bind_int
ERROR: loading failed
* removing ?/home/ale/R/i686-pc-linux-gnu-library/2.11/rgdal?
The downloaded packages are in
?/tmp/RtmprTwixW/downloaded_packages?
Warning message:
In install.packages() :
installation of package 'rgdal' had non-zero exit status
______________________________________________ R-help at r-project.org 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. -- Brian D. Ripley, ripley at stats.ox.ac.uk 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, UK Fax: +44 1865 272595 ------------------------------ Message: 11 Date: Sun, 16 Jan 2011 06:07:08 -0800 (PST) From: Holger Steinmetz <Holger.steinmetz at web.de> To: r-help at r-project.org Subject: [R] Hausman Test Message-ID: <1295186828415-3220016.post at n4.nabble.com> Content-Type: text/plain; charset=us-ascii Hi, can anybody tell me how the Hausman test for endogenty works? I have a simulated model with three correlated predictors (X1-X3). I
also
have an instrument W for X1 Now I want to test for endogeneity of X1 (i.e., when I omit X2 and X3
from
the equation). My current approach: library(systemfit) fit2sls <- systemfit(Y~X1,data=data,method="2SLS",inst=~W) fitOLS <- systemfit(Y~X1,data=data,method="OLS") print(hausman.systemfit(fitOLS, fit2sls)) This seems to work fine. However, when I include X2 as a furter
predictor,
the 2sls-estimation doesn't work. Thanks in advance Holger -- View this message in context: http://r.789695.n4.nabble.com/Hausman-Test-tp3220016p3220016.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 12 Date: Sun, 16 Jan 2011 15:10:41 +0100 From: Uwe Ligges <ligges at statistik.tu-dortmund.de> To: Jinrui Xu <jinruixu at umich.edu> Cc: r-help at r-project.org Subject: Re: [R] fgev_error_matrix_singular Message-ID: <4D32FC61.5070606 at statistik.tu-dortmund.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed See ?try in order to get the automated process going and for ignoring
or
separately post-processing stuff where the method does not work. Uwe Ligges On 15.01.2011 21:48, Jinrui Xu wrote:
Hello everyone, I am using fgev from evd package to fitting my data with general
extreme
value distribution. The command I used is simple: y <- fgev(x). The error is "observed information matrix is singular;" How can I
solve
these problem. I tried all methods in optim and it did not work. I
fixed
values for scale, location and shape. This works, but I have lots of different dataset to fit, so is there any automatic ways to solve
the
error? Thanks! jinrui,
______________________________________________ R-help at r-project.org 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.
------------------------------
Message: 13
Date: Sun, 16 Jan 2011 15:13:19 +0100
From: Patrick Hausmann <patrick.hausmann at uni-bremen.de>
To: r-help at r-project.org
Subject: [R] transform a df with a condition
Message-ID: <4D32FCFF.7010002 at uni-bremen.de>
Content-Type: text/plain; charset=UTF-8; format=flowed
Dear all,
for each A == 3 in 'df' I would like to change the variables B and K.
My result should be the whole df and not the subset (A==3)...
df <- data.frame(A = c(1,1,3,2,2,3,3),
B = c(2,1,1,2,7,8,7),
K = c("a.1", "d.2", "f.3",
"a.1", "k.4", "f.9", "f.5"))
x1 <- within(df[df$A ==3, ], {
B1 <- 5
K1 <- gsub("f","m", K)
})
x2 <- transform(df[df$A==3, ], B1 = 5, K1 = gsub("f","m", K))
Thanks for any help!
Patrick
------------------------------
Message: 14
Date: Sun, 16 Jan 2011 15:19:01 +0100
From: Patrick Hausmann <patrick.hausmann at uni-bremen.de>
To: r-help at r-project.org
Subject: Re: [R] transform a df with a condition
Message-ID: <4D32FE55.3040204 at uni-bremen.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Arrg, sorry - of course I don't want *new* variables. So this is my
correct example:
df <- data.frame(A = c(1,1,3,2,2,3,3),
B = c(2,1,1,2,7,8,7),
K = c("a.1", "d.2", "f.3",
"a.1", "k.4", "f.9", "f.5"))
x1 <- within(df[df$A ==3, ], {
B <- 5
K <- gsub("f","m", K)
})
x2 <- transform(df[df$A==3, ], B = 5, K = gsub("f","m", K))
Thanks
Patrick
Am 16.01.2011 15:13, schrieb Patrick Hausmann:
Dear all, for each A == 3 in 'df' I would like to change the variables B and
K.
My result should be the whole df and not the subset (A==3)...
df <- data.frame(A = c(1,1,3,2,2,3,3),
B = c(2,1,1,2,7,8,7),
K = c("a.1", "d.2", "f.3",
"a.1", "k.4", "f.9", "f.5"))
x1 <- within(df[df$A ==3, ], {
B1 <- 5
K1 <- gsub("f","m", K)
})
x2 <- transform(df[df$A==3, ], B1 = 5, K1 = gsub("f","m", K))
Thanks for any help!
Patrick
______________________________________________ R-help at r-project.org 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.
------------------------------ Message: 15 Date: Sun, 16 Jan 2011 15:28:58 +0100 (CET) From: Achim Zeileis <Achim.Zeileis at uibk.ac.at> To: Hugo Mildenberger <Hugo.Mildenberger at web.de> Cc: r-help at r-project.org Subject: Re: [R] rootogram for normal distributions Message-ID: <alpine.DEB.2.00.1101161526120.22514 at paninaro.uibk.ac.at> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Sun, 16 Jan 2011, Hugo Mildenberger wrote:
Using R-2.12.1 and latticeExtra-0.6-14, I would like to understand why a rootogram displaying samples from the Poisson distribution
looks
like I
expected it, whereas a rootogram using the normal distribution does
not:
library(latticeExtra) rootogram(~rpois(1000, lambda = 50), dfun = function(x) dpois(x,
lambda =
50))
rootogram(~rnorm(1000), dfun = function(x) dnorm(x,mean(x),sd(x))) I probably can't attach figures here. Thus a textual description of
what
I get may suffice: With increasing sample size, the rootogram using random samples from the Poisson distribution shows decreasing differences (bars are quickly approaching the zero line), whereas
the
displayed differences for random samples of the normal distribution
are
always large. The differences even increase with sample size, i.e,
the
hanging bars tend to vanish for very large samples.
The normal distribution is a continuous distribution, i.e., the
frequency
for each observed value will essentially be 1/n and not converge to
the
density function. Hence, you would need to look at histogram or
smoothed
densities. Rootograms, on the other hand, are intended for discrete distributions. Z
______________________________________________ R-help at r-project.org 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. ------------------------------ Message: 16 Date: Sun, 16 Jan 2011 15:39:16 +0100 (CET) From: Achim Zeileis <Achim.Zeileis at uibk.ac.at> To: Holger Steinmetz <Holger.steinmetz at web.de> Cc: r-help at r-project.org Subject: Re: [R] Hausman Test Message-ID: <alpine.DEB.2.00.1101161534270.22514 at paninaro.uibk.ac.at> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Sun, 16 Jan 2011, Holger Steinmetz wrote: Hi, can anybody tell me how the Hausman test for endogenty works? I have a simulated model with three correlated predictors (X1-X3). I
also
have an instrument W for X1 Now I want to test for endogeneity of X1 (i.e., when I omit X2 and
X3
from
the equation). My current approach: library(systemfit) fit2sls <- systemfit(Y~X1,data=data,method="2SLS",inst=~W) fitOLS <- systemfit(Y~X1,data=data,method="OLS") print(hausman.systemfit(fitOLS, fit2sls)) This seems to work fine. However, when I include X2 as a furter
predictor,
the 2sls-estimation doesn't work.
When you don't need any instruments for X2, then you should employ Y ~ X1 + X2, inst = ~ W + X2 Then, regressor X2 is unaltered in the second stage of the regression (after projection onto the instruments). hth, Z
Thanks in advance Holger -- View this message in context:
Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org 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. ------------------------------ Message: 17 Date: Sun, 16 Jan 2011 08:44:14 -0600 From: Hadley Wickham <hadley at rice.edu> To: Achim Zeileis <Achim.Zeileis at uibk.ac.at> Cc: r-help at r-project.org Subject: Re: [R] rootogram for normal distributions Message-ID: <AANLkTik6qAwA+131E4gt-==iSe0Pw=dhvbusMKB71ct7 at mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 The normal distribution is a continuous distribution, i.e., the
frequency
for each observed value will essentially be 1/n and not converge to
the
density function. Hence, you would need to look at histogram or
smoothed
densities. Rootograms, on the other hand, are intended for discrete distributions.
I don't think that's true - rootograms are useful for both continuous and discrete distributions. See (e.g.) p 314 at http://www.edwardtufte.com/tufte/tukey, where Tukey himself uses a rootogram with a normal distribution. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ------------------------------ Message: 18 Date: Sun, 16 Jan 2011 12:52:31 -0200 From: Henrique Dallazuanna <wwwhsd at gmail.com> To: Patrick Hausmann <patrick.hausmann at uni-bremen.de> Cc: r-help at r-project.org Subject: Re: [R] transform a df with a condition Message-ID: <AANLkTinfkPn_vYTdCdL-3-7=VRjF3Y-z5moFJWCC-MoO at mail.gmail.com> Content-Type: text/plain Try this: df[df$A == 3, c('B', 'K')] <- with(df[df$A == 3, c('B', 'K')],
cbind(5,
gsub("f", "m", K)))
On Sun, Jan 16, 2011 at 12:19 PM, Patrick Hausmann <
patrick.hausmann at uni-bremen.de> wrote:
Arrg, sorry - of course I don't want *new* variables. So this is my
correct
example:
df <- data.frame(A = c(1,1,3,2,2,3,3),
B = c(2,1,1,2,7,8,7),
K = c("a.1", "d.2", "f.3",
"a.1", "k.4", "f.9", "f.5"))
x1 <- within(df[df$A ==3, ], {
B <- 5
K <- gsub("f","m", K)
})
x2 <- transform(df[df$A==3, ], B = 5, K = gsub("f","m", K))
Thanks
Patrick
Am 16.01.2011 15:13, schrieb Patrick Hausmann:
Dear all,
for each A == 3 in 'df' I would like to change the variables B and
K.
My result should be the whole df and not the subset (A==3)...
df <- data.frame(A = c(1,1,3,2,2,3,3),
B = c(2,1,1,2,7,8,7),
K = c("a.1", "d.2", "f.3",
"a.1", "k.4", "f.9", "f.5"))
x1 <- within(df[df$A ==3, ], {
B1 <- 5
K1 <- gsub("f","m", K)
})
x2 <- transform(df[df$A==3, ], B1 = 5, K1 = gsub("f","m", K))
Thanks for any help!
Patrick
______________________________________________ R-help at r-project.org 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 at r-project.org 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.
--
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O
[[alternative HTML version deleted]]
------------------------------
Message: 19
Date: Sun, 16 Jan 2011 06:53:17 -0800 (PST)
From: Holger Steinmetz <Holger.steinmetz at web.de>
To: r-help at r-project.org
Subject: Re: [R] Hausman Test
Message-ID: <1295189597126-3220065.post at n4.nabble.com>
Content-Type: text/plain; charset=us-ascii
Dear Achim,
thank you very much.
One follow up question. The Hausman-test always gives me a p-value of
1 -
no
matter
how small the statistic is.
I now generated orthogonal regressors (X1-X3) and the test gives me
Hausman specification test for consistency of the 3SLS
estimation
data: data Hausman = -0.0138, df = 2, p-value = 1 What is confusing to me is the "3SLS". I am just beginning to learn
about
instrumental variables (I am a psychologist ;) Perhaps that's a
problem?
As a background, here's the complete simulation: W = rnorm(1000) X2 = rnorm(1000) X3 = rnorm(1000) X1 = .5*W + rnorm(1000) Y = .4*X1 + .5*X2 + .6*X3 + rnorm(1000) data = as.data.frame(cbind(X1,X2,X3,Y,W)) fit2sls <- systemfit(Y~X1,data=data,method="2SLS",inst=~W) fitOLS <- systemfit(Y~X1,data=data,method="OLS") print(hausman.systemfit(fitOLS, fit2sls)) Best, Holger -- View this message in context: http://r.789695.n4.nabble.com/Hausman-Test-tp3220016p3220065.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 20 Date: Sun, 16 Jan 2011 09:53:54 -0500 From: Duncan Murdoch <murdoch.duncan at gmail.com> To: Patrick Hausmann <patrick.hausmann at uni-bremen.de> Cc: r-help at r-project.org Subject: Re: [R] transform a df with a condition Message-ID: <4D330682.8000906 at gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 16/01/2011 9:13 AM, Patrick Hausmann wrote:
> Dear all, > > for each A == 3 in 'df' I would like to change the variables B and
K.
> My result should be the whole df and not the subset (A==3)...
>
> df<- data.frame(A = c(1,1,3,2,2,3,3),
> B = c(2,1,1,2,7,8,7),
> K = c("a.1", "d.2", "f.3",
> "a.1", "k.4", "f.9", "f.5"))
>
> x1<- within(df[df$A ==3, ], {
This is the problem: you've subsetted the dataset here, and lost all
the other lines. You want something like this:
x3 <- within(df, {
B <- ifelse(A == 3, 5, B)
K <- ifelse(A == 3, gsub("f", "m", K), as.character(K))
}
)
You need the "as.character" as by default K will be a factor, not a
character vector, and ifelse will take the factor level instead of the
label.
If the condition was more complicated than A == 3, you might want to
calculate it first and use the calculated value each time:
x3 <- within(df, {
changes <- A == 3
B <- ifelse(changes, 5, B)
K <- ifelse(changes, gsub("f", "m", K),
as.character(K))
rm(changes)
}
)
> B1<- 5
> K1<- gsub("f","m", K)
> })
>
> x2<- transform(df[df$A==3, ], B1 = 5, K1 = gsub("f","m", K))
>
> Thanks for any help!
> Patrick
>
> ______________________________________________
> R-help at r-project.org 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. ------------------------------ Message: 21 Date: Sun, 16 Jan 2011 15:59:58 +0100 (CET) From: Achim Zeileis <Achim.Zeileis at uibk.ac.at> To: Hadley Wickham <hadley at rice.edu> Cc: r-help at r-project.org Subject: Re: [R] rootogram for normal distributions Message-ID: <alpine.DEB.2.00.1101161557470.22514 at paninaro.uibk.ac.at> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Sun, 16 Jan 2011, Hadley Wickham wrote: The normal distribution is a continuous distribution, i.e., the frequency for each observed value will essentially be 1/n and not converge to
the
density function. Hence, you would need to look at histogram or
smoothed
densities. Rootograms, on the other hand, are intended for discrete distributions.
I don't think that's true - rootograms are useful for both
continuous
and discrete distributions. See (e.g.) p 314 at http://www.edwardtufte.com/tufte/tukey, where Tukey himself uses a rootogram with a normal distribution.
OK, let me rephrase: Rootograms as implemented in rootogram() are
intended
for discrete distributions. At least that's my reading. But maybe I've missed a trick that you can point us to. Z
Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
______________________________________________ R-help at r-project.org 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. ------------------------------ Message: 22 Date: Sun, 16 Jan 2011 10:04:07 -0500 From: Gabor Grothendieck <ggrothendieck at gmail.com> To: Matthew Strother <rstrothe at gmail.com> Cc: r-help at r-project.org Subject: Re: [R] data prep question Message-ID: <AANLkTimqB4wh9sNJhs1-MSsSvPCVB=c0j1-M8A7XxJQr at mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 On Sat, Jan 15, 2011 at 4:26 PM, Matthew Strother <rstrothe at gmail.com> wrote: I have a data set with several thousand observations across time,
grouped
by subject (example format below)
ID ? ? ? ? ? ? ?TIME ? ?OBS 001 ? ? ? ? ? ? 2200 ? ?23 001 ? ? ? ? ? ? 2400 ? ?11 001 ? ? ? ? ? ? 3200 ? ?10 001 ? ? ? ? ? ? 4500 ? ?22 003 ? ? ? ? ? ? 3900 ? ?45 003 ? ? ? ? ? ? 5605 ? ?32 005 ? ? ? ? ? ? 1800 ? ?56 005 ? ? ? ? ? ? 1900 ? ?34 005 ? ? ? ? ? ? 2300 ? ?23 ... I would like to identify the first time for each subject, and then
subtract this value from each subsequent time. ?However, the number of observations per subject varies widely (from 1 to 20), and the
intervals
between times varies widely. ? Is there a package that can help do
this, or
a loop that can be set up to evaluate ID, then calculate the values?
?The
outcome I would like is presented below.
ID ? ? ? ? ? ? ?TIME ? ?OBS 001 ? ? ? ? ? ? 0 ? ? ? ? ? ? ? 23 001 ? ? ? ? ? ? 200 ? ? ? ? ? ? 11 001 ? ? ? ? ? ? 1000 ? ?10 001 ? ? ? ? ? ? 2300 ? ?22 003 ? ? ? ? ? ? 0 ? ? ? ? ? ? ? 45 003 ? ? ? ? ? ? 1705 ? ?32 005 ? ? ? ? ? ? 0 ? ? ? ? ? ? ? 56 005 ? ? ? ? ? ? 100 ? ? ? ? ? ? 34 005 ? ? ? ? ? ? 500 ? ? ? ? ? ? 23
Since the data frame appears to be already sorted by time within ID we can do this:
transform(DF, OBS = ave(OBS, ID, FUN = function(x) x - x[1]))
ID TIME OBS
1 1 2200 0
2 1 2400 -12
3 1 3200 -13
4 1 4500 -1
5 3 3900 0
6 3 5605 -13
7 5 1800 0
8 5 1900 -22
9 5 2300 -33
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
------------------------------
Message: 23
Date: Sun, 16 Jan 2011 16:28:15 +0100
From: Arne Henningsen <arne.henningsen at googlemail.com>
To: Holger Steinmetz <Holger.steinmetz at web.de>
Cc: r-help at r-project.org
Subject: Re: [R] Hausman Test
Message-ID:
<AANLkTimL2hvb7sfpJSU4hRjVzUM
+m5w0RQcW4ahTzVpa at mail.gmail.com<AANLkTimL2hvb7sfpJSU4hRjVzUM% 2Bm5w0RQcW4ahTzVpa at mail.gmail.com>
Content-Type: text/plain; charset=windows-1252 Hi Holger! On 16 January 2011 15:53, Holger Steinmetz <Holger.steinmetz at web.de> wrote:
One follow up question. The Hausman-test always gives me a p-value
of 1 -
no
matter how small the statistic is. I now generated orthogonal regressors (X1-X3) and the test gives me ? ? ? ?Hausman specification test for consistency of the 3SLS
estimation
data: ?data Hausman = -0.0138, df = 2, p-value = 1 What is confusing to me is the "3SLS". I am just beginning to learn
about
instrumental variables (I am a psychologist ;) Perhaps that's a
problem?
As a background, here's the complete simulation: W = rnorm(1000) X2 = rnorm(1000) X3 = rnorm(1000) X1 = .5*W ?+ rnorm(1000) Y = .4*X1 + .5*X2 + .6*X3 + rnorm(1000) data = as.data.frame(cbind(X1,X2,X3,Y,W)) fit2sls <- systemfit(Y~X1,data=data,method="2SLS",inst=~W) fitOLS <- systemfit(Y~X1,data=data,method="OLS") print(hausman.systemfit(fitOLS, fit2sls))
Please do read the documentation of hausman.systemfit(). I regret that
comparing 2SLS with OLS results has not been implemented yet:
====== part of documentation of hausman.systemfit() =================
Usage:
hausman.systemfit( results2sls, results3sls )
Arguments:
results2sls : result of a _2SLS_ (limited information) estimation
returned by ?systemfit?.
results3sls : result of a _3SLS_ (full information) estimation
returned by ?systemfit?.
Details:
The null hypotheses of the test is that all exogenous variables
are uncorrelated with all disturbance terms. Under this
hypothesis both the 2SLS and the 3SLS estimator are consistent but
only the 3SLS estimator is (asymptotically) efficient. Under the
alternative hypothesis the 2SLS estimator is consistent but the
3SLS estimator is inconsistent.
The Hausman test statistic is
m = ( b_2 - b_3 )' ( V_2 - V_3 ) ( b_2 - b_3 )
where $b_2$ and $V_2$ are the estimated coefficients and their
variance covariance matrix of a _2SLS_ estimation and $b_3$ and
$V_3$ are the estimated coefficients and their variance covariance
matrix of a _3SLS_ estimation.
=========================================
Please don't hesitate to write a new version of hausman.systemfit()
that can also compare 2SLS with OLS results.
Best regards from Copenhagen,
Arne
--
Arne Henningsen
http://www.arne-henningsen.name
------------------------------
Message: 24
Date: Sun, 16 Jan 2011 16:29:03 +0100 (CET)
From: Achim Zeileis <Achim.Zeileis at uibk.ac.at>
To: Holger Steinmetz <Holger.steinmetz at web.de>
Cc: r-help at r-project.org
Subject: Re: [R] Hausman Test
Message-ID: <alpine.DEB.2.00.1101161619580.22514 at paninaro.uibk.ac.at>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
On Sun, 16 Jan 2011, Holger Steinmetz wrote:
Dear Achim, thank you very much. One follow up question. The Hausman-test always gives me a p-value
of 1
- no matter how small the statistic is.
I now generated orthogonal regressors (X1-X3) and the test gives me
Hausman specification test for consistency of the 3SLS
estimation
data: data Hausman = -0.0138, df = 2, p-value = 1 What is confusing to me is the "3SLS".
Hausman tests can be used for comparisons of various models. The implementation in systemfit is intended for comparison of 2SLS and
3SLS
but can also be (ab)used for comparison of 2SLS and OLS. You just have
to
enter the models in the reverse order, i.e.,
hausman.systemfit(fit2sls,
fitOLS).
A worked example that computes the test statistic "by hand" is also
included in
help("Baltagi2002", package = "AER")
in the section about the US consumption data, Chapter 11.
An adaptation is also shown below:
## data
library("AER")
data("USConsump1993", package = "AER")
usc <- as.data.frame(USConsump1993)
usc$investment <- usc$income - usc$expenditure
## 2SLS via ivreg(), Hausman by hand
fm_ols <- lm(expenditure ~ income, data = usc)
fm_iv <- ivreg(expenditure ~ income | investment, data = usc)
cf_diff <- coef(fm_iv) - coef(fm_ols)
vc_diff <- vcov(fm_iv) - vcov(fm_ols)
x2_diff <- as.vector(t(cf_diff) %*% solve(vc_diff) %*% cf_diff)
pchisq(x2_diff, df = 2, lower.tail = FALSE)
## 2SLS via systemfit(), Hausman via hausman.systemfit()
library("systemfit")
sm_ols <- systemfit(expenditure ~ income, data = usc, method =
"OLS")
sm_iv <- systemfit(expenditure ~ income, data = usc, method =
"2SLS",
inst = ~ investment) hausman.systemfit(sm_iv, sm_ols) hth, Z
I am just beginning to learn about instrumental variables (I am a psychologist ;) Perhaps that's a
problem?
As a background, here's the complete simulation: W = rnorm(1000) X2 = rnorm(1000) X3 = rnorm(1000) X1 = .5*W + rnorm(1000) Y = .4*X1 + .5*X2 + .6*X3 + rnorm(1000) data = as.data.frame(cbind(X1,X2,X3,Y,W)) fit2sls <- systemfit(Y~X1,data=data,method="2SLS",inst=~W) fitOLS <- systemfit(Y~X1,data=data,method="OLS") print(hausman.systemfit(fitOLS, fit2sls)) Best, Holger -- View this message in context:
Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org 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. ------------------------------ Message: 25 Date: Sun, 16 Jan 2011 16:37:55 +0100 (CET) From: Achim Zeileis <Achim.Zeileis at uibk.ac.at> To: Arne Henningsen <arne.henningsen at googlemail.com> Cc: r-help at r-project.org, Holger Steinmetz <Holger.steinmetz at web.de> Subject: Re: [R] Hausman Test Message-ID: <alpine.DEB.2.00.1101161634170.22514 at paninaro.uibk.ac.at> Content-Type: text/plain; charset="windows-1252"; Format="flowed" On Sun, 16 Jan 2011, Arne Henningsen wrote: Hi Holger! On 16 January 2011 15:53, Holger Steinmetz <Holger.steinmetz at web.de> wrote: One follow up question. The Hausman-test always gives me a p-value
of 1
- no
matter how small the statistic is. I now generated orthogonal regressors (X1-X3) and the test gives me ? ? ? ?Hausman specification test for consistency of the 3SLS
estimation
data: ?data Hausman = -0.0138, df = 2, p-value = 1 What is confusing to me is the "3SLS". I am just beginning to learn
about
instrumental variables (I am a psychologist ;) Perhaps that's a
problem?
As a background, here's the complete simulation: W = rnorm(1000) X2 = rnorm(1000) X3 = rnorm(1000) X1 = .5*W ?+ rnorm(1000) Y = .4*X1 + .5*X2 + .6*X3 + rnorm(1000) data = as.data.frame(cbind(X1,X2,X3,Y,W)) fit2sls <- systemfit(Y~X1,data=data,method="2SLS",inst=~W) fitOLS <- systemfit(Y~X1,data=data,method="OLS") print(hausman.systemfit(fitOLS, fit2sls))
Please do read the documentation of hausman.systemfit(). I regret
that
comparing 2SLS with OLS results has not been implemented yet: ====== part of documentation of hausman.systemfit()
=================
Usage:
hausman.systemfit( results2sls, results3sls )
Arguments:
results2sls : result of a _2SLS_ (limited information) estimation
returned by ?systemfit?.
results3sls : result of a _3SLS_ (full information) estimation
returned by ?systemfit?.
Details:
The null hypotheses of the test is that all exogenous variables
are uncorrelated with all disturbance terms. Under this
hypothesis both the 2SLS and the 3SLS estimator are consistent
but
only the 3SLS estimator is (asymptotically) efficient. Under
the
alternative hypothesis the 2SLS estimator is consistent but the
3SLS estimator is inconsistent.
The Hausman test statistic is
m = ( b_2 - b_3 )' ( V_2 - V_3 ) ( b_2 - b_3 )
where $b_2$ and $V_2$ are the estimated coefficients and their
variance covariance matrix of a _2SLS_ estimation and $b_3$ and
$V_3$ are the estimated coefficients and their variance
covariance
matrix of a _3SLS_ estimation. ========================================= Please don't hesitate to write a new version of hausman.systemfit() that can also compare 2SLS with OLS results.
Arne: Unless I'm missing something, hausman.systemfit() essentially
does
the right thing and computes the right statistic and p-value (see my
other
mail to Holger). Maybe some preliminary check on the input objects
could
be used for determining the right order of models. Best, Z
Best regards from Copenhagen, Arne -- Arne Henningsen http://www.arne-henningsen.name
______________________________________________ R-help at r-project.org 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. ------------------------------ Message: 26 Date: Sun, 16 Jan 2011 16:49:11 +0100 From: Uwe Ligges <ligges at statistik.tu-dortmund.de> To: Alexander Shenkin <ashenkin at ufl.edu> Cc: r-help at r-project.org Subject: Re: [R] holding objects in dataframes Message-ID: <4D331377.3050601 at statistik.tu-dortmund.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed I haven't seen an answer so far, hence I try: As far as I can see, everything is correct here, since you have an element polygons in you data.frame that is a valid vector of mode
list.
Nevertheless, since printing /plotting etc. on the dataframe won't
give
desired results now, it would be more natural to introduce a new class for your kind of object and write some nice methods for it. Best, Uwe Ligges On 14.01.2011 21:59, Alexander Shenkin wrote:
Hello list, I need to keep track of objects that are related to particular observations. In this case, I
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org 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.