[R] How to fit my data with a distribution?

2012-01-06 Thread Andra Isan
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]]

Re: [R] How to fit my data with a distribution?

2012-01-06 Thread Andra Isan
That MASS::fitdistr is used for the case when I have some sense about the distribution of my data. When I do not know anything about my data, is there any function that can I use to tell what distribution of my data is? Thanks a lot, Andra From: R. Michael

[R] Plotting question

2011-09-08 Thread Andra Isan
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,

[R] Question about model selection for glm -- how to select features based on BIC?

2011-09-07 Thread Andra Isan
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

[R] ROCR package question for evaluating two regression models

2011-09-02 Thread Andra Isan
Hello All,  I have used logistic regression glm in R and I am evaluating two models both learned with glm but with different predictors. model1 - glm (Y ~ x4+ x5+ x6+ x7, data = dat, family = binomial(link=logit))model2 - glm (Y~ x1 + x2 +x3 , data = dat, family = binomial(link=logit))  and I

[R] Question about BIC of two different regression models? how should we compare two regression models?

2011-09-01 Thread Andra Isan
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]]

[R] Question about paste

2011-08-30 Thread Andra Isan
Hello All,  I have a data frame called train.data which has 100 columns. I am using an statistical package to learn a model and the format of using that package is as follows: ex5 - stepFlexmix(cbind(y,1-y)~x|id2, data=NPreg, k=2, model=FLXMRglm(family=binomial), nrep=5) the

[R] How to order based on the second two columns?

2011-08-29 Thread Andra Isan
Hello All, I have a data frame consisting of 4 columns (id1, id2, y, pred) where pred is the predicted value based on the glm function and my data frame is called all. data is another data frame that has all data but I want to put together some important columns from my original data frame

[R] Mixture of Regressions

2011-08-26 Thread Andra Isan
Dear All, I have two hidden classes for my data set that I would like to learn them based on the Mixture of Binomial regression model. I was wondering if there is any package that I can use for that purpose. Has any one tried any package for the Mixture models? Thanks a lot, Andra

[R] Grouping variables in a data frame

2011-08-26 Thread Andra Isan
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

[R] Question about FlexMix package

2011-08-25 Thread Andra Isan
Hello All, I am trying to use FlexMix package for my two linear regression models: http://finzi.psych.upenn.edu/R/library/flexmix/doc/regression-examples.pdf y1 = w1 * x1 + w2 *x2 + w3 * x3 +beta1 y2 = w4 * x4 + w4 *x4 + w4 * x4 +beta2 and I would like to combine these two regression models

[R] How to find the accuracy of the predicted glm model with family = binomial (link = logit)

2011-08-25 Thread Andra Isan
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

[R] How to do cross validation with glm?

2011-08-24 Thread Andra Isan
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

Re: [R] How to do cross validation with glm?

2011-08-24 Thread Andra Isan
validation with glm? To: Andra Isan andra_i...@yahoo.com Cc: r-help@r-project.org Date: Wednesday, August 24, 2011, 10:11 AM What you describe is not cross-validation, so I am afraid we do not know what you mean.  And cv.glm does 'prediction for the hold-out data' for you: you can read

[R] How to combine two learned regression models?

2011-08-24 Thread Andra Isan
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

Re: [R] GLM question

2011-08-23 Thread Andra Isan
question To: Andra Isan andra_i...@yahoo.com Cc: r-help@r-project.org Date: Monday, August 22, 2011, 9:54 PM Hi Andra, There are several problems with what you are doing (by the way, I point them out so you can learn and improve, not to be harsh or rude). The good news is there is a solution

[R] GLM question

2011-08-22 Thread Andra Isan
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],

[R] a Question regarding glm for linear regression

2011-08-19 Thread Andra Isan
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

[R] Cv.glment question -- why giving me an error

2011-08-11 Thread Andra Isan
Hi All,  I am trying to run cv.glmnet(x,y,family=multinomial, nfolds =4) and I only have 8 observations and the number of features I have is 1000, so my x matrix is 8 by 1000 and when I run the following, I get this error, I am not sure what is causing this problem.  Error in predmat[which, ,

[R] Question about NULL matrix? Can I define a NULL matrix in R?

2011-08-10 Thread Andra Isan
Hi All,  I would like to create a matrix in R but I dont know the size of my matrix. I only know the size of the columns but not the size of the rows. So, is there any way to create a dynamic matrix of size NULL by n_cols? and then add to that matrix? I know for a vector, I can do this: x= NULL

[R] glmnet

2011-08-09 Thread Andra Isan
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,