[R] how do I add text lables on QQ plot

2020-03-10 Thread Ana Marija
Hello,

I am making QQ plot via:

library(ggman)
qq(fdr2_sorted$FDR.q.val2, main = "RG_All", pch = 17,
col=fdr1_sorted$group, cex = 1, las = 1)

data frames used look like this:

> head(fdr1_sorted)
   NAME GS follow
link to MSigDB  GS DETAILS SIZE ES   NES NOM p-val
1: GO_DNA_PACKAGING_COMPLEX
GO_DNA_PACKAGING_COMPLEX Details ...   77  0.6757226  2.466745
0
2:   GO_PROTEIN_DNA_COMPLEX
GO_PROTEIN_DNA_COMPLEX Details ...  132  0.5958179  2.346520 0
3: GO_RESPONSE_TO_TYPE_I_INTERFERON
GO_RESPONSE_TO_TYPE_I_INTERFERON Details ...   52 -0.7521569 -2.533148
0
4:  GO_RESPONSE_TO_INTERFERON_GAMMA
GO_RESPONSE_TO_INTERFERON_GAMMA Details ...  101 -0.6370415 -2.420473
   0
5: GO_CELLULAR_RESPONSE_TO_INTERFERON_GAMMA
GO_CELLULAR_RESPONSE_TO_INTERFERON_GAMMA Details ...   85 -0.6571892
-2.402153 0
6: GO_GRANULOCYTE_MIGRATION
GO_GRANULOCYTE_MIGRATION Details ...   43 -0.7332099 -2.398983
0
   FDR q-val FWER p-val RANK AT MAX   LEADING EDGE V12
group FDR.q.val2
1: 0  0 tags=43%, list=10%, signal=47%  NA
2  1e-10
2: 0  01516 tags=39%, list=13%, signal=45%  NA
2  1e-10
3: 0  01427 tags=54%, list=12%, signal=61%  NA
4  1e-10
4: 0  01819 tags=45%, list=16%, signal=52%  NA
4  1e-10
5: 0  01216 tags=38%, list=11%, signal=42%  NA
4  1e-10
6: 0  0 491  tags=28%, list=4%, signal=29%  NA
4  1e-10

> head(fdr2_sorted)
   NAME GS follow
link to MSigDB  GS DETAILS SIZE ES   NES NOM p-val
1: GO_DNA_PACKAGING_COMPLEX
GO_DNA_PACKAGING_COMPLEX Details ...   77  0.6757226  2.466745
0
2:   GO_PROTEIN_DNA_COMPLEX
GO_PROTEIN_DNA_COMPLEX Details ...  132  0.5958179  2.346520 0
3: GO_RESPONSE_TO_TYPE_I_INTERFERON
GO_RESPONSE_TO_TYPE_I_INTERFERON Details ...   52 -0.7521569 -2.533148
0
4:  GO_RESPONSE_TO_INTERFERON_GAMMA
GO_RESPONSE_TO_INTERFERON_GAMMA Details ...  101 -0.6370415 -2.420473
   0
5: GO_CELLULAR_RESPONSE_TO_INTERFERON_GAMMA
GO_CELLULAR_RESPONSE_TO_INTERFERON_GAMMA Details ...   85 -0.6571892
-2.402153 0
6: GO_GRANULOCYTE_MIGRATION
GO_GRANULOCYTE_MIGRATION Details ...   43 -0.7332099 -2.398983
0
   FDR q-val FWER p-val RANK AT MAX   LEADING EDGE V12
FDR.q.val2
1: 0  0 tags=43%, list=10%, signal=47%  NA
 1e-10
2: 0  01516 tags=39%, list=13%, signal=45%  NA
 1e-10
3: 0  01427 tags=54%, list=12%, signal=61%  NA
 1e-10
4: 0  01819 tags=45%, list=16%, signal=52%  NA
 1e-10
