Displaying 20 results from an estimated 500 matches similar to: "Cv.glment question -- why giving me an error"
2011 Feb 17
1
cv.glmnet errors
Hi,
I am trying to do multinomial regression using the glmnet package, but the
following gives me an error (for no reason apparent to me):
library(glmnet)
cv.glmnet(x=matrix(c(1,2,3,4,5,6,1,2,3,4,5,6),
nrow=6),y=as.factor(c(1,2,1,2,3,3)),family='multinomial',alpha=0.5,
nfolds=2)
The error i get is:
Error in if (outlist$msg != "Unknown error") return(outlist) :
argument is of
2011 Aug 23
3
GLM question
Hi All,
I am trying to fit my data with glm model, my data is a matrix of size n*100. So, I have n rows and 100 columns and my vector y is of size n which contains the labels (0 or 1)
My question is:
instead of manually typing the model as
glm.fit = glm(y~ x[,1]+x[,2]+...+x[,100], family=binomial())
I have a for loop as follows that concatenates the x variables as follows:
final_str=NULL
for
2009 Aug 28
2
Pls package
Hi,
I have managed to format my data into a single datframe consisting of two AsIs response and predictor dataframes in order to supply the plsr command of the pls package for principal components analysis.
When I execute the command, however, I get this error:
> fiber1 <- plsr(respmat ~ predmat, ncomp=1, data=inputmat,validation="LOO")
Error in model.frame.default(formula =
2012 Jan 06
3
How to fit my data with a distribution?
Dear All,
I have a bunch of data points as follows:
x 100
y 200
z 300
...
where 100, 200, 300 are the values. I would like to know the distribution of my data? how can I fit my data into a distribution?
Thanks a lot,
Andra
[[alternative HTML version deleted]]
2011 Aug 26
2
How to find the accuracy of the predicted glm model with family = binomial (link = logit)
Hi All,
When modeling with glm and family = binomial (link = logit) and response values of 0 and 1, I get the predicted probabilities of assigning to my class one, then I would like to compare it with my vector y which does have the original labels. How should I change the probabilities into values of zero and 1 and then compare it with my vector y to find out about the accuracy of my
2011 Aug 20
2
a Question regarding glm for linear regression
Hello All,
I have a question about glm in R. I would like to fit a model with glm function, I have a vector y (size n) which is my response variable and I have matrix X which is by size (n*f) where f is the number of features or columns. I have about 80 features, and when I fit a model using the following formula,?
glmfit = glm(y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13
2011 Aug 27
1
Grouping variables in a data frame
Hi All,
I have a data frame as follow:
user_id time age location gender
.....
and I learn a logistic regression to learn the weights (glm with family= (link = logit))), my response value is either zero or one. I would like to group the users based on user_id and time and see the y values and predicted y values at the same time. Or plot them some how. Is there any way to somehow group them
2011 Sep 01
4
Question about BIC of two different regression models? how should we compare two regression models?
Hi All,
In order to compare two different logistic regressions, I think I need to compare them based on their BIC values, but I am not sure if the smaller BIC would mean a better model or the reverse is true?
Thanks a lot,Andra
[[alternative HTML version deleted]]
2011 Oct 12
1
CVbinary - Help
Hey,
I need some help.
I want to obtain a cross validation for a regression model (binary response)
but I got an error with CVbinary. Well I did this:
fit <- lm(resp ~ PC1 + PC2 + PC3 + PC4 + PC5 + PC6 + PC7 + PC8 +
PC9+PC10+PC11+PC12+PC13+PC14+PC15+PC16+PC17+PC18+PC19+PC20+PC21+PC22+PC23+PC24+PC25+PC26+PC27+PC28,
data = dexp.cp, family=binomial())
CVbinary(fit)
Error in sample(nfolds, m,
2011 Jan 16
1
Memory issues
Hi,
I have read several threads about memory issues in R and I can't seem to
find a solution to my problem.
I am running a sort of LASSO regression on several subsets of a big dataset.
For some subsets it works well, and for some bigger subsets it does not
work, with errors of type "cannot allocate vector of size 1.6Gb". The error
occurs at this line of the code:
example <-
2009 Sep 21
2
How to handle missing values for the GeneMeta package?
Hello all,
It seems that the GeneMeta passage returns NA in the respective row if
any gene in the data sets to be synthesised are missing. Do you know
of a way to overcome this problem?
I tried using the 'impute' package to fill-in the missing values, but
R crashes if 'impute' and 'GeneMeta' packages are used together. I
have asked a separate question for that.
Thanks
2011 Sep 07
1
Question about model selection for glm -- how to select features based on BIC?
Hi All,
After fitting a model with glm function, I would like to do the model selection and select some of the features and I am using the "step function" as follows:
glm.fit <- glm (Y ~ . , data = dat, family = binomial(link=logit)) AIC_fitted = step(glm.fit, direction = "both")
I was wondering is there any way to select the features based on BIC rather than AIC? is there
2011 Aug 24
1
How to do cross validation with glm?
Hi All,
I have a fitted model called glm.fit which I used glm and data dat is my data frame
pred= predict(glm.fit, data = dat, type="response")
to predict how it predicts on my whole data but obviously I have to do cross-validation to train the model on one part of my data and predict on the other part. So, I searched for it and I found a function cv.glm which is in package boot.
2011 Aug 25
1
How to combine two learned regression models?
Hi All,
I have a set of features of size p and I would like to separate my feature space into two sets so that p = p1 + p2, p1 is a set of features and p2 is another set of features and I want to fit a glm model for each sets of features separately. Then I want to combine the results of two glm models with a parameter beta. For example, beta * F(p1) + (1-beta) * F(p2) where F(p1) is a learned
2011 Aug 10
2
glmnet
Hi All,
I have been trying to use glmnet package to do LASSO linear regression. my x data is a matrix n_row by n_col and y is a vector of size n_row corresponding to the vector data. The number of n_col is much more larger than the number of n_row. I do the following:
fits = glmnet(x, y, family="multinomial")I have been following this
2013 Jul 17
1
glmnet on Autopilot
Dear List,
I'm running simulations using the glmnet package. I need to use an
'automated' method for model selection at each iteration of the simulation.
The cv.glmnet function in the same package is handy for that purpose.
However, in my simulation I have p >> N, and in some cases the selected
model from cv.glmet is essentially shrinking all coefficients to zero. In
this case,
2011 May 01
1
Different results of coefficients by packages penalized and glmnet
Dear R users:
Recently, I learn to use penalized logistic regression. Two packages
(penalized and glmnet) have the function of lasso.
So I write these code. However, I got different results of coef. Can someone
kindly explain.
# lasso using penalized
library(penalized)
pena.fit2<-penalized(HRLNM,penalized=~CN+NoSus,lambda1=1,model="logistic",standardize=TRUE)
pena.fit2
2012 Jun 15
0
argument "x" is missing, with no default - Please help find argument x
R programming question, not machine learning, although that's the content.
Apologies to all for whom the following code is eye-burning. I am using
foreach() to run a simulation on a randomForest model (actually conditional
randomForest ... "party" package). The simulation is in two dimensions.
examining how "mtry" and "ntrees" are related in terms of predictive
2011 Sep 08
1
Plotting question
Hi All,
I am plotting different lines in my graph and the problem I have is that if the first plot has smaller y value than the second plot, I will not be able to see the the top part of the graph. I do the following:plot(p1, avg="vertical", lwd=3, col="red", main ="all graphs")plot(p2, avg="vertical", lwd=3, col="pink", add = TRUE)
where p1 and
2011 Jun 20
2
Error of Cross Validation
Dear R users:
Recently, I tried to write a program to calculate cross-validated predicted
value.
My sources are as follows. However, the R reported an error.
Could you please check the sources? Thanks.
set.seed(100)
x<-rnorm(100)
y<-sample(rep(0:1,50),replace=T)
dat<-data.frame(x,y)
library(rms)
fito<-lrm(y~x)
preo<-predict(fito)
pre<-matrix(NA,nrow=100,ncol=200)
for (i in