[R] Do the missing values in random effect structure matter?

2010-03-25 Thread willow1980
Hi, everyone, I met a problem with mixed effect model with lmer. Basically, I want to treat region and mother ID as a nested random effect structure with mother ID nested within a specific region. However, in my dataset, many subjects had no mother ID (about 25% of them). I want to know, if I use

Re: [R] How to control spaces between axis, tick and label in xyplot or xYplot?

2010-01-11 Thread willow1980
Thanks a lot for your help! I have tried Peter's code: it works perfectly. Hopefully, this method will also be helpful to others with similar problems. Best regards, Jianghua -- View this message in context: http://n4.nabble.com/How-to-control-spaces-between-axis-tick-and-label-in-xyplot-or-xYpl

Re: [R] How to control number of significant digits (figures) in y-axis?

2010-01-11 Thread willow1980
10) > xyplot(y ~ x, >scales = list( > y = list( > at = 1:10, > lab = formatC(1:10, > format = "f", digits = 1 > > ?formatC > ?xyplot > > -Peter Ehlers > > > willow1980 wrote:

[R] How to control number of significant digits (figures) in y-axis?

2010-01-10 Thread willow1980
Dear R users, I encounter a problem regarding number of significant digits on y-axis. Below is my basic code: myplotkid<-xyplot(expected_offspringnumber~afr|decade,groups=SES,data1, auto.key=list(space="right"),layout=c(9,1),xlab="",ylab="Offspring number", aspect="fill",scales=list(x=list(draw=F)

[R] How to control spaces between axis, tick and label in xyplot or xYplot?

2010-01-10 Thread willow1980
Dear R users, I encounter a problem regarding space control in xyplot. Basically, I want to control spaces between label, tick and axis. I remember there is a function called mgp in general plot. Is there a similar function for xyplot or xYplot? Below is my basic code: myplotkid<-xyplot(expected_o

[R] How to calculate standard errors of predictions based on the fixed effects? lmer

2009-11-23 Thread willow1980
Dear R users, I have posted a similar message in the following link: http://old.nabble.com/standard-error-for-the-estimated-value-(lmer-fitted-model)-td26414507.html However, I did not get responses. I guess my question is not clear. Now, I would like to clarify it and if someone is familiar with

Re: [R] Calculating the percentage of explained deviance in lmer

2009-11-21 Thread willow1980
Sorry for making a mistake! It should be, (m...@deviance["wrss"]...@deviance["wrss"])/m...@deviance["wrss"] willow1980 wrote: > > Hi, Fabio, > I only have an idea on how to calculate deviance explained by the fixed > effects. If you remove fixed effects

[R] deviance from lmer model: deviance(model) and sum(resid(model)^2), which one is correct?

2009-11-21 Thread willow1980
Dear R users, I am frustrated by the residual sum of squares calculation. From Statistical Medhods by Snedecor & Cochran, I know sum(resid(model)^2) should be one method. However, there is a automatic code in R for this operation: deviance(model). When I compare the results from these two methods,

Re: [R] Calculating the percentage of explained deviance in lmer

2009-11-21 Thread willow1980
Hi, Fabio, I only have an idea on how to calculate deviance explained by the fixed effects. If you remove fixed effects and introduce one null model such as m2<-lmer(response-var ~ 1+(1|Site/Area/Transect),family="binomial"). Then, (deviance(m2)-deviance(m1))/deviance(m2) will represent deviance e

[R] standard error for the estimated value (lmer fitted model)

2009-11-18 Thread willow1980
Dear R users, I want to draw standard error lines for the predicted regression line estimated by logistic regression using lmer. I have two predictors: cafr and its quadratic form I(cafr^2), where cafr is a variable centered around the mean of original variable. Now, the estimated value from the f

[R] How to deal with multicollinearity in mixed models (with lmer)?

2009-08-16 Thread willow1980
Dear R users, I have a problem with multicollinearity in mixed models and I am using lmer in package lme4. From previous mailing list, I learn of a reply "http://www.mail-archive.com/r-h...@stat.math.ethz.ch/msg38537.html"; which states that if not for interpretation but just for prediction, multi

Re: [R] How to plot 3-D surface graph from lmer mixed models?

2009-08-15 Thread willow1980
lot. Hopefully, this experience can do some help to other users with similar problems. However, I am still trying to use the method suggested by Dr Sarkar, since I think wireframe or levelplot may produce more beautiful pictures. Thank you again! Cheers! willow1980 wrote: > > Dear R users, >

Re: [R] How to plot 3-D surface graph from lmer mixed models?

2009-08-13 Thread willow1980
Dear Professor Murdoch, That is exactly the difficulty for me. I don't know how to make a prediction with lmer using "expand.grid"; at the moment, I can use “mo...@x%*%fixef(model)” to get predicted values for existing observational data, but not data by "expand.grid". Actually, if I know this, I

[R] How to plot 3-D surface graph from lmer mixed models?

2009-08-13 Thread willow1980
Dear R users, I have a problem in plotting 3 dimensional graph using mixed models. My model is sur_prop ~ afr_c+I(afr_c^2)+I(afr_c^3)+byear_c+I(byear_c^2)+I(byear_c^3)+I(byear_c^4)+(1|Studyparish)+afr_c:byear_c +afr_c:I(byear_c^2)+afr_c:I(byear_c^3)+afr_c:I(byear_c^4)+I(afr_c^2):byear_c+I(afr_c^2

Re: [R] A question about using “by” in GAM model fitting of interaction between smooth terms and factor

2009-05-06 Thread willow1980
duct > smooths (`te') may be preferable, as the are independent of the relative > scaling of the variables. For plot interpretability, I'd drop the `main > effect' smooths and just leave in the interaction. > > best, > Simon > > On Tuesday 05 May 2009 16:53, willow1980

Re: [R] smoothing spline in package gam

2009-05-06 Thread willow1980
Sorry, I did not notice you were using GAM package. Most R users are using Simon Wood's MGCV package. I recommend you to use it. I have never used GAM package, so I cannot make further comments. Good luck! 楊 詩韻 wrote: > > > dear all, > > > > i have a little question, but it make me torment

Re: [R] smoothing spline in package gam

2009-05-05 Thread willow1980
Strangely, summary.gam(m1) should give you significance results of parametric terms such as ost, wst, park10, sch50, comm, build and suite. These results should be located above the summary results for smooth terms. Please using summary.gam(m1) to have a look if there is the information you need.

[R] A question about using “by” in GAM model fitting of interaction between smooth terms and factor

2009-05-05 Thread willow1980
I am a little bit confusing about the following help message on how to fit a GAM model with interaction between factor and smooth terms from http://rss.acs.unt.edu/Rdoc/library/mgcv/html/gam.models.html: “Sometimes models of the form: E(y)=b0+f(x)z need to be estimated (where f is a smooth functi

Re: [R] Why there is no p-value from likelihood ratio test using anova in GAM model fitting?

2009-04-28 Thread willow1980
ected automatically). Are you using gam:gam or mgcv:gam (and which > version > numbers)? > > best, > Simon > > On Tuesday 28 April 2009 12:38, willow1980 wrote: >> Hello, everybody, >> There is the first time for me to post a question, because I really >> canno

Re: [R] Why there is no p-value from likelihood ratio test using anova in GAM model fitting?

2009-04-28 Thread willow1980
gam(sum_surv15~s(FLBS)+s(byear)+s(FLBS,byear),family=quasipoisson) anova.gam(modelsurs_fer14,modelsurs_fer13,test="F") # Would you please make further suggestions? Thank you in advance! Jianghua Dieter Menne wrote: > >

[R] Why there is no p-value from likelihood ratio test using anova in GAM model fitting?

2009-04-28 Thread willow1980
Hello, everybody, There is the first time for me to post a question, because I really cannot find answer from books, websites or my colleagues. Thank you in advance for your help! I am running likelihood ratio test to find if the simpler model is not significant from more complicated model. Howeve