5: 0  01216 tags=38%, list=11%, signal=42%  NA
 1e-10
6: 0  0 491  tags=28%, list=4%, signal=29%  NA
 1e-10

and I would like to get the plot like the one in attach.

Please advise,
Ana
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Problem launching Rcmdr

2020-03-10 Thread Fox, John
Dear Brian,

(Please keep r-help in the loop so that if someone else has this problem 
they'll have something to refer to.)

Your session at start-up seems completely clean, so I'm at a loss to understand 
what the problem is. I, and I assume very many other people, are using the 
Rcmdr with essentially the same Windows setup. What's particularly hard for me 
to understand is that you're able to start the Rcmdr in a second R session. 
Does the first R session have to remain open for this to work?

A next step is to reinstall packages, starting with the Rcmdr package, if you 
haven't already tried that, and eventually to reinstall R, including deleting 
the R package library. BTW, I usually prefer to install R in c:\R\ rather than 
under Program Files so that the system library is used for packages that I 
subsequently install, although it should work perfectly fine to install 
packages into a personal library.

Best,
 John

> -Original Message-
> From: Brian Grossman 
> Sent: Tuesday, March 10, 2020 5:07 PM
> To: Fox, John 
> Subject: Re: [R] Problem launching Rcmdr
> 
> John,
> 
> Thanks for the reply. Here is the output from running sessionInfo() right 
> after
> opening R.
> 
> > sessionInfo()
> R version 3.6.2 (2019-12-12)
> Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64
> (build 18362)
> 
> Matrix products: default
> 
> locale:
> [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United
> States.1252 [3] LC_MONETARY=English_United States.1252 [4]
> LC_NUMERIC=C [5] LC_TIME=English_United States.1252
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
> 
> loaded via a namespace (and not attached):
> [1] compiler_3.6.2
> 
> 
> Brian
> 
> On Tue, Mar 10, 2020 at 8:46 AM Fox, John   > wrote:
> 
> 
>   Dear Brian,
> 
>   Normally I'd expect that a workspace saved from a previous session
> and loaded at the start of the current session would cause this kind of
> anomalous behaviour, but that doesn't explain why the Rcmdr starts up
> properly in a second (concurrent?) session, nor why it doesn't start up
> properly when R is run with the --vanilla switch.
> 
>   Can you report the result of sessionInfo() at the start of a session?
> 
>   If all else fails, you could try uninstalling and reinstalling R and
> packages.
> 
>   Best,
>John
> 
> -
> John Fox, Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> Web: http::/socserv.mcmaster.ca/jfox
> 
> 
>   > On Mar 9, 2020, at 3:25 PM, Brian Grossman
> mailto:gross...@umich.edu> > wrote:
>   >
>   > I'm having a problem with launching Rcmdr. When I try to launch it
> the
>   > first time through R using the command library(Rcmdr) it will go
> through
>   > the process of launching and get to the point where it says
>   >
>   > "Registered S3 methods overwritten by 'lme4':
>   >  method  from
>   >  cooks.distance.influence.merMod car
>   >  influence.merModcar
>   >  dfbeta.influence.merMod car
>   >  dfbetas.influence.merModcar
>   > lattice theme set by effectsTheme()
>   > See ?effectsTheme for details."
>   >
>   > and then it just hangs there and never launches Rcmdr. If you
> launch
>   > another instance of R and run the same command it will complete
> and launch
>   > Rcmdr successfully. I have tried launching R with R.exe --vanilla with
> the
>   > same results.
>   >
>   > The system information is Windows 10 version 1903, i5 8500
> processor, 8GB
>   > RAM, 256Gb  SSD. R version 3.6.2 Platform: x86_64-w64-
> mingw32/x64 (64-bit)
>   >
>   > Hopefully I haven't left out any important information. Thank you
> for any
>   > suggestions.
>   >
>   >   [[alternative HTML version deleted]]
>   >
>   > __
>   > R-help@r-project.org   mailing list --
> To UNSUBSCRIBE and more, see
>   > 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 -- To UNSUBSCRIBE and more, see
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] power for repeated measures ANCOVA

2020-03-10 Thread Debbie Hahs-Vaughn
Is anyone aware of an R package for computing power analysis with repeated 
measures ANCOVA? I realize this message was posted many years ago so am 
wondering if something is now available.



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Announcement: Summer Statistics Institute at UT Austin

2020-03-10 Thread Mahometa, Michael J
The Department of Statistics and Data Sciences at The University of Texas at 
Austin is hosting the 13th annual UT Summer Statistics Institute (SSI) May 
26–29, 2020.  

SSI OVERVIEW:

* SSI attracts participants from academia, health professions and marketing 
firms.
* Participants acquire new statistical knowledge and skills through hands-on 
data analysis.
* SSI provides an exciting venue to build statistical knowledge alongside a 
diverse and dynamic audience.

UT's Summer Statistics Institute (SSI) offers intensive four-day workshops on 
diverse topics from introductory data sciences to advanced statistics. Whether 
you are new to data analysis or a seasoned statistician, SSI provides a unique 
hands-on opportunity to acquire valuable skills directly from experts in the 
field. The UT Summer Statistics Institute (SSI) is open to 700 participants.

Courses span introductory statistics, statistical software, statistical methods 
and statistics applications. Each course will meet for four half-days, either 
mornings or afternoons, for a total of twelve hours. Instructors will post 
lectures, datasets, exercises, and course information on a website accessible 
to enrolled participants. There will be no examinations, and participants will 
receive certificates upon completion. Academic credit will not be issued. 
Please carefully check the specified prerequisite knowledge before enrolling in 
a course.

R Specific Courses for this year include:
* Introduction to Data Analysis and Graphics Using R (AM)
* Introduction to Data Analysis and Graphics Using R (PM)
* Informed Decision Making from Data: Regression Analysis
* Introduction to Bayesian Statistics

The Department of Statistics and Data Sciences now offers credit for 
educational professional development opportunities during our 2020 Summer 
Statistics Institute! Teachers currently working in PK–12 settings can earn 12 
hours of Continuing Professional Education (CPE) by attending one of our 25 
exciting SSI courses held May 26-29, 2020. 

Courses will be held on the UT Campus in Patton Hall (RLP), Flawn Academic 
Center (FAC) and Robert A. Welch Hall (WEL).

For more information and to register:
https://stat.utexas.edu/training/ssi


-

MICHAEL J. MAHOMETA
Director of Statistical Consulting and Professional Education
Department of Statistics and Data Sciences  |  The University of Texas at Austin
2317 Speedway, Stop D9800 | Austin, TX 78712
o: 512-471-4542  |  stat.utexas.edu

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Problem launching Rcmdr

2020-03-10 Thread Fox, John
Dear Brian,

Normally I'd expect that a workspace saved from a previous session and loaded 
at the start of the current session would cause this kind of anomalous 
behaviour, but that doesn't explain why the Rcmdr starts up properly in a 
second (concurrent?) session, nor why it doesn't start up properly when R is 
run with the --vanilla switch.

Can you report the result of sessionInfo() at the start of a session?

If all else fails, you could try uninstalling and reinstalling R and packages.

Best,
 John

  -
  John Fox, Professor Emeritus
  McMaster University
  Hamilton, Ontario, Canada
  Web: http::/socserv.mcmaster.ca/jfox

> On Mar 9, 2020, at 3:25 PM, Brian Grossman  wrote:
> 
> I'm having a problem with launching Rcmdr. When I try to launch it the
> first time through R using the command library(Rcmdr) it will go through
> the process of launching and get to the point where it says
> 
> "Registered S3 methods overwritten by 'lme4':
>  method  from
>  cooks.distance.influence.merMod car
>  influence.merModcar
>  dfbeta.influence.merMod car
>  dfbetas.influence.merModcar
> lattice theme set by effectsTheme()
> See ?effectsTheme for details."
> 
> and then it just hangs there and never launches Rcmdr. If you launch
> another instance of R and run the same command it will complete and launch
> Rcmdr successfully. I have tried launching R with R.exe --vanilla with the
> same results.
> 
> The system information is Windows 10 version 1903, i5 8500 processor, 8GB
> RAM, 256Gb  SSD. R version 3.6.2 Platform: x86_64-w64-mingw32/x64 (64-bit)
> 
> Hopefully I haven't left out any important information. Thank you for any
> suggestions.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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] I am struggling with contrasts

