# Inverse Gaussian Distribution

7 messages
Open this post in threaded view
|

## Inverse Gaussian Distribution

 Dear, I want to fit an inverse gaussion distribution to a data set. The predictor variables are gender, area and agecategory. For each of these variables I've defined a baseline e.g. #agecat: baseline is 3 data<-transform(data, agecat=C(factor(agecat,ordered=TRUE), contr.treatment(n=6,base=3))) The variable 'area' goes from A to F (6 areas: A,B,C,D,E,F) How can i manipulate the data to set the baseline of area to C? R is producing errors when I'm trying to do so. I'll be very thankful for any help you can provide. Louisa
Open this post in threaded view
|

## Re: Inverse Gaussian Distribution

 On Jan 3, 2011, at 3:03 PM, Louisa wrote: > > Dear, > > I want to fit an inverse gaussion distribution to a data set. > > The predictor variables are gender, area and agecategory. > For each of these variables I've defined a baseline > > e.g. > #agecat: baseline is 3 > data<-transform(data, agecat=C(factor(agecat,ordered=TRUE), > contr.treatment(n=6,base=3))) > > The variable 'area' goes from A to F (6 areas: > > How can i manipulate the data to set the baseline of area to C? > R is producing errors when I'm trying to do so. In all likelihood it's a factor. Try area <- factor(area, levels=c("C", "A","B","D","E","F") ) If not, then you need to provide more information. Read the Posting   Guide. > > I'll be very thankful for any help you can provide. > > Louisa > -- > View this message in context: http://r.789695.n4.nabble.com/Inverse-Gaussian-Distribution-tp3172533p3172533.html> Sent from the R help mailing list archive at Nabble.com. > David Winsemius, MD West Hartford, CT ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: Inverse Gaussian Distribution

 In reply to this post by Louisa Hi: "How can i manipulate the data to set the baseline of area to C? R is producing errors when I'm trying to do so." See ?relevel Dennis On Mon, Jan 3, 2011 at 12:03 PM, Louisa <[hidden email]> wrote: > > Dear, > > I want to fit an inverse gaussion distribution to a data set. > > The predictor variables are gender, area and agecategory. > For each of these variables I've defined a baseline > > e.g. > #agecat: baseline is 3 > data<-transform(data, agecat=C(factor(agecat,ordered=TRUE), > contr.treatment(n=6,base=3))) > > The variable 'area' goes from A to F (6 areas: A,B,C,D,E,F) > > How can i manipulate the data to set the baseline of area to C? > R is producing errors when I'm trying to do so. > > I'll be very thankful for any help you can provide. > > Louisa > -- > View this message in context: > http://r.789695.n4.nabble.com/Inverse-Gaussian-Distribution-tp3172533p3172533.html> Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. >         [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: Inverse Gaussian Distribution

 In reply to this post by Louisa Thank you! But i'm wondering: if you run   area <- factor(area, levels=c("C", "A","B","D","E","F") ) then you are transforming only 'area',  aren't you? isn't it possible to transform the whole data like i did for agecat but now for area and area C as baseline, or are you doing so when you run > area <- factor(area, levels=c("C", "A","B","D","E","F") ) > attach(data) and then run the model with area as predictorvariable:  > model <- glm(Y~ agecat+gender+area,...) My question is if i can run it as follows and still have a right solution : > data <-transform(data, area=(factor(area, levels=c("C", "A","B","D","E","F") ) ) I'll be very grateful for any help you can provide! Kind regards, Louisa
Open this post in threaded view
|

## Re: Inverse Gaussian Distribution

 On Jan 4, 2011, at 7:50 AM, Louisa wrote: > > Thank you! > > But i'm wondering: > > if you run > > area <- factor(area, levels=c("C", "A","B","D","E","F") ) > > then you are transforming only 'area',  aren't you? > > isn't it possible to transform the whole data like i did for agecat > but now for area and area C as baseline, Of course, but may I point out that you did no earlier say that you   may have attached a dataframe containing "area". There are many   confusing situations that arise when using attached dataframes and   this may be one of them. Many experienced R users avoid attaching data   objects like the plague. > > or are you doing so when you run > >> area <- factor(area, levels=c("C", "A","B","D","E","F") ) >> attach(data) > > and then run the model with area as predictorvariable: > >> model <- glm(Y~ agecat+gender+area,...) > > My question is if i can run it as follows and still have a right   > solution : > >> data <-transform(data, area=(factor(area, levels=c("C", >> "A","B","D","E","F") ) ) Is there any reason that you suspect this will not work? Why not try   it ... now assumimg that you failed to tell us that area was a column   in a dataframe that is. (One set of parentheses appear extraneous.) data <-transform(data, area = factor(area, levels=c("C",   "A","B","D","E","F") ) (Untested in the absence of reproducible example ,,, but it looks as   though it might work.) > > I'll be very grateful for any help you can provide! > > Kind regards, > > Louisa > > > -- > View this message in context: http://r.789695.n4.nabble.com/Inverse-Gaussian-Distribution-tp3172533p3173468.html> Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. David Winsemius, MD West Hartford, CT ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.