[R] AIC in MuMIn
Gavin Simpson
gavin.simpson at ucl.ac.uk
Wed Aug 18 15:18:46 CEST 2010
On Wed, 2010-08-18 at 21:11 +0800, elaine kuo wrote:
> A cause other than data based on standardized regression
> was identified.
> It is that the manual command added with target <- at the left hand
> side.
> C1 did not work but C2 did.
> C1 target<-dredge(mig.stds, subset = temp_max)
>
>
> C2 dredge(mig.stds, subset = temp_max)
Glad you have this working, but that can't possibly be the reason for
the error. There must be something else going on. The only difference
between the two calls is that you are storing the result somewhere, yet
the error was coming from within the running of the dredge function.
If everything works from within a new, clean R session then great.
G
>
>
> Elaine
>
> On Wed, Aug 18, 2010 at 5:37 PM, elaine kuo <elaine.kuo.tw at gmail.com>
> wrote:
>
>
> >
> Please suggest how to define subset in my case
>
>
> How would I know? I still haven't seen your data. You
> seem to be
> mistaken on what is and is not included in your model
> and you fitted it.
> What hope do we have...? However, given the model
> 'mig.stds' from above
> in this email:
>
> > mig.stds <-lm(SummerM_ratio ~ temp_max + evi_mean +
> topo_var +
> > topo_mean + coast + Iso_index_0808,
> > ## now tell R were to find the
> variables in formula
> > data = datum.std)
> > ## If you are fitting a Gaussian GLM it is better
> fitted with lm()
>
>
> If you want to consider dredged models containing
> temp_max, then you
> would do
>
> dredge(mig.stds, subset = temp_max)
>
> If you want models that contain temp_max and coast,
> then you'd do
>
> dredge(mig.stds, subset = temp_max & coast)
>
> or
>
> dredge(mig.stds, fixed = ~ temp_max + coast)
>
> The bits you include in subset or fixed are the names
> of your variables
> that you want in or out of the models. In your case,
> the names of the
> variables as input into the model formula. With
> 'subset' you need to use
> logical operators (and [&], or [|]) whilst with
> 'fixed' you can specify
> a formula of variables that should be included or
> excluded in the same
> way you'd write any R formula.
>
> But, now having been told this, please note that this
> is *all* discussed
> on the ?dredge help page if you bother to read it.
> I've never used this
> package, and, OK, I have used R for going on for 11 or
> 12 years now so
> am used to reading help pages and understand the
> language a bit more you
> perhaps do, but you do seem to be asking questions or
> running into
> problems that are all covered by the help pages.
>
>
> => I posted it for help, after following the manual
> with the command dredge but receiving an error message
> two days ago.
>
> command target<-dredge(mig.stds, subset =
> temp_max)
> error in eval(expr, envir, enclos) : 'temp_max' not found
>
>
> One possible cause could be data = datam.std.
> datam.std was produced as the code below, which seemed to
> make it hard to find explanatory variables.
> Please kindly share your experience in R, because I am unsure
> if my assumption is logical or not.
>
>
> Also, please kindly advise how to modify the command for
> dredging subset if possible.
> ( command target<-dredge(mig.stds, subset = temp_max))
> Thank you in advance.
>
>
> Elaine
>
>
> code
> library(MuMIn)
> datam
> <-read.csv("c:/migration/Mig_ratio_20100817.csv",header=T,
> row.names=1)
>
> # std regression model (16 indep. variables)
> datam.sd<-scale(datam)
> datam.std<-as.data.frame(datam.sd)
> summary (datam.std)
> mean(datam.std)
>
>
> # obtain standard deviation
> sd(datam.std)
>
>
> mig.stds <-lm(SummerM_ratio~temp_ran+temp_mean+temp_max
> +temp_min+evi_ran+evi_mean+evi_max+evi_min+prec_ran+prec_mean
> +prec_max+prec_min+topo_var+topo_mean+coast
> +Iso_index_0808,data=datam.std)
>
> summary(mig.stds)
>
>
>
>
>
>
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list