2020-03-10 Thread Berwin A Turlach
G'day all,

On Tue, 10 Mar 2020 11:07:13 +
"Viechtbauer, Wolfgang (SP)"
 wrote:

> The linearHypothesis() function from the 'car' package does this.

The function glht() in the 'multcomp' package should also be able to do
this.  

The 'emmeans' package might also be useful.

Will be off-line for a while now, but might look at the example again
and how to do it with 'multcomp' or 'emmeans' later.

Cheers,

Berwin

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] I am struggling with contrasts

2020-03-10 Thread Viechtbauer, Wolfgang (SP)
Dear John,

The linearHypothesis() function from the 'car' package does this.

>From the help file: "The value of the linear hypothesis and its covariance 
>matrix are returned respectively as "value" and "vcov" attributes of the 
>object (but not printed)." For  a single linear combination, vcov will be a 
>single value and its square-root the SE.

Best,
Wolfgang

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Sorkin, John
Sent: Tuesday, 10 March, 2020 11:51
To: peter dalgaard; Berwin A Turlach
Cc: r-help@r-project.org (r-help@r-project.org)
Subject: Re: [R] I am struggling with contrasts

I have not clearly stated my question. I would like to obtain the point 
estimate and SE (or point estimate and 95% CI) of a linear combination of the 
the independent variables included in my regression model. In a simple model 
having a single categorical variable that has two levels (Group1 and Group2) 
obtaining the estimate and its SE (or the estimate and a 95% CI) requires 
knowing the betas produced by the model, the SEs of the betas (which are easily 
obtained) along with the variance covariance of the estimates. I assume that 
the variance covariance matrix can be obtained but working the the matrix is a 
real pain. I am looking for a SIMPLE way to get the point estimate and its SE 
without having to slog though getting all the estimates, their SEs manually 
adding them together and including the covariances.
For example if my model is

