[R] Linking in R package documentation

2009-08-09 Thread Rebecca Sela
I have two straightforward questions about linking in the man pages for R 
packages:

First, is it possible to link from within parts of the documentation that are 
not the \seealso section?  For example, I would like to have something like:
\arguments{
  \item{correlation}{an optional \code{corStruct} object describing the 
within-group correlation structure; the available classes are given in 
\link{\code{corClasses}}}
}
When the package is compiled, the word corClasses is blue and underlines, but 
nothing happens when you click on it.  

Second, how do I link to a function of the same name in another package?  I 
thought I could use something like:
\seealso{\code{\link[nlme]{ranef}}}
but that gives a Page Not Found.  

Thank you in advance!

Rebecca

__
R-help@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.


Re: [R] \dQuote in packages

2009-07-13 Thread Rebecca Sela
Thank you!  (That was easy to fix.)

How does one deal with quoting (in \reference)?  The following line causes 
problems:
\references{Sela, Rebecca J., and Simonoff, Jeffrey S., \dQuote{RE-EM Trees: A 
New Data Mining Approach for Longitudinal Data}.}
The error given is:
Warning in parse_Rd(./man/predict.Rd, encoding = unknown) :
  ./man/predict.Rd:28: unknown macro '\dquote'
*** error on file ./man/predict.Rd
Error : ./man/predict.Rd:28: Unrecognized macro \dquote

The manual for writing R packages said I should not just use the character .  
What should I be using here?

Thanks again!

Rebecca



- Original Message -
From: Uwe Ligges lig...@statistik.tu-dortmund.de
To: Rebecca Sela rs...@stern.nyu.edu
Cc: r-help r-help@r-project.org
Sent: Friday, July 10, 2009 8:17:44 PM GMT -05:00 US/Canada Eastern
Subject: Re: [R] \dQuote in packages



Rebecca Sela wrote:
 Here is one Rd file with problems, now inline so that it can be read:
 
 \name{simpleREEMdata}
 \docType{data}
 \alias{simpleREEMdata}
 \title{Sample Data for RE-EM trees}
 \description{
 This data set is consists of a panel of 50 individuals with 12 observations 
 per individual.  The data is based on a regression tree with an initial split 
 based on a dummy variable (\code{D}) and a second split based on time in the 
 branch where \code{D=1}.  The observations include both randomly generated 
 individual-specific effects and observation-specific errors.
 }
 \format{
 The data has 600 rows and 5 columns.  The columns are: 

insert here:

\itemize{

 \item{\code{Y}}{the target variable}
 \item{\code{t}}{a numeric predictor (time)}
 \item{\code{D}}{a catergorical predictor with two levels, 0 and 1}
 \item{\code{ID}}{the identifier for each individual}
 \item{\code{X}}{another covariate (which is intentionally unrelated to the 
 target variable)}

insert here:

}


or in other words, you need an itemize environment in order to use \item 
within \format, see the manual Writing R Extensions.

Best,
Uwe


 }
 \references{Sela, Rebecca J., and Simonoff, Jeffrey S., \dQuote{RE-EM Trees: 
 A New Data Mining Approach for Longitudinal Data}.}
 \keyword{datasets}
 
 Thanks again for your help!
 
 Rebecca
 
 - Original Message -
 From: Uwe Ligges lig...@statistik.tu-dortmund.de
 To: Rebecca Sela rs...@stern.nyu.edu
 Cc: r-help r-help@r-project.org
 Sent: Thursday, July 9, 2009 6:05:46 AM GMT -05:00 US/Canada Eastern
 Subject: Re: [R] \dQuote in packages
 
 Rebecca,
 
 the attachments have been stripped off by the mailing list.
 
 
 Rebecca Sela wrote:
 That's good to know.  I have attached three Rd files that gave errors 
 (others gave identical errors).  I would love to know what is wrong with 
 them.

 I'm using 2.1.1 because that is what is installed on the Linux computer I 
 have access to.  (I haven't bothered figuring out how to assemble a package 
 in Windows.)
 
 You should *really* upgrade! That version is outdated for several years now.
 
 How to do it on Windows: See the R Installation and Administration 
 manual with its corresponding section.
 
 Best,
 Uwe
 
 
 Thank you for your help!

 Rebecca


 - Original Message -
 From: Uwe Ligges lig...@statistik.tu-dortmund.de
 To: Rebecca Sela rs...@stern.nyu.edu
 Cc: r-help r-help@r-project.org
 Sent: Wednesday, July 8, 2009 6:11:33 PM GMT -05:00 US/Canada Eastern
 Subject: Re: [R] \dQuote in packages

 The difference you are experiencing is the new Rd2 parser that is more 
 picky now (but also prevents to produce wrong documentation files).

 If you make the code of the Rd available, someone might be able to help.

 Are you really under R-2.1.1 ??? That is really ancient!


 Best,
 Uwe Ligges



 Rebecca Sela wrote:
 I am in the process of submitting a package to CRAN.  R CMD check ran 
 successfully on the package on my local computer, using R version 2.1.1.  
 However, on the computers for CRAN (with version 2.10.0), the following 
 errors occurred:

 Warning in parse_Rd(./man/predict.Rd, encoding = unknown) :
   ./man/predict.Rd:28: unknown macro '\dquote'
 *** error on file ./man/predict.Rd
 Error : ./man/predict.Rd:28: Unrecognized macro \dquote
 Warning in parse_Rd(./man/print.Rd, encoding = unknown) :
   ./man/print.Rd:17: unexpected UNKNOWN '\sideeffects'
 Warning in parse_Rd(./man/simpleREEMdata.Rd, encoding = unknown) :
   ./man/simpleREEMdata.Rd:10: unknown macro '\item'

 Are \dquote, \sideeffects, and \item not supported in newer versions of R?  
 Is there some underlying problem that I should fix that makes these show up?

 Thank you very much.

 Rebecca

 __
 R-help@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@r

