regression

regarding the failure of stepwise variable selection in lm

爱⌒轻易说出口 提交于 2020-01-06 17:29:45
问题 I built a regression model using all the variables at first. full.model<-lm(y~as.matrix(x)) Then I tried to use step-wise variable selection reduce.model<-step(full.model,direction="backward") The running result is shown as follows, looks like it does not do anything. What is the problem of this scenario. I also include the detail of full.model in the following. > reduce.model<-step(full.model,direction="backward") Start: AIC=-121.19 y ~ as.matrix(x) Df Sum of Sq RSS AIC <none> 1.1 -121.19 -

regarding the failure of stepwise variable selection in lm

牧云@^-^@ 提交于 2020-01-06 17:28:31
问题 I built a regression model using all the variables at first. full.model<-lm(y~as.matrix(x)) Then I tried to use step-wise variable selection reduce.model<-step(full.model,direction="backward") The running result is shown as follows, looks like it does not do anything. What is the problem of this scenario. I also include the detail of full.model in the following. > reduce.model<-step(full.model,direction="backward") Start: AIC=-121.19 y ~ as.matrix(x) Df Sum of Sq RSS AIC <none> 1.1 -121.19 -

Getting a score of zero using cross val score

独自空忆成欢 提交于 2020-01-06 14:20:52
问题 I am trying to use cross_val_score on my dataset, but I keep getting zeros as the score: This is my code: df = pd.read_csv("Flaveria.csv") df = pd.get_dummies(df, columns=["N level", "species"], drop_first=True) # Extracting the target value from the dataset X = df.iloc[:, df.columns != "Plant Weight(g)"] y = np.array(df.iloc[:, 0], dtype="S6") logreg = LogisticRegression() loo = LeaveOneOut() scores = cross_val_score(logreg, X, y, cv=loo) print(scores) The features are categorical values,

How to run a regression which report all factor variables?

寵の児 提交于 2020-01-06 06:55:53
问题 I want to run a regression that calculates the estimated values for all levels of a factor variable. By default, Stata omits one dummy as a base level. When I use the allbaselevels option, it just shows a zero value for a base level: regress adjusted_volume i.rounded_time, allbaselevels SAS shows all the estimated values of categorical variables when the constant has been removed. How can i do the same thing in Stata? 回答1: The option allbaselevels is one of several display options , which can

How can I find the different points of a system of equations? [duplicate]

廉价感情. 提交于 2020-01-06 04:55:13
问题 This question already has answers here : How to solve a set of Linear equations? (2 answers) Closed 4 years ago . I've got to solve this system of equations: aQ + bP = c dQ + eP = f I have to find 100 values Q and P that solve the systems with 100 randomly drawn coefficients from the following distributions: a ~ N( 100; 10) b ~ N(-1;0.1) c ~ N(10;1) d ~ N(10;0.1) e ~ N(100;10) f ~ N(10;0.1) Which I did by doing the following: a<-rnorm(100,mean=100,sd=10) b<-rnorm(100,mean=-1,sd=.1) c<-rnorm

How to “wrap [DCdensity] in additional graphical options to modify the plot”? rdd package

痴心易碎 提交于 2020-01-06 04:15:33
问题 I am using the rdd (regression discontinuity design) package's DCdensity function and would like to change how the plot looks. I went to the help file for this function and found the following, under plot : "The user may wrap this function in additional graphical options to modify the plot." How can I go about doing this in practice? I note that my question is the same as R plot options in rdd::DCdensity. However, the one answer to this old question is unsatisfactory to me because I do not

create hfd5 with float numbers for caffe

大兔子大兔子 提交于 2020-01-06 02:47:09
问题 I want to feed caffe vectors of labels (multi label regression problem), so I have used the following link for creating hdf5 files. Using this code, I created an image_list.txt which contains path of files and float labels in each line, e.g. /home/deep/00000.bmp 0.9997 0.0236 -0.0082 -0.0231 0.9980 0.0588 0.0096 -0.0586 0.9982 -0.0046 0.1084 0.3938 but it seems that it only works for integer label. when I run demo.m the following error comes: Error using dataread Trouble reading integer from

How to debug “contrasts can be applied only to factors with 2 or more levels” error?

社会主义新天地 提交于 2020-01-06 01:56:32
问题 Here are all the variables I'm working with: str(ad.train) $ Date : Factor w/ 427 levels "2012-03-24","2012-03-29",..: 4 7 12 14 19 21 24 29 31 34 ... $ Team : Factor w/ 18 levels "Adelaide","Brisbane Lions",..: 1 1 1 1 1 1 1 1 1 1 ... $ Season : int 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 ... $ Round : Factor w/ 28 levels "EF","GF","PF",..: 5 16 21 22 23 24 25 26 27 6 ... $ Score : int 137 82 84 96 110 99 122 124 49 111 ... $ Margin : int 69 18 -56 46 19 5 50 69 -26 29 ... $

Changing binary variables to Yes/No

南楼画角 提交于 2020-01-05 13:49:05
问题 So I have a data frame that I'd like to analyze. The problem is that instead of Yes/No, there are a bunch of 1s and 0s (1 being Yes, 0 being No) in the data frame. How do I modify the data frame to make it so instead of the 1s and 0s there are Yes and No so I can use logistic regression? I am sure there is a simple fix for this that I am not thinking of Thanks! 回答1: Use ?factor . See this example > set.seed(1) > dummyVariable <- sample(c(0,1), 10, TRUE) # bunch of 0 and 1 > newVariable <-

how to change softmaxlayer with regression in matconvnet

喜你入骨 提交于 2020-01-05 07:33:37
问题 I am trying to train MNIST data set with single output. It means when i give an 28*28 input (image) the model gives us a just number. For example i give '5', the model give me as a result 4.9,5, 5.002 or close to 5. So I have red some documents. People tells softmaxlayer have to be changed with regression layer. For doing do this. I am using matconvnet library and its mnist example. I have changed my network and written regression layer loss function. these are my codes: net.layers = {} ; net