rate = group and group has the value 1, I want:

beta rate = beta intercept + beta group
variance rate = variance intercept + variance group + 2*covariance 
(intercept,group)

I suspect I can do this calculation manually, but I would really like to find a 
way that R will do the computation for me.

My regression model is:
fit1 <- glm(HGE ~ Group,family=quasipoisson(link="log"), 
data=dataForR,offset=logFU)

In SAS this can be accomplished using estimate statements; I suspect that is an 
R analogue of the SAS estimate statement, but I don't know that the analogue is 
.

Thank you,

John

Particular thanks are due to Peter Dalgaard, Berwin Turlach, and Mark Leeds who 
responded to my original, not well formulated posting.

Thank you,

John

John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric 
Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] I am struggling with contrasts

2020-03-10 Thread Sorkin, John
I have not clearly stated my question. I would like to obtain the point 
estimate and SE (or point estimate and 95% CI) of a linear combination of the 
the independent variables included in my regression model. In a simple model 
having a single categorical variable that has two levels (Group1 and Group2) 
obtaining the estimate and its SE (or the estimate and a 95% CI) requires 
knowing the betas produced by the model, the SEs of the betas (which are easily 
obtained) along with the variance covariance of the estimates. I assume that 
the variance covariance matrix can be obtained but working the the matrix is a 
real pain. I am looking for a SIMPLE way to get the point estimate and its SE 
without having to slog though getting all the estimates, their SEs manually 
adding them together and including the covariances.
For example if my model is