Re: [R] \dQuote in packages

2009-07-10 Thread Rebecca Sela
Here is one Rd file with problems, now inline so that it can be read:

\name{simpleREEMdata}
\docType{data}
\alias{simpleREEMdata}
\title{Sample Data for RE-EM trees}
\description{
This data set is consists of a panel of 50 individuals with 12 observations per 
individual.  The data is based on a regression tree with an initial split based 
on a dummy variable (\code{D}) and a second split based on time in the branch 
where \code{D=1}.  The observations include both randomly generated 
individual-specific effects and observation-specific errors.
}
\format{
The data has 600 rows and 5 columns.  The columns are: 
\item{\code{Y}}{the target variable}
\item{\code{t}}{a numeric predictor (time)}
\item{\code{D}}{a catergorical predictor with two levels, 0 and 1}
\item{\code{ID}}{the identifier for each individual}
\item{\code{X}}{another covariate (which is intentionally unrelated to the 
target variable)}
}
\references{Sela, Rebecca J., and Simonoff, Jeffrey S., \dQuote{RE-EM Trees: A 
New Data Mining Approach for Longitudinal Data}.}
\keyword{datasets}

Thanks again for your help!

Rebecca

- Original Message -
From: Uwe Ligges lig...@statistik.tu-dortmund.de
To: Rebecca Sela rs...@stern.nyu.edu
Cc: r-help r-help@r-project.org
Sent: Thursday, July 9, 2009 6:05:46 AM GMT -05:00 US/Canada Eastern
Subject: Re: [R] \dQuote in packages

Rebecca,

the attachments have been stripped off by the mailing list.


Rebecca Sela wrote:
 That's good to know.  I have attached three Rd files that gave errors (others 
 gave identical errors).  I would love to know what is wrong with them.
 
 I'm using 2.1.1 because that is what is installed on the Linux computer I 
 have access to.  (I haven't bothered figuring out how to assemble a package 
 in Windows.)

