[R] mitools and plm packages

2007-08-15 Thread Nathan Paxton
Hi all,

I am trying to use the functions in the plm package with multiply  
imputed datasets. I had tried to combine the datasets using the  
imputationList() function of mitools. plm, however, requires a data  
argument, and I don't know where to point it to. I'd appreciate any  
help people might have.

A (possible) fuller description of the problem and code is in a  
previous message: https://stat.ethz.ch/pipermail/r-help/2007-August/ 
138670.html.

Thanks.
-N
--
Nathan A. Paxton
Ph.D. Candidate
Dept. of Government, Harvard University

Resident Tutor
John Winthrop House, Harvard University

napaxton AT fas DOT harvard DOT edu
http://www.fas.harvard.edu/~napaxton

__
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] Panel data and imputed datasets

2007-08-14 Thread Nathan Paxton
Hi all,

I am hardly an expert, so I expect that this code is not the easiest/ 
most efficient way of getting where I want. Any suggestions in that  
direction would also be helpful.

I am working on panel analysis with five imputed datasets, generated  
by Amelia. To do panel analysis, it seemed that the plm package was  
the best, providing a convenient wrapper for fixed and random effects  
and Hausman tests. And since I've got five datasets, it seemed  
reasonable that what I wanted to do was to combine these as a big  
imputation data frame.  The plm regression function requires a data  
argument, and simply using the imputationList result didn't work, nor  
did calling the names(allhiv) work (that resulted in imputations  
and call).

Where do I point the plm command to look for the data? Or have I  
gone about this in entirely the wrong way?

Thanks in advance for the help.

Best,
-N

Here's the code I have so far:
#Read in the imputed datasets
data1 - read.dta(outdata1.dta)
data2 - read.dta(outdata2.dta)
data3 - read.dta(outdata3.dta)
data4 - read.dta(outdata4.dta)
data5 - read.dta(outdata5.dta)

#Set the datasets as panels (for subsequent analysis in plm)
pdata.frame(data1, country, time=year)
pdata.frame(data2, country, time=year)
pdata.frame(data3, country, time=year)
pdata.frame(data4, country, time=year)
pdata.frame(data5, country, time=year)

#Using mitools, combine the panel data frames 1-5
allhiv - imputationList(list(data1,data2,data3,data4,data5))

#A test regression
form2-APIPolSupport~subnatexpoftotal+adultprev.lag+pressfreedom

#The following is something I tried but which didn't work.
estimateHIV1 -with(allhiv, plm(form2, data=imputations[1:5,]))

--
Nathan A. Paxton
Ph.D. Candidate
Dept. of Government, Harvard University

Resident Tutor
John Winthrop House, Harvard University

napaxton AT fas DOT harvard DOT edu
http://www.fas.harvard.edu/~napaxton
 
===
When you have to stay eight years away from California, you live in a  
perpetual state of homesickness.
 - Ronald Reagan

The most courageous act is still to think for yourself.  Aloud.
 -Coco Chanel

__
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] mice package

2007-08-08 Thread Nathan Paxton
Hi all,

I am trying to run the mice package (for multiple imputation) on a  
data frame that is 5174 x 100. When I run mice(frame), I get the  
following response:
Error in solve.default(t(xobs) %*% xobs) :
Lapack routine dgesv: system is exactly singular

and execution stops.

I'm no expert at matrix algebra, so if someone could explain this to  
me and what I can do to get around it, I'd be very appreciative.

Thanks.

Best,
-N.
--
Nathan A. Paxton
Ph.D. Candidate
Dept. of Government, Harvard University

Resident Tutor
John Winthrop House, Harvard University

napaxton AT fas DOT harvard DOT edu
http://www.fas.harvard.edu/~napaxton
 
===
When you have to stay eight years away from California, you live in a  
perpetual state of homesickness.
 - Ronald Reagan

The most courageous act is still to think for yourself.  Aloud.
 -Coco Chanel

__
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] Mac OS X crash bug?

2007-05-31 Thread Nathan Paxton

Hi all,

I want to check if this is a bug for which I should file a report.

	I am using R2.5.0 on OS X 10.4.9.  When I invoke the data editor and  
when I change the values of individual cells, it seems to work as  
intended.  However, when I try to delete/add a row/column, R.app  
crashes.  I've attached the crash log.


Best,
-Nathan
Date/Time:  2007-05-31 17:13:26.370 -0400
OS Version: 10.4.9 (Build 8P135)
Report Version: 4

Command: R
Path:/Applications/R.app/Contents/MacOS/R
Parent:  WindowServer [89]

Version: R 2.5.0 GUI 1.19 (4308)

PID:4001
Thread: 0

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:  KERN_PROTECTION_FAILURE (0x0002) at 0x

