regression

Looping regression and obtaining summary statistics in matrix form

旧时模样 提交于 2019-12-12 05:07:33
问题 I am trying to do a similar regression for 25 different portfolios and then finding the R^2 of all 25 regressions. Obviously i can do them individually by running P1<-lm(formula = df[1:24,1] - RiskFree ~ Mkt.RF + SMB + HML, data = df ) summary(P1)$r.squared 25 times to get all the r.square which is really time consuming (can't imagine if it's 100 or greater). I thought of doing a loop and here is where i got stuck. This is what i did sequence<-seq(1,25) P<-cbind(sequence) for(i in 2:26){ P[i

Obtaining regression coefficients from reduced major axis regression models using lmodel2 package

ぐ巨炮叔叔 提交于 2019-12-12 04:59:41
问题 I have a large data set with which I'm undertaking many regression analyses. I'm using a reduced major axis regression with r's lmodel2 package. What I need to do is extract the regression coefficients (r-squared, p-values, slope and intercept) from the RMA models. I can do this easily enough with the OLS regressions using: RSQ<-summary(model)$r.squared PVAL<-summary(model)$coefficients[2,4] INT<-summary(model)$coefficients[1,1] SLOPE<-summary(model)$coefficients[2,1] And then export them in

lme4::lmer reports “fixed-effect model matrix is rank deficient”, do I need a fix and how to?

旧城冷巷雨未停 提交于 2019-12-12 04:48:56
问题 I am trying to run a mixed-effects model that predicts F2_difference with the rest of the columns as predictors, but I get an error message that says fixed-effect model matrix is rank deficient so dropping 7 columns / coefficients. From this link, Fixed-effects model is rank deficient, I think I should use findLinearCombos in the R package caret . However, when I try findLinearCombos(data.df) , it gives me the error message Error in qr.default(object) : NA/NaN/Inf in foreign function call

How to get predictions for each set of parameters using GridSearchCV?

拜拜、爱过 提交于 2019-12-12 04:39:55
问题 I'm trying to find the best parameters for NN regression model using GridSearchCV with following code: param_grid = dict(optimizer=optimizer, epochs=epochs, batch_size=batches, init=init grid = GridSearchCV(estimator=model, param_grid=param_grid, scoring='neg_mean_squared_error') grid_result = grid.fit(input_train, target_train) pred = grid.predict(input_test) As I understand, grid.predict(input_test) uses best parameters to predict the given input set. Is there any way to evaluate

How to predict float vector labels with caffe?

元气小坏坏 提交于 2019-12-12 04:23:39
问题 I was wondering if it's possible to predict a 1-by-n feature associated to an input image using caffe. In this post there is a solution to make caffe predict a binary vector such as [1 0 1 0]. Is this solution also suitable if I have a 1-by-n float vector as label (such as [0.2, 0.1, 0.3, 0.4] ? I want to predict such a vector, not a binary vector label. 回答1: You can also think about this MultiTaskData Layer. It can parse float typed label vector as you mentioned in your question. 回答2: Yes; I

Find where species accumulation curve reaches asymptote

感情迁移 提交于 2019-12-12 03:43:09
问题 I have used the specaccum() command to develop species accumulation curves for my samples. Here is some example data: site1<-c(0,8,9,7,0,0,0,8,0,7,8,0) site2<-c(5,0,9,0,5,0,0,0,0,0,0,0) site3<-c(5,0,9,0,0,0,0,0,0,6,0,0) site4<-c(5,0,9,0,0,0,0,0,0,0,0,0) site5<-c(5,0,9,0,0,6,6,0,0,0,0,0) site6<-c(5,0,9,0,0,0,6,6,0,0,0,0) site7<-c(5,0,9,0,0,0,0,0,7,0,0,3) site8<-c(5,0,9,0,0,0,0,0,0,0,1,0) site9<-c(5,0,9,0,0,0,0,0,0,0,1,0) site10<-c(5,0,9,0,0,0,0,0,0,0,1,6) site11<-c(5,0,9,0,0,0,5,0,0,0,0,0)

What is the right algorithm to detect segmentations of a line chart? [closed]

烂漫一生 提交于 2019-12-12 03:37:35
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . To be concrete, given 2D numerical data as is shown as line plots below. There are peaks on a background average movement (with small vibrations). We want to find the values of pairs (x1, x2) if those peaks drops down to average; or (x1) only if the line doesn't back to the

R : constraining coefficients and error variance over multiple subsample regressions [closed]

家住魔仙堡 提交于 2019-12-12 03:33:36
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I'm working with R on a sample of 145 observations. I have created five subsamples each with 29 observations, while the response variable q has been sorted. As a result, subset1 contains the 29 lines of the data frame with the lowest output, subset2 contains the following 29 lines, etc. I am regressing the

Pandas Multi-Index - Can't convert non-uniquely indexed DataFrame to Panel

醉酒当歌 提交于 2019-12-12 03:25:19
问题 Given a time series data, I'm trying to use panel OLS with fixed effects in Python. I found this way to do it: Fixed effect in Pandas or Statsmodels My input data looks like this (I will called it df ): Name Permits_13 Score_13 Permits_14 Score_14 Permits_15 Score_15 0 P.S. 015 ROBERTO CLEMENTE 12.0 284 22 279 32 283 1 P.S. 019 ASHER LEVY 18.0 296 51 301 55 308 2 P.S. 020 ANNA SILVER 9.0 294 9 290 10 293 3 P.S. 034 FRANKLIN D. ROOSEVELT 3.0 294 4 292 1 296 4 P.S. 064 ROBERT SIMON 3.0 287 15

Error fitting a model in nls

隐身守侯 提交于 2019-12-12 02:36:08
问题 previous answers to similar questions have not help me to solve my problem. I am trying to fit a model y=a1*(1-exp(-a21*Age_WH40))^a3 , where a21=ln(1/a3)/a2 , and Age_WH40 goes from 1 to 40. I've plot the data and a line to get an idea of the starting values plot(MOE_WH40 ~ Age_WH40) lines(ts(8*(1-exp(log(1/3)/5*(1:40)))^3),col="red", lwd=2) fit.nlm_MOE4A.WH <- nls(MOE_WH40 ~ a*(1-exp(log(1/c)/b*Age_WH40))^b, start=list(a=10, b=6, c=2)) but even if I restrict the data to avoid dispersion I