You should *really* upgrade! That version is outdated for several years now.

How to do it on Windows: See the R Installation and Administration 
manual with its corresponding section.

Best,
Uwe


 Thank you for your help!
 
 Rebecca
 
 
 - Original Message -
 From: Uwe Ligges lig...@statistik.tu-dortmund.de
 To: Rebecca Sela rs...@stern.nyu.edu
 Cc: r-help r-help@r-project.org
 Sent: Wednesday, July 8, 2009 6:11:33 PM GMT -05:00 US/Canada Eastern
 Subject: Re: [R] \dQuote in packages
 
 The difference you are experiencing is the new Rd2 parser that is more 
 picky now (but also prevents to produce wrong documentation files).
 
 If you make the code of the Rd available, someone might be able to help.
 
 Are you really under R-2.1.1 ??? That is really ancient!
 
 
 Best,
 Uwe Ligges
 
 
 
 Rebecca Sela wrote:
 I am in the process of submitting a package to CRAN.  R CMD check ran 
 successfully on the package on my local computer, using R version 2.1.1.  
 However, on the computers for CRAN (with version 2.10.0), the following 
 errors occurred:

 Warning in parse_Rd(./man/predict.Rd, encoding = unknown) :
   ./man/predict.Rd:28: unknown macro '\dquote'
 *** error on file ./man/predict.Rd
 Error : ./man/predict.Rd:28: Unrecognized macro \dquote
 Warning in parse_Rd(./man/print.Rd, encoding = unknown) :
   ./man/print.Rd:17: unexpected UNKNOWN '\sideeffects'
 Warning in parse_Rd(./man/simpleREEMdata.Rd, encoding = unknown) :
   ./man/simpleREEMdata.Rd:10: unknown macro '\item'

 Are \dquote, \sideeffects, and \item not supported in newer versions of R?  
 Is there some underlying problem that I should fix that makes these show up?

 Thank you very much.

 Rebecca

 __
 R-help@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@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@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] \dQuote in packages

2009-07-08 Thread Rebecca Sela
I am in the process of submitting a package to CRAN.  R CMD check ran 
successfully on the package on my local computer, using R version 2.1.1.  
However, on the computers for CRAN (with version 2.10.0), the following errors 
occurred:

Warning in parse_Rd(./man/predict.Rd, encoding = unknown) :
  ./man/predict.Rd:28: unknown macro '\dquote'
*** error on file ./man/predict.Rd
Error : ./man/predict.Rd:28: Unrecognized macro \dquote
Warning in parse_Rd(./man/print.Rd, encoding = unknown) :
  ./man/print.Rd:17: unexpected UNKNOWN '\sideeffects'
Warning in parse_Rd(./man/simpleREEMdata.Rd, encoding = unknown) :
  ./man/simpleREEMdata.Rd:10: unknown macro '\item'

Are \dquote, \sideeffects, and \item not supported in newer versions of R?  Is 
there some underlying problem that I should fix that makes these show up?

Thank you very much.

Rebecca

__
R-help@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.


Re: [R] \dQuote in packages

2009-07-08 Thread Rebecca Sela
That's good to know.  I have attached three Rd files that gave errors (others 
gave identical errors).  I would love to know what is wrong with them.

I'm using 2.1.1 because that is what is installed on the Linux computer I have 
access to.  (I haven't bothered figuring out how to assemble a package in 
Windows.)

Thank you for your help!

Rebecca


- Original Message -
From: Uwe Ligges lig...@statistik.tu-dortmund.de
To: Rebecca Sela rs...@stern.nyu.edu
Cc: r-help r-help@r-project.org
Sent: Wednesday, July 8, 2009 6:11:33 PM GMT -05:00 US/Canada Eastern
Subject: Re: [R] \dQuote in packages