Thread 0 Crashed:
0   libR.dylib  0x010c0b80 SET_STRING_ELT + 96 (memory.c:2619)
1   org.R-project.R 0x0001d968 -[REditor addRow:] + 452
2   com.apple.AppKit0x9394558c -[NSToolbarButton sendAction:to:] + 
76
3   com.apple.AppKit0x9394552c -[NSToolbarButton sendAction] + 80
4   com.apple.AppKit0x93944e84 -[NSToolbarItemViewer mouseDown:] + 
1568
5   com.apple.AppKit0x937d9890 -[NSWindow sendEvent:] + 4616
6   com.apple.AppKit0x937828d4 -[NSApplication sendEvent:] + 4172
7   com.apple.AppKit0x9392a2dc -[NSApplication 
_modalSession:sendEvent:] + 440
8   com.apple.AppKit0x939288fc -[NSApplication 
_realDoModalLoop:peek:] + 296
9   com.apple.AppKit0x9391f2b0 -[NSApplication runModalForWindow:] 
+ 176
10  org.R-project.R 0x0001db28 +[REditor startDataEntry] + 216
11  org.R-project.R 0xe2dc Re_dataentry + 1168
12  libR.dylib  0x010d02e0 do_internal + 432 (names.c:1123)
13  libR.dylib  0x0109c7a8 Rf_eval + 1224 (eval.c:444)
14  libR.dylib  0x0109e874 do_set + 436 (eval.c:1389)
15  libR.dylib  0x0109c7a8 Rf_eval + 1224 (eval.c:444)
16  libR.dylib  0x0109eb1c do_begin + 140 (eval.c:1125)
17  libR.dylib  0x0109c7a8 Rf_eval + 1224 (eval.c:444)
18  libR.dylib  0x010a0128 Rf_applyClosure + 1016 (eval.c:634)
19  libR.dylib  0x010d3338 Rf_usemethod + 2120 (objects.c:310)
20  libR.dylib  0x010d36c0 do_usemethod + 800 (objects.c:394)
21  libR.dylib  0x0109c7a8 Rf_eval + 1224 (eval.c:444)
22  libR.dylib  0x010a0128 Rf_applyClosure + 1016 (eval.c:634)
23  libR.dylib  0x0109c990 Rf_eval + 1712 (eval.c:475)
24  libR.dylib  0x0109e874 do_set + 436 (eval.c:1389)
25  libR.dylib  0x0109c7a8 Rf_eval + 1224 (eval.c:444)
26  libR.dylib  0x010598d0 protectedEval + 64 (context.c:636)
27  libR.dylib  0x01059840 R_ToplevelExec + 208 (context.c:593)
28  libR.dylib  0x0105992c R_tryEval + 60 (context.c:649)
29  org.R-project.R 0xf954 -[REngine evaluateExpressions:] + 176
30  org.R-project.R 0xfd20 -[REngine executeString:] + 204
31  org.R-project.R 0x0001b8d8 -[WSBrowser editObject:] + 176
32  com.apple.AppKit0x9394558c -[NSToolbarButton sendAction:to:] + 
76
33  com.apple.AppKit0x9394552c -[NSToolbarButton sendAction] + 80
34  com.apple.AppKit0x93944e84 -[NSToolbarItemViewer mouseDown:] + 
1568
35  com.apple.AppKit0x937d9890 -[NSWindow sendEvent:] + 4616
36  com.apple.AppKit0x937828d4 -[NSApplication sendEvent:] + 4172
37  org.R-project.R 0x58cc -[RController handleReadConsole:] + 
84
38  org.R-project.R 0xca6c Re_ReadConsole + 100
39  org.R-project.R 0x00016bbc run_REngineRmainloop + 296
40  org.R-project.R 0xf670 -[REngine runREPL] + 68
41  org.R-project.R 0x2e20 main + 816
42  org.R-project.R 0x2a74 _start + 760
43  org.R-project.R 0x2778 start + 48

Thread 1:
0   libSystem.B.dylib   0x9001f98c select + 12
1   org.R-project.R 0x4788 -[RController readThread:] + 588
2   com.apple.Foundation0x92be11a0 forkThreadForFunction + 108
3   libSystem.B.dylib   0x9002be08 _pthread_body + 96

Thread 2:
0   libSystem.B.dylib   0x9004a768 syscall_thread_switch + 8
1   com.apple.Foundation0x92bf95dc +[NSThread sleepUntilDate:] + 152
2   com.apple.AppKit0x9381aa10 -[NSUIHeartBeat _heartBeatThread:] + 
1100
3   com.apple.Foundation0x92be11a0 forkThreadForFunction + 108
4   libSystem.B.dylib   0x9002be08 _pthread_body + 96

Thread 0 crashed with PPC Thread State 64:
  srr0: 0x010c0b80 srr1: 0x0200f030
vrsave: 0x
cr: 0x24024282  xer: 0x0004   lr: 0x010c0b34  
ctr: 0x010c0b20
r0: 0x8000   r1: 0xbfffb660   r2: 0x8000   
r3: 

Re: [R] Mac OS X crash bug?

2007-05-31 Thread Nathan Paxton
My apologies.  This only occurs on row operations, not column ones.

-Nathan
On 31 May 2007, at 5:38 PM, Nathan Paxton wrote:

   Hi all,

   I want to check if this is a bug for which I should file a report.

   I am using R2.5.0 on OS X 10.4.9.  When I invoke the data editor  
 and when I change the values of individual cells, it seems to work  
 as intended.  However, when I try to delete/add a row/column, R.app  
 crashes.  I've attached the crash log.

 Best,
 -Nathan
 Rcrashlog.txt

 --
 Nathan A. Paxton
 Ph.D. Candidate
 Dept. of Government, Harvard University

 Resident Tutor
 John Winthrop House, Harvard University

 napaxton AT fas DOT harvard DOT edu
 http://www.fas.harvard.edu/~napaxton
 == 
 =
 When you have to stay eight years away from California, you live in  
 a perpetual state of homesickness.
 - Ronald Reagan

 The most courageous act is still to think for yourself.  Aloud.
 -Coco Chanel
 == 
 =




--
Nathan A. Paxton
Ph.D. Candidate
Dept. of Government, Harvard University

Resident Tutor
John Winthrop House, Harvard University

napaxton AT fas DOT harvard DOT edu
http://www.fas.harvard.edu/~napaxton
 
===
When you have to stay eight years away from California, you live in a  
perpetual state of homesickness.
 - Ronald Reagan

The most courageous act is still to think for yourself.  Aloud.
 -Coco Chanel

__
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.