rate = group and group has the value 1, I want:

beta rate = beta intercept + beta group
variance rate = variance intercept + variance group + 2*covariance 
(intercept,group)

I suspect I can do this calculation manually, but I would really like to find a 
way that R will do the computation for me.

My regression model is:
fit1 <- glm(HGE ~ Group,family=quasipoisson(link="log"), 
data=dataForR,offset=logFU)

In SAS this can be accomplished using estimate statements; I suspect that is an 
R analogue of the SAS estimate statement, but I don't know that the analogue is 
.

Thank you,

John

Particular thanks are due to Peter Dalgaard, Berwin Turlach, and Mark Leeds who 
responded to my original, not well formulated posting.



Thank you,

John





John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric 
Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)



From: peter dalgaard 
Sent: Tuesday, March 10, 2020 5:07 AM
To: Berwin A Turlach 
Cc: Sorkin, John ; r-help@r-project.org 
(r-help@r-project.org) 
Subject: Re: [R] I am struggling with contrasts

Yes. Contrasts, by definition, represents between-group differences, so cannot 
yield individual group levels. The closest you get is that the _intercept_ is 
the level of the base group in treatment contrasts, and relevel() will allow 
you to change the base level.

-pd

> On 10 Mar 2020, at 04:06 , Berwin A Turlach  wrote:
>
> G'day John,
>
> On Tue, 10 Mar 2020 01:42:46 +
> "Sorkin, John"  wrote:
>
>> I am running a Poisson regression with a single outcome variable,
>> HGE, and a single independent variable, a factor, Group which can be
>> one of two values, Group1, or Group2. I am trying to define contrasts
>> that will give me the values of my outcome variable (HGE) when
>> group=Group1 and when group=Group2.
>
> Not sure what you mean, but I am suspecting you are after this output:
>
> R> fit0 <- glm(HGE ~ Group - 1,family=poisson,data=dataForR,offset=logFU)
> R> summary(fit0)
>
> Cheers,
>
>Berwin
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=02%7C01%7C%7C4b9ea7f815e0494abf0908d7c4d2770c%7C717009a620de461a88940312a395cac9%7C0%7C0%7C637194280543093844&sdata=QFyKBzxZfkXAjASSUYsSnMJ1CiZIjXDK6JEgKHrV5vg%3D&reserved=0
> PLEASE do read the posting guide 
> https://nam03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.R-project.org%2Fposting-guide.html&data=02%7C01%7C%7C4b9ea7f815e0494abf0908d7c4d2770c%7C717009a620de461a88940312a395cac9%7C0%7C0%7C637194280543093844&sdata=pf%2BQVOSaoGq5HwJ1QjMawCArFC1yjpG9yL%2Fs5dv5wJw%3D&reserved=0
> and provide commented, minimal, self-contained, reproducible code.

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com










[[alternative HTML version deleted]]

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


Re: [R] Error with stepwise models selection using NADA library

2020-03-10 Thread Abby Spurdle
I'm assuming that you're referring to MASS::stepAIC.

There's a few problems here.
Firstly, I don't think stepAIC is compatible with S4 objects.