The difference you are experiencing is the new Rd2 parser that is more 
picky now (but also prevents to produce wrong documentation files).

If you make the code of the Rd available, someone might be able to help.

Are you really under R-2.1.1 ??? That is really ancient!


Best,
Uwe Ligges



Rebecca Sela wrote:
 I am in the process of submitting a package to CRAN.  R CMD check ran 
 successfully on the package on my local computer, using R version 2.1.1.  
 However, on the computers for CRAN (with version 2.10.0), the following 
 errors occurred:
 
 Warning in parse_Rd(./man/predict.Rd, encoding = unknown) :
   ./man/predict.Rd:28: unknown macro '\dquote'
 *** error on file ./man/predict.Rd
 Error : ./man/predict.Rd:28: Unrecognized macro \dquote
 Warning in parse_Rd(./man/print.Rd, encoding = unknown) :
   ./man/print.Rd:17: unexpected UNKNOWN '\sideeffects'
 Warning in parse_Rd(./man/simpleREEMdata.Rd, encoding = unknown) :
   ./man/simpleREEMdata.Rd:10: unknown macro '\item'
 
 Are \dquote, \sideeffects, and \item not supported in newer versions of R?  
 Is there some underlying problem that I should fix that makes these show up?
 
 Thank you very much.
 
 Rebecca
 
 __
 R-help@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@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] Problems with subsets in NLME

2009-06-25 Thread Rebecca Sela
I am trying to estimate models with subsets using the NLME package.  However, I 
am getting an error in the case below (among others):
 subset - c(rep(TRUE, 107), FALSE)
 fm2 - lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, 
 subset=subset)
Error in xj[i] : invalid subscript type 'closure'
 fm2 - lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, subset=1:107)

The second estimation works.

Does anyone know if there is another work-around?  (I have also e-mailed the 
package maintainers, but one of the e-mails bounced, so I am trying this list 
as well.)

Thank you!

Rebecca

--
Rebecca Sela
IOMS/Statistics Group
Stern School of Business
New York University

__
R-help@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] Error: package/namespace load failed

2009-05-27 Thread Rebecca Sela
I am writing my first R package, and I have been getting the following series 
of errors when I run R CMD check:

* checking S3 generic/method consistency ... WARNING
Error: package/namespace load failed for 'REEMtree'
Call sequence:
2: stop(gettextf(package/namespace load failed for '%s', 
libraryPkgName(package)), 
   call. = FALSE, domain = NA)
1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
Execution halted
See section 'Generic functions and methods' of the 'Writing R Extensions'
manual.
* checking replacement functions ... WARNING
Error: package/namespace load failed for 'REEMtree'
Call sequence:
2: stop(gettextf(package/namespace load failed for '%s', 
libraryPkgName(package)), 
   call. = FALSE, domain = NA)
1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
Execution halted
In R, the argument of a replacement function which corresponds to the right
hand side must be named 'value'.
* checking foreign function calls ... WARNING
Error: package/namespace load failed for 'REEMtree'
Call sequence:
2: stop(gettextf(package/namespace load failed for '%s', 
libraryPkgName(package)), 
   call. = FALSE, domain = NA)
1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
Execution halted
See section 'System and foreign language interfaces' of the 'Writing R
Extensions' manual.
* checking Rd files ... OK
* checking for missing documentation entries ... ERROR
Error: package/namespace load failed for 'REEMtree'

(Everything is OK up to this point.)

Looking around online, I have found references to this error when there is 
compiled C or Fortran code, but I have none of that in my code.  I imagine this 
is a simple problem (perhaps with my NAMESPACE file), but I don't know what it 
is.  (The text of the NAMESPACE file is at the bottom of this e-mail.)

Thank you in advance for your help!

Rebecca

NAMESPACE file:

useDynLib(REEMtree)

export(AutoCorrelationLRtest, FixedEffectsTree, RandomEffectsTree, 
LMEpredict, PredictionTest, RandomEffectsTree, RMSE, simpleREEMdata, 
REEMtree, FEEMtree)

