regression

R - Getting Column of Dataframe from String [duplicate]

橙三吉。 提交于 2019-12-09 04:02:41
问题 This question already has answers here : Dynamically select data frame columns using $ and a vector of column names (8 answers) Closed 3 years ago . I am trying to create a function that allows the conversion of selected columns of a data frame to categorical data type (factor) before running a regression analysis. Question is how do I slice a particular column from a data frame using a string (character). Example: strColumnNames <- "Admit,Rank" strDelimiter <- "," strSplittedColumnNames <-

How to correctly `dput` a fitted linear model (by `lm`) to an ASCII file and recreate it later?

梦想与她 提交于 2019-12-08 22:29:39
问题 I want to persist a lm object to a file and reload it into another program. I know I can do this by writing/reading a binary file via saveRDS / readRDS , but I'd like to have an ASCII file instead of a binary file. At a more general level, I'd like to know why my idioms for reading in dput output in general is not behaving as I'd expect. Below are examples of making a simple fit, and successful and unsuccessful recreations of the model: dat_train <- data.frame(x=1:4, z=c(1, 2.1, 2.9, 4)) fit

Should I Keep Registering A Failure?

你说的曾经没有我的故事 提交于 2019-12-08 21:33:05
问题 I'm working on an automated regression test suite for an app which I maintain. While developing the automated regression test, I ran across some behavior that's almost certainly a bug. So, for now, I've modified the automated regression test to not register a failure--it's deliberately allowing this bad behavior to go by, I mean. So, I am interested in the opinions of others on this site. Obviously, I'll add a bug to our defect tracking to make sure this error behavior gets fixed. But are

Scatterplot with single regression line despite two groups using ggplot2

半腔热情 提交于 2019-12-08 18:58:34
问题 I would like to produce a scatter plot with ggplot2, which contains both a regression line through all data points (regardless which group they are from), but at the same time varies the shape of the markers by the grouping variable. The code below produces the group markers, but comes up with TWO regression lines, one for each group. #model=lm(df, ParamY~ParamX) p1<-ggplot(df,aes(x=ParamX,y=ParamY,shape=group)) + geom_point() + stat_smooth(method=lm) How can I program that? 回答1: you shouldn

R calculate robust standard errors (vcovHC) for lm model with singularities

爷,独闯天下 提交于 2019-12-08 17:30:39
问题 In R, how can I calculate robust standard errors using vcovHC() when some coefficients are dropped due to singularities? The standard lm function seems to do fine calculating normal standard errors for all coefficients that are actually estimated, but vcovHC() throws an error: "Error in bread. %*% meat. : non-conformable arguments". (The actual data I'm using is a bit more complicated. In fact, it is a model using two different fixed effects and I run into local singularities which I cannot

Setting an upper bound of 0 on a 3d loess smoothing with negative values in R

血红的双手。 提交于 2019-12-08 17:15:40
问题 I have a bit of a bizarre question, but hoping someone can help me. I am attempting to create a surface plot of the bottom of a lake and then add some points showing plant frequency for a visual of where aquatic plants are occurring throughout the lake. Right now I am working on creating the surface plot in both scatterplot3d and wireframe using the scatterplot3d and lattice packages, respectively, in R. In order to achieve the type of plot I am interested in I have converted the depths to

Only run unit tests which's respective source code has changed?

浪尽此生 提交于 2019-12-08 14:58:09
问题 I am running unit tests and Selenium tests in our Jenkins CI server. As we all know, tests take long to run in a large project. Is there a tool/framework for Java which could only trigger tests whose respective source code has changed? This because not every commit to SCM affects all areas of the source code... I am using Cobertura for code coverage and Surefire for reporting. EDIT: I found Atlassian Clover, but I am searching for a free solution. 回答1: I am running unit tests and Selenium

Sigmoidal Modeling in R

徘徊边缘 提交于 2019-12-08 12:28:53
问题 I am currently trying to model and plot a sigmoidal curve with a low amount of points. >myExperiment V1 N mean 0.1 9 0.9 1 9 0.8 10 9 0.1 5 9 0.2 I am using the nlsLM function from the minpack.lm package. > nlsLM(mean2 ~ -a/(1 + exp(-b * (v1-o)))) Nonlinear regression model model: mean2 ~ -a/(1 + exp(-b * (v1 - o))) data: parent.frame() a b o -1.452 -0.451 1.292 residual sum-of-squares: 0.007017 Number of iterations to convergence: 27 Achieved convergence tolerance: 1.49e-08 Warning message:

Getting shape dimension errors with a simple regression using Keras

荒凉一梦 提交于 2019-12-08 12:24:37
问题 I am trying to train a simple regression network on Keras. The input of the network (X_test) are 100 images, and the output another 100. The problem is that I am getting a shape error: I have played with another network architecture, activations,... and the error is still there. Here I place my code: M=32 input_layer = Input(shape=(3, 32, 32), name="input") sc1_conv1 = Convolution2D(96, 3, 3, activation='relu', init='glorot_uniform', subsample=(2,2), border_mode='valid')(input_layer) sc1

Interpreting estimates of categorical predictors in linear regression [duplicate]

别说谁变了你拦得住时间么 提交于 2019-12-08 11:44:53
问题 This question already has answers here : Interpreting interactions in a regression model (2 answers) Closed 3 years ago . I'm new to linear regression and I'm trying to figure out how to interpret the summary results. I'm having difficulty interpreting the estimates of categorical predictors. Consider the following example. I added the columns age and length to include a numeric predictor and numeric target. library(MASS) data <- as.data.frame(HairEyeColor) data$length <- c(155, 173, 172, 176