My first strategy was to create another class.
However, that requires many new methods.
(And the stepAIC documentation doesn't say what methods are needed).

My second strategy was to wrap the cenreg function and return a modified
copy of the survreg object.
This appears to work, but there are complications using the update and
terms functions.

Also, I got the impression that the return value from calling the term
function on the NADA-based objects, is also not compatible with the stepAIC
function, possible causing the S4 error messages.

I got the following working, hopefully...

--
library (NADA)
library (MASS)
data (TCEReg)

cenreg.auto <- function (formula, ...)
{   mfit <- cenreg (formula, ...)@survreg
class (mfit) <- c ("cenreg.auto", class (mfit) )
mfit$call <- match.call ()
mfit
}

update.cenreg.auto <- function (object, formula, ..., evaluate=TRUE)
{   call <- object$call
f0 <- eval (call [[2]])
f0 <- update.formula (f0, formula)
call [[2]] <- as.call (f0)
if (evaluate)
{object <- eval (call)
object$call <- call
object
}
else
call
}

terms.cenreg.auto <- function (x, ...)
{  terms <- main.formula
   attributes (terms) <- attributes (x$terms)
   terms
}

#main dataset
#(current code needs this to be *global*)
attach (TCEReg)

#simulated data
#model sometimes picks these up
#(correct or bug?)
xrand <- 50 * sample (LandUse)
yrand <- 50 * sample (Depth)

#main formula
#(current code needs this to be *global* too)
main.formula <- Cen (TCEConc, TCECen) ~ LandUse + xrand + Depth + yrand

#fit
#(current code needs *formula duplicated*)
myfit <- cenreg.auto (Cen (TCEConc, TCECen) ~ LandUse + xrand + Depth +
yrand)

bestfit.if.lucky <- stepAIC (myfit, Cen (TCEConc, TCECen) ~ .)

detach (TCEReg)

print (bestfit.if.lucky)
--

There are some problems with this code:
(1) Both the dataset and formula need to be in the global environment.
(2) The formula needs to be typed twice.

I don't consider this good R code.
However, I'm not an expert on formula objects, and I spent more time on
this problem than planned.
Someone who is an expert on formula objects could improve this,
substantially.

The other thing to note, is that I included some terms in the input, that
contain random numbers.
They appear in the final model, more frequently than I initially expected.
However, I'm not familiar with the type regression that you're using, so
can't really say how often this should happen.


On Sat, Mar 7, 2020 at 1:21 AM Marco Gabrielli 
wrote:

> Hi,
> I'm working with environmental data which are left-censored and I found the
> R package NADA which seems to do the job.
> After fitting a complete model, using the cenreg function,I'd like to do a
> stepwise procedure to minimize the AIC using the stepAIC function.
> Unfortunately, after fitting the model, the stepAIC does not work with
> either the cenreg object or the S3 survreg object within.
>
> Here it is an example of the commands used:
>
> library(NADA)
> MLEtot=with(df, cenreg(Cen(Y,Cen)~x1+x2+x3+x4,dist="lognormal"))
> stepAIC(MLEtot)
> "Error: $ operator not defined for this S4 class"
> stepAIC(MLEtot@survreg)
> "Start:  AIC=6.16
> asSurv(Cen(Y, Cen)) ~ x1 + x2 + x3 + x4
> Error in (function (classes, fdef, mtable)  :
>unable to find an inherited method for function ‘asSurv’ for signature
> ‘"Surv"’"
>
> How can I do manage to make it work?
> Thanks
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] I am struggling with contrasts

2020-03-10 Thread peter dalgaard
Yes. Contrasts, by definition, represents between-group differences, so cannot 
yield individual group levels. The closest you get is that the _intercept_ is 
the level of the base group in treatment contrasts, and relevel() will allow 
you to change the base level.

-pd

> On 10 Mar 2020, at 04:06 , Berwin A Turlach  wrote:
> 
> G'day John,
> 
> On Tue, 10 Mar 2020 01:42:46 +
> "Sorkin, John"  wrote:
> 
>> I am running a Poisson regression with a single outcome variable,
>> HGE, and a single independent variable, a factor, Group which can be
>> one of two values, Group1, or Group2. I am trying to define contrasts
>> that will give me the values of my outcome variable (HGE) when
>> group=Group1 and when group=Group2. 
> 
> Not sure what you mean, but I am suspecting you are after this output:
> 
> R> fit0 <- glm(HGE ~ Group - 1,family=poisson,data=dataForR,offset=logFU)
> R> summary(fit0)
> 
> Cheers,
> 
>   Berwin
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.