import(nlme)
import(rpart)

S3method(is,REEMtree)
S3method(logLik,REEMtree)
S3method(plot,REEMtree)
S3method(predict,REEMtree)
S3method(print, REEMtree)
S3method(ranef,REEMtree)
S3method(tree,REEMtree)
S3method(is,FEEMtree)
S3method(logLik,FEEMtree)
S3method(plot,FEEMtree)
S3method(predict,FEEMtree)
S3method(print, FEEMtree)
S3method(tree,FEEMtree)

useDynLib(REEMtree)

export(AutoCorrelationLRtest, FixedEffectsTree, RandomEffectsTree, 
LMEpredict, PredictionTest, RandomEffectsTree, RMSE, simpleREEMdata, 
REEMtree, FEEMtree)

import(nlme)
import(rpart)

S3method(is,REEMtree)
S3method(logLik,REEMtree)
S3method(plot,REEMtree)
S3method(predict,REEMtree)
S3method(print, REEMtree)
S3method(ranef,REEMtree)
S3method(tree,REEMtree)
S3method(is,FEEMtree)
S3method(logLik,FEEMtree)
S3method(plot,FEEMtree)
S3method(predict,FEEMtree)
S3method(print, FEEMtree)
S3method(tree,FEEMtree)
__
R-help@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.


Re: [R] Checking a (new) package - examples require other package functions

2009-05-16 Thread Rebecca Sela
After adding the right functions to the NAMESPACE file, I am now getting a 
different error:

Error: package/namespace load failed for 'REEMtree'
Call sequence:
2: stop(gettextf(package/namespace load failed for '%s', 
libraryPkgName(package)), 
   call. = FALSE, domain = NA)
1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
Execution halted

I have attached the NAMESPACE file in case that is where the problem is.  

Thanks again for your help!

Rebecca


- Original Message -
From: Duncan Murdoch murd...@stats.uwo.ca
To: Rebecca Sela rs...@stern.nyu.edu
Cc: r-help r-help@r-project.org
Sent: Thursday, May 14, 2009 6:57:21 AM GMT -05:00 US/Canada Eastern
Subject: Re: [R] Checking a (new) package - examples require other package 
functions

On 13/05/2009 2:38 PM, Rebecca Sela wrote:
 I am creating an R package.  I ran R CMD check on the package, and everything 
 passed until it tried to run the examples.  Then, the result was:
 
 * checking examples ... ERROR
 Running examples in REEMtree-Ex.R failed.
 The error most likely occurred in:
 
 ### * AutoCorrelationLRtest

 flush(stderr()); flush(stdout())

 ### Name: AutoCorrelationLRtest
 ### Title: Test for autocorrelation in the residuals of a RE-EM tree
 ### Aliases: AutoCorrelationLRtest
 ### Keywords: htest tree models

 ### ** Examples

 # Estimation without autocorrelation
 simpleEMresult-RandomEffectsTree(Y~D+t+X, data=simpleREEMdata, 
 random=~1|ID, simpleREEMdata$ID)
 Error: couldn't find function RandomEffectsTree
 Execution halted
 
 
 The function RandomEffectsTree is defined in the R code for the package.  
 How can I refer to other functions from the package in examples?  (I have the 
 Writing R-extensions PDF, so it would be enough to point me to the right 
 page, if the answer is in there and I just missed it.)

You should not need to do anything special to make package functions 
visible, as long as they would be visible to a normal user.  (Functions 
not exported in the NAMESPACE file won't be visible in the examples.)

Are you sure you have a function with that exact name?  It could be a 
typo somewhere, e.g. RandomEffectTree or RandomeffectsTree.

Duncan Murdoch
__
R-help@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] Checking a (new) package - examples require other package functions

2009-05-13 Thread Rebecca Sela
I am creating an R package.  I ran R CMD check on the package, and everything 
passed until it tried to run the examples.  Then, the result was:

