[R] Help with nlme--freq weights, logit model, and more

SamL saml at demog.berkeley.edu
Fri Apr 18 18:16:59 CEST 2003


Below you will find the output from a failed multi-level model run.  I am
trying to estimate the following model:

Pr(PLFP=1)= logistic regression -> 
 B1_j * bm + B2_j * wm + B3_j bf + B4_j wf + B5 yrsed+ B6 age+ B7 age^2+e_ij

 B1_j = G01 + G11 bmxd + d1
 B2_j = G02 + G12 wmxd + d2
 B3_j = G03 + G13 bfxd + d3
 B4_j = G04 + G14 wfxd + d4

d1-d4 freely correlated

Note that there is no intercept, so the B1-B4 are race/sex specific
intercepts (bm=black male, wm=white male, bf=black female, wf=white
female).

This model allows the xd variables to influence the means within the
geographic locations (50 states).

SO, my questions:

1)I cannot figure out what the error code means.  This is the first time I
have received that code, which I think is a good sign--I am getting closer
to the correct syntax.  But, still, no results.  I am not sure what to do
next.  Maybe it is in my coding for the logit model; I've not written that
into a program before and am not sure I am to write it for the
probability.

2)Even once that is solved, I still need to learn how to make the program
use frequency weights.  Each line of data represents different numbers of
people.  I collapsed a massive datafile this way.  One line might refer to
7324 people, while another refers to 261.  How do I make nlme use that
information to estimate the model appropriately?

3)How do I get nlme to read starting values from results of a logit model
estimated before the nlme run.  i haven't tried that but assume those
starting values will be far better than my "all zeros" starting values,
which I am using just to debug the code.  But,

4)I did not find a place I had to tell the program what the clustering was
on (states)?  Is this unnecessary?  And if it is necessary, how?

5)Well, that'll do for now I suppose.  Any assistance is greatly
appreciated.

Sam


R : Copyright 2002, The R Development Core Team
Version 1.5.1  (2002-06-17)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.

R is a collaborative project with many contributors.
Type `contributors()' for more information.

Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.

[Previously saved workspace restored]

> invisible(options(echo = TRUE))
> library(nlme)
Loading required package: nls 
Loading required package: lattice 
> fm1<-nlme(model=plfp ~ (exp(-1+bm + bmxd +
+              wm + wmxd +
+              bf + bfxd +
+              wf + wfxd +
+              yrsed + age + age2)) / (1+exp(-1+bm + bmrd +
+              wm + wmxd +
+              bf + bfxd +
+              wf + wfxd +
+              yrsed + age + age2)),
+       fixed=list(bm ~ 1, bmxd ~ 1,
+                  wm ~ 1, wmxd ~ 1,
+                  bf ~ 1, bfxd ~ 1,
+                  wf ~ 1, wfxd ~ 1,
+              yrsed ~ 1, age ~ 1, age2 ~ 1,
+       data = PLFPANAL,
+       random=list(bm ~ 1, wm ~ 1, bf ~ 1, wf ~ 1),
+       start = c(bm = 0, bmxd = 0,
+              wm = 0, wmxd = 0,
+              bf = 0, bfxd = 0,
+              wf = 0, wfxd = 0,
+              yrsed = 0, age = 0, age2 = 0))
Error in parse(file, n, text, prompt) : parse error
Execution halted


* * * * * * * * * * * * * * * * * * * * * * * *
Samuel R. Lucas
Associate Professor of Sociology
University of California-Berkeley
410 Barrows Hall #1980
Berkeley, California 94720-1980
e-mail: Lucas at demog.berkeley.edu
home-page: http://sociology.berkeley.edu/faculty/lucas/
* * * * * * * * * * * * * * * * * * * * * * * *



More information about the R-help mailing list