Displaying 20 results from an estimated 8000 matches similar to: "Seeking help for outomating regression (over columns) and storing selected output"
2017 Aug 22
4
boot.stepAIC fails with computed formula
I'm trying to use boot.stepAIC for feature selection; I need to be able to specify the name of the dependent variable programmatically, but this appear to fail:
In R-Studio with MS R Open 3.4:
library(bootStepAIC)
#Fake data
n<-200
x1 <- runif(n, -3, 3)
x2 <- runif(n, -3, 3)
x3 <- runif(n, -3, 3)
x4 <- runif(n, -3, 3)
x5 <- runif(n, -3, 3)
x6 <- runif(n, -3, 3)
x7
2017 Aug 22
1
boot.stepAIC fails with computed formula
SImplify your call to lm using the "." argument instead of
manipulating formulas.
> strt <- lm(y1 ~ ., data = dat)
and you do not need to explicitly specify the "1+" on the rhs for lm, so
> frm2<-as.formula(paste(trg," ~ ", paste(xvars,collapse = "+")))
works fine, too.
Anyway, doing this gives (but see end of output)"
bst <-
2017 Aug 22
1
boot.stepAIC fails with computed formula
Failed? What was the error message?
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Aug 22, 2017 at 8:17 AM, Stephen O'hagan
<SOhagan at manchester.ac.uk> wrote:
> I'm trying to use boot.stepAIC for
2017 Aug 22
0
boot.stepAIC fails with computed formula
The error is "the model fit failed in 50 bootstrap samples
Error: non-character argument"
Cheers,
SOH.
On 22/08/2017 17:52, Bert Gunter wrote:
> Failed? What was the error message?
>
> Cheers,
>
> Bert
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka
2009 Sep 22
2
Semi continous variable- define bounds using lpsolve
How to define bounds for a semi continous variable in lp_solve.
Min 5x1 +9x2 +7.15x3 +0.1x4
subject to
x1+x2+x3+x4=6.7
x1+x4 <= 6.5
And x3 can be 0 or greater than 3.6
hence x3 is a semi continous variable
how to define bounds as well as semicontinous function because using
set.semicont and set. bound simantaneously doesn't seem to work.Thanks in
advance for the help
--
View this
2004 Jun 06
4
Request help writing a function
I have been wrestling with this function for quite a while, and am not making headway.
1) I want to apply a function to the following columns of a dataframe:
myfunction. <- apply(ph5028[,c(83:107)],2,function(x) ...
2) Within each of the above columns there is a single numeric code, 1, 2 or 3 or an NA.
3) My goal is to determine the percent of time each person used a 2 code. So if a person
2017 Aug 23
3
boot.stepAIC fails with computed formula
Until I get a fix that works, a work-around would be to rename the 'y1' column, used a fixed formula, and rename it back afterwards.
Thanks for your help.
SGO.
-----Original Message-----
From: Bert Gunter [mailto:bgunter.4567 at gmail.com]
Sent: 22 August 2017 20:38
To: Stephen O'hagan <SOhagan at manchester.ac.uk>
Cc: r-help at r-project.org
Subject: Re: [R] boot.stepAIC
2017 Aug 23
0
boot.stepAIC fails with computed formula
It seems that if you build the formula as a character string, and
postpone the "as.formula" into the lm call, it works.
instead of
frm1 <- as.formula(paste(trg,"~1"))
use
frm1a <- paste(trg,"~1")
and then
strt <- lm(as.formula(frm1a),dat)
regards,
Heinz
Stephen O'hagan wrote/hat geschrieben on/am 23.08.2017 12:07:
> Until I get a fix that works, a
2004 Mar 04
4
A file manipulation question
Hello R experts,
The following problem outstrips my current programming knowledge.
I have a dataframe with two fields that looks like the following:
ID Contract
01 1
01 1
02 2
02 3
02 1
03 2
03 2
03 2
03 1
03 1
03 1
etc...
I would like to end up with a dataframe with one row per ID where the value in the contract field would be the
2004 Dec 21
2
How to display each symbol in a different color using plot with summary.formula.reverse
Dear R Masters,
I have searched high and low (the help archives and my various R reference material and help files) for a solution to what appears to me to be quite a simple problem. In the following syntax, variable n10 has three levels. I would like the symbols that appear in the graph for these three levels to be different colors. The best I have been able to do is to have the Key display
2017 Aug 22
0
boot.stepAIC fails with computed formula
OK, here's the problem. Continuing with your example:
strt1 <- lm(y1 ~1, dat)
strt2 <- lm(frm1,dat)
> strt1
Call:
lm(formula = y1 ~ 1, data = dat)
Coefficients:
(Intercept)
41.73
> strt2
Call:
lm(formula = frm1, data = dat)
Coefficients:
(Intercept)
41.73
Note that the formula objects of the lm object are different: strt2
does not evaluate the formula. So
2005 Aug 25
1
Attempting to recode elements contained in a list
Hello R-Masters,
I have a list 's' with three elements, as shown below. I want to recode a.a, a.a2, and a.a3 to NA if the value in a.a is less than 3.
I reivewed my Modern Applied Statistic Book, the online help and did some searching of R-help on the internet. I explored unlist and as.list.data.frame in an attempt to isolate the third element of the list s, but this was not helpful.
2006 Jul 26
3
Polymorphic Association with Single Table Inheritance?
Hello,
is it possible to setup a model/table schema like this:
Groupable --> Membership <-- Group
^ ^
| |
User UserGroup
I tried the following but failed:
Groupable (table with ''type'' column)
has_many :memberships, :as => :groupable
has_many :groups, :through => :memberships
2004 Oct 06
8
Dataframe manipulation question
Hello,
I have a data frame that has three fields.
Resp# ActCode ProdUsed
100 3 2
100 3 2
100 4 3
100 4 3
101 3 6
102 2 1
102 3 1
103 5 1
103 5 1
103
2006 Apr 27
1
deleting rows with the same ID if any meet a condition
Hello R masters,
This request is being made after searching through archive mailing list.
I have a "many" table in a medical application where each injury a person suffers is recorded as a separate row. In my toy example below it means respondent #1 had three injuries and so on.
If x2 equal 2 then I want to delete all the rows for that person from the dataframe--see Before and After
2007 Sep 20
1
Relationship Proxies?
I''m trying to understand these results in irb, which implies that
there''s some kind of proxy at play:
>> aaron = User.find_by_login ''aaron''
=> #<User:0xb7109cdc
@attributes={"salt"=>"7e3041ebc2fc05a40c60028e2c4901a81035d3cd",
"updated_at"=>nil, "contact_info_id"=>nil,
2003 Aug 18
1
Would like to apply a weight variable to the summary function in Hmisc
Hello,
In the Hmisc package, functions describe and summarize can explicitly take a
weight variable.
My question is can a weight variable be applied when using 'summary'?
For example, using...summary(var1 ~ var2) I would like to weight the data
by var 3 (same length).
Is this possible?
Thanks a lot.
Greg Blevins
The Market Solutions Group, Inc.
2003 Oct 07
3
Problem getting an ifelse statment to work
This is a "long" way; i.e., not necessarily efficient:
> qs2
[1] 2 1 1 4 4 4 1 1 1 4 2 4 3 1 4 3 3 2 4 3
> qs9
[1] 4 4 1 3 4 3 1 3 1 4 1 2 3 3 4 4 1 4 2 3
> decision <- function(a, b) {
+ if (a == 1 || b == 1) return(1)
+ if (a == 2 || b == 2) return(2)
+ if (a == 3 || b == 3) return(3)
+ if (a == 4 || b == 4) return(4)
+ NA
+ }
> mapply(decision,
2006 Oct 25
4
need help on special HABTM relation
hey all,
I have three tables like this:
forum (id,title)
usergroup(id,title)
forum_perms(usergroup_id,forum_id,read,write,post)
is there a way to deal with that kind of relation with rails such as by
using has_and_belongs_to_many kind of stuff?
thanx in advance
Pat
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
2006 Apr 17
3
model.models.models or model.models.find(:first).models
I the following three models which all have has_and_belongs_to_many
# User <-> UserGroup <-> Permissions
class UserGroup < ActiveRecord::Base
has_and_belongs_to_many :users, :join_table => "user_usergroup_join"
has_and_belongs_to_many :permissions, :join_table =>
"usergroup_permission_join", :uniq => true
end
I can do this:
permissions =