* checking examples ... ERROR
Running examples in REEMtree-Ex.R failed.
The error most likely occurred in:

 ### * AutoCorrelationLRtest
 
 flush(stderr()); flush(stdout())
 
 ### Name: AutoCorrelationLRtest
 ### Title: Test for autocorrelation in the residuals of a RE-EM tree
 ### Aliases: AutoCorrelationLRtest
 ### Keywords: htest tree models
 
 ### ** Examples
 
 # Estimation without autocorrelation
 simpleEMresult-RandomEffectsTree(Y~D+t+X, data=simpleREEMdata, random=~1|ID, 
 simpleREEMdata$ID)
Error: couldn't find function RandomEffectsTree
Execution halted


The function RandomEffectsTree is defined in the R code for the package.  How 
can I refer to other functions from the package in examples?  (I have the 
Writing R-extensions PDF, so it would be enough to point me to the right 
page, if the answer is in there and I just missed it.)

Thanks!

Rebecca

__
R-help@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] DLM and matrices with 0 eigenvalues

2009-02-19 Thread Rebecca Sela
I am using DLM to fit a state space model.  The covariance matrix of states (W) 
is given by:
a 0 a 0
0 0 0 0
a 0 a 0
0 0 0 0
where a is a parameter to be estimated.  Even though the matrix is positive 
semidefinite, sometimes DLM gives me an error that W is not a valid variance 
matrix.  As far as I can tell, the reason is that one of R's computed 
eigenvalues is very slightly negative (something like -5E-17).  Is there a way 
to work around this?

Thanks!

Rebecca

__
R-help@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] Three questions about DSE

2009-02-05 Thread Rebecca Sela
I have been using the dse1 and dse2 packages to estimate a model in which the 
underlying state is an ARMA(2,2) and the observed variables are equal to the 
state plus noise.  I am describing this model using a state space model.

First, in estimation, is there a way to restrict two of the estimated 
coefficients to be equal to each other?  In order to desribe an ARMA(2,2) model 
using a state space model, I must restrict the innovation variance to have its 
two non-zero elements equal to each other, and I haven't figured out how to do 
that.

Second, I am using the smoother to extract the signal using the code in the 
attached file.  The estimated value of the signal in the last period is 0, but 
all the estimated values are right.  Is there something I am missing here?

Finally, sometimes the smoother fails, but the filtered version of the signal 
is fine.  (That will not be the case with the attached code.)  Is there a known 
reason why this sometimes occurs?

Thank you in advance for all of your help!

Rebecca

--
Rebecca Sela
Doctoral Candidate
Statistics Group/IOMS
Stern School of Business__
R-help@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] LME prediction - object not subsettable?

2008-09-06 Thread Rebecca Sela
I fit a random effects linear model to data, and then tried to use it to 
predict, but I got this error:
 predict(lmeObject, newdata, level=0)
Error in eval(mCall$fixed)[-2] : object is not subsettable

This is a new error for me.  It still occurs if I change the level to 1 or if I 
change the data for prediction back to the original dataset to which the lme 
model was fitted.

Can anyone help?

Thank you in advance!

Rebecca

__
R-help@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] False convergence in LME

2008-06-13 Thread Rebecca Sela
I tried to use LME (on a fairly large dataset, so I am not including it), and I 
got this error message:

