Displaying 20 results from an estimated 97 matches for "relevel".
2010 Aug 03
1
releveling a numeric by factor interaction
Can anyone help me with the necessary code to relevel a numeric*factor
interaction term in a linear model? I would like to report the estimate,
std. error and t-value for the reference factor.
First, I estimated a linear model with dummy variables and was able to
retrieve model estimates for the reference factor using relevel.
for example:
> su...
2009 Jan 09
2
recursive relevel
Dear list,
I'm having second thoughts after solving a very trivial problem: I
want to extend the relevel() function to reorder an arbitrary number
of levels of a factor in one go. I could not find a trivial way of
using the code obtained by getS3method("relevel","factor"). Instead, I
thought of solving the problem in a recursive manner (possibly after
reading Paul Graham es...
2004 Dec 22
0
relevel expansion suggestion
To the R developers,
The discussion below reminded me that I think it might be a good idea
to take the Relevel function from the Lexis package and replace relevel
in stats with it. This is really nothing special for epidemiology.
It is fully compatible with the existing relevel (it actually contains
the
relevel code almost verbatim as a subset), but it has the extra
functionality
of combining levels.
I pu...
2017 Oct 28
2
Function Relevel DOE NOT FOUND
Dear Forum,
Which functions and packages should be installed to make work the function "relevel"?
treatment<-revel(treatment,ref="Db")
Error: no se pudo encontrar la funci?n "revel"
Thank you very much for your help,
Xavier Chiriboga M.
PhD Candidate
Fundamental and Applied Research in Chemical Ecology Lab.
Institute of Biology
University of Neuchatel
Websit...
2017 Oct 28
2
HELP relevel INTERCEPT-COMPARISONS
Dear colleagues,
How can I do to "relevel" the intercept?
I need that the treatment "Db" be the intercept, and have p-values for the comparisons with the others treatments.
I used the function "relevel" but it did not work out to have what I want.
Thanks for your help,
Xavier
T1 <- read.table(file.choose(...
2012 Jan 16
2
Relevel dynamically
Dear list,
I am running R code which produces a data.frame with variable rows. For
plotting purposes I need to relevel
the column called "names" but since the dimension of the data.frame can vary
I do not know how to dynamically
revel the data.frame.
Here is an example data.frame called df to illustrate what I try to achieve:
> df <- data.frame(cbind(c("a","b","c",&q...
2018 Oct 02
1
Relevel confusing with numeric value
Something that bit me:
The function relevel takes a factor, and a reference level to be promoted to the first place.
If ?ref? is a character this level is promoted, if it?s a numeric the ?ref?-th level is promoted.
Which turns out to be very confusing if you have factor with numeric values (e.g. when reading in a csv with some dirty numeric...
2006 Dec 15
1
Switching labels on a factor
Hi All,
I'm perplexed by the way the unclass function displays a factor whose
labels have been swapped with the relevel function. I realize it won't
affect any results and that the relevel did nothing useful in this
particular case. I'm just doing it to learn ways to manipulate factors.
The display of unclass leaves me feeling that the relevel had failed.
I've checked three books & searched R-help,...
2017 Jul 05
2
Svyglm Error
...ct which applies the BRR weights
elsq1ch_brr<-svrepdesign(variables = elsq1ch[,1:16], repweights = elsq1ch[,18:217], weights = elsq1ch[,17], combined.weights = TRUE, type = "BRR")
elsq1ch_brr
##Resetting baseline levels for predictors
elsq1ch_brr <- update( elsq1ch_brr , F1HIMATH = relevel(F1HIMATH,"PreAlg or Less") )
elsq1ch_brr <- update( elsq1ch_brr , BYINCOME = relevel(BYINCOME,"0-25K") )
elsq1ch_brr <- update( elsq1ch_brr , F1RACE = relevel(F1RACE,"White") )
elsq1ch_brr <- update( elsq1ch_brr , F1SEX = relevel(F1SEX,"Male") )
elsq...
2013 Jan 16
1
equivalent code that doesn't return same results?
...at[k],sep="$"))))
[1] TRUE
However, when I write the following code, which is the same in both cases
(except that the first case uses expression (1) above and the second case
uses expression (2)), it works in the first case but returns an error code
in the second:
> dataset$method<-relevel(dataset$method,ref="online")
This code properly changes the reference level as desired.
> eval(parse(text=paste("dataset",IVcat[k],sep="$")))<-relevel(eval(parse(text=paste("dataset",IVcat[k],sep="$"))),ref="online")
This code ret...
2017 Jul 05
0
Svyglm Error
...gt; elsq1ch_brr<-svrepdesign(variables = elsq1ch[,1:16], repweights =
> elsq1ch[,18:217], weights = elsq1ch[,17], combined.weights = TRUE, type =
> "BRR")
> elsq1ch_brr
>
> ##Resetting baseline levels for predictors
> elsq1ch_brr <- update( elsq1ch_brr , F1HIMATH = relevel(F1HIMATH,"PreAlg
> or Less") )
> elsq1ch_brr <- update( elsq1ch_brr , BYINCOME = relevel(BYINCOME,"0-25K") )
> elsq1ch_brr <- update( elsq1ch_brr , F1RACE = relevel(F1RACE,"White") )
> elsq1ch_brr <- update( elsq1ch_brr , F1SEX = relevel(F1SEX,&quo...
2010 Aug 03
0
releveling a numeric by factor interaction in a lm
How can I relevel a liner model with a numeric by dummy variable interaction
to extract the model estimate, std. error, and t-value for the reference
factor?
Thank you,
Christy
[[alternative HTML version deleted]]
2010 Mar 25
3
Returning Data Frame from Function for use Outside Function
...(1:12, 14:15, 21:33, 35:36)]
rm(vbig)
vcohort <- cleanup.import(vcohort)
## Change the reference levels for some of the factor
## values. By default R orders the factor values alphabetically
## and numerically. In some case we wish to choose different
## reference levels
vcohort$GENDER <- Relevel(factor(vcohort$SEX), list("M", "F"), first=TRUE)
vcohort$AGE <- Relevel(factor(vcohort$AGE_CAT), list("4", "2", "3", "1"),
first=TRUE)
vcohort$VISN <- Relevel(factor(vcohort$VISN2), list("8", "1", "2"...
2011 Jan 10
1
debug biglm response error on bigglm model
....df$bin_varname2 <- as.factor(recode(iter.df$varname2_prop,
"0:70 = ' < 70%';
70:85 = ' 70 - 85%';
85:95 = ' 85 - 95%';
95:110 = '95 - 110%'; else = 'missing';
"))
iter.df$bin_varname1 <- relevel(iter.df$bin_varname1, 'missing')
iter.df$bin_age <- relevel(iter.df$bin_age, 'missing')
iter.df$bin_util <- relevel(iter.df$bin_util, 'missing')
iter.df$bin_varname2 <- relevel(iter.df$bin_varname2, 'missing')
#~ print(head(iter.df))
if...
2004 Dec 22
4
ordering levels
...quot;,"red","red","blue","blue","white"))
levels(testf) : blue red white
should have reordered levels such as
levels(testf) : red blue white
(this is for presentation purposes)
I guess I'm looking for a generalized version of "relevel"...
Thanks
Anne
----------------------------------------------------
Anne Piotet
Tel: +41 79 359 83 32 (mobile)
Email: anne.piotet@m-td.com
---------------------------------------------------
M-TD Modelling and Technology Development
PSE-C
CH-1015 Lausanne
Switzerland
Tel: +41 21 693 83 98...
2012 Feb 03
1
ordering of factor levels in regression changes result
...*
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 70.43 on 25 degrees of freedom
Multiple R-squared: 0.4077, Adjusted R-squared: 0.3129
F-statistic: 4.302 on 4 and 25 DF, p-value: 0.008752
Relevel - make 'n25' the base level of Clipping:
> comp$clipping <- relevel (comp$clipping, ref="n25")
> summary(comp)
biomass clipping
Min. :415.0 n25 :6
1st Qu.:508.8 control:6
Median :568.0 n50 :6
Mean :561.8 r10...
2004 May 03
1
Setting up contrasts
I am using the following model:
lm <- lm(mydata[[variableName]] ~ Age + Gender + Group, data=mydata)
There are 5 groups in "Group": nonc (the control), c1,c2,c3 and c4.
How do I contrast nonc vs the others?
and
How do I contrast c1 vs other c's (ie c2,c3,c4 as a subgroup)?
I have looked at the contrasts option in lm and model.matrix and am
really none the wiser.
Though it
2004 Dec 22
0
ordering levels: I was wrong
I was wrong about needing the Relevel from the Lexis package.
The default verson of relevel does the job of reshuffling levels
in any desired order, albeit with a warning (which comes from the
fact that apparently only a single number had been anticipated by
the designer):
> testf <- factor( sample( letters[1:4], 100, replace=...
2010 Jul 07
6
forcing a zero level in contr.sum
I need to use contr.sum and observe that some levels are not statistically different from the overall mean of zero.
What is the proper way of forcing the zero estimate? It seems the column corresponding to that level should become a column of zeros.
Is there a way to achieve that without me constructing the design matrix?
Thank you.
Stephen Bond
[[alternative HTML version deleted]]
2010 Nov 08
1
R help: reorder columns in an xyplot
...The
plot works, but after is on the left and before on the right. This bugs me.
I tried:
veg$status2 <- reorder(veg$status, new.order=c("before", "after"))
but get:
Error in length(X) : 'X' is missing
I also tried:
h <- xyplot(litter.cover ~ status | treatment, relevel(status,
ref=c("before", "after")), data = veg)
but get:
Error in relevel(status, ref = c("before", "after")) :
object 'status' not found
I have noticed that folks request data, but I hope my question is basic
enough without it.
Please be gentl...