Error in lme.formula(formula(paste(c(toString(TargetName), 
as.factor(nodeInd)),  : 
  nlminb problem, convergence error code = 1
  message = false convergence (8)

Is there any way to get more information or to get the potentially wrong 
estimates from LME?

(Also, the page in the NLMINB documentation,  
http://netlib.bell-labs.com/cm/cs/cstr/153.pdf, has errors in it, which makes 
it harder to check on what is happening.)

Thank you in advance!

Rebecca

__
R-help@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] Predicting a single observatio using LME

2008-06-06 Thread Rebecca Sela
When I use a model fit with LME, I get an error if I try to use predict with 
a dataset consisting of a single line.

For example, using this data:
 simpledata
  Y t D ID
1  -1.464740870 1 0  1
2   1.222911373 2 0  1
3  -0.605996798 3 0  1
4   0.155692707 4 0  1
5   3.849619772 1 0  2
6   4.289213902 2 0  2
7   2.369407737 3 0  2
8   2.249052533 4 0  2
9   0.920044316 1 0  3
10  2.003262622 2 0  3
11  0.003833438 3 0  3
12  1.578300927 4 0  3
13 -0.842322442 1 1  4
14 -0.657256158 2 1  4
15  1.504491575 3 1  4
16  2.896007045 4 1  4
17  0.990505440 1 1  5
18  2.722942793 2 1  5
19  4.395861278 3 1  5
20  4.849296475 4 1  5
21  3.049616421 1 1  6
22  2.874405962 2 1  6
23  4.359511097 3 1  6
24  6.165419699 4 1  6

This happened:
 testLME - lme(Y~t+D,data=simpledata,random=~1|ID)
 predict(testLME, simpledata[1,])
Error in val[revOrder, level + 1] : incorrect number of dimensions

This has occurred with other datasets as well.  Is this a bug in the code, or 
am I doing something wrong?

(Also, is there a way to parse a formula of a type given to random?  For 
example, given ~1+t|ID, I'd like to be able to extract all the variable names 
to the left of | and to the right of |, the way one can with a normal formula.)

Thanks in advance!

Rebecca

__
R-help@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] Extracting variables from random effects formulas

2008-05-28 Thread Rebecca Sela
I would like to be able to extract the names of the variables in a formula that 
specifies random effects.  For example, given:
random = ~ 1+year | st_name
I'd like to be able to get year and st_name out of random.  Neither 
terms(random) nor random[2] seems to work.  Is there a way to get variable 
names out?

Thanks in advance!

Rebecca

__
R-help@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] NLMINB convergence codes

2008-01-28 Thread Rebecca Sela
According to the R documentation for NLMINB, the returned value of convergence 
is 0 for successful convergence.  When I got another code (1), I looked up the 
PDF that linked from the documentation 
(http://netlib.bell-labs.com/cm/cs/cstr/153.pdf), which said that a return code 
under 3 was impossible.

Is there other documentation that gives the correct meanings of the NLMINB 
convergence codes in the R implementation?

Thanks!

Rebecca

__
R-help@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] NaN as a parameter in NLMINB optimization

2007-12-20 Thread Rebecca Sela
I am trying to optimize a likelihood function using NLMINB.  After running 
without a problem for quite a few iterations (enough that my intermediate 
output extends further than I can scroll back), it tries a vector of parameter 
values NaN.  This has happened with multiple Monte Carlo datasets, and a few 
different (but very similar) likelihood functions.  (They are complicated, but 
I can send them to someone if desired.)

Is this something that can happen with NLMINB, perhaps because of a 0/0 in the 
gradient calculations?  Or is it unique to my code?

Thanks in advance!

Rebecca

--
Rebecca Sela
Statistics Department/IOMS
Stern School of Business
New York University

__
R-help@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] Disentagling formulas

2007-10-01 Thread Rebecca Sela
I am writing a program in which I would like to take in a formula, change the 
response (Y) variable into something else, and then pass the formula, with the 
new Y variable to another function.  That is, I am starting with 
 formula - Y~X1+X2+X3
and I'd like to do something like
 Y - formula$Y
 newY - f(Y)
 lm(newY~X1+X2+X3)
So far, it seems that my only option will be a very complicated sequence of 
steps involving match.call().  Is there a simpler way to change the response 
variable in a formula?

Thanks in advance!

Rebecca

--
Rebecca Sela
Statistics Department
Stern School of Business
New York University

__
R-help@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.