similar to: apply lm function to dataset split by two variables

Displaying 20 results from an estimated 2000 matches similar to: "apply lm function to dataset split by two variables"

2012 Feb 01
1
package sampling, function strata
Dear all, I have to select 122 stratified random samples from a population of >3900 cells. I have 41 strata and I have to draw a different number of samples from them(between 2 and 8). I have tried to apply the funtion strata following the instruction in the manual: strata(dataframe, stratanames=NULL, size, method=c("srswor"), pik,description=TRUE) but I get the error
2008 Dec 13
2
weird pasting of ".value" when list is returned
could someone explain why the name of FPVAL gets " .value" concatenated onto it when the code below is run and temp is returned. I've been trying to figure this out for too long. It doesn't matter when I put the FPVAL in the return statement. It happens regardless of whether it's first or last. Thanks. f.lmmultenhanced <- function(response, pred1, pred2) {
2009 Oct 13
2
Linear Regression Question
Dear Sir or Madam, I am a student at MSc Probability and Finance at Paris 6 University/ Ecole Polytechnique. I am using R and I can't find an answer to the following question. I will be very thankful if you can answer it. I have two vectors rendements_CAC40 and rendements_AlcatelLucent. I use the lm function as follows, and then the sumarry function: regression=lm(rendements_CAC40 ~
2009 Apr 05
4
extract the p value of F statistics from the lm class
Dear R users I have run an regression and want to extract the p value of the F statistics, but I can find a way to do that. x<-summary(lm(log(RV2)~log(IV.m),data=b)) Call: lm(formula = log(RV2) ~ log(IV.m), data = b[[11]]) Residuals: Min 1Q Median 3Q Max -0.26511 -0.09718 -0.01326 0.11095 0.29777 Coefficients: Estimate Std. Error t value Pr(>|t|)
2010 Apr 26
1
Error in pf(q, df1, df2, lower.tail, log.p) : Non-numeric argument to mathematical function
inputfille snpid indid genotype gvariable probeid gene geneexpression rs1040480 CHB_NA18524 C/T 2 GI_19743926-I PTPRT 5.850586 rs1040480 CHB_NA18526 C/C 1 GI_19743926-I PTPRT 6.028641 rs1040480 CHB_NA18529 C/C 3 GI_19743926-I PTPRT 5.944392 rs1040481 CHB_NA18532 C/C 1 GI_19743926-I PTPRT 5.938578 rs1040481 CHB_NA18537 C/C 2 GI_19743926-I PTPRT 5.874439 rs1040481 CHB_NA18540 C/C 3 GI_19743926-I
2003 Jul 07
1
P-value for F from summary.lm (was RE: (no subject))
[Please use the subject line!] In the help page for summary.lm, the "Value" section says that the returned object has a component called "fstatistic", which has the F-statistic and the associated numerator and denominator degrees of freedom. You can get the p-value by something like: fstat <- summary(speciallinearmodel)$fstatistic pval <- pf(fstat[1], fstat[2],
2010 Nov 29
1
extracting P values from lm model
Hello I am trying to get out of an lm model the fstatistics, however after I run the model I write > names(Model) and the fstatistic does not appear only these. names(Model) [1] "coefficients" "residuals" "effects" "rank" "fitted.values" [6] "assign" "qr" "df.residual"
2011 Aug 15
2
Extracting information from lm results (multiple model runs)
Just to inform: I posted that before in R-sig-ecology but as it might be interesting also for other useRs, I post it also to the general r-user list: Hello Alexandre, thank you very much. I also found another way to extract summarizing information from lm results over e.g. 1000 repeated model runs: results2 <- t(as.data.frame(results)) summary(results2) Although some questions popped up in
1999 Nov 23
1
p-value from lm
I'd like to automatically plot the p-value and r^2 of a linear model. I know that I can extract r^2 with foo <- lm(y~x) a <- summary(foo) a$r.squared I can't find any similar functionality to obtain the p-value based on the ftest a$fstatistic returns the actual f-test and df, but not the p-value. Any thoughts? Thanks, Adam using R-0.65.1 Win32
2011 May 19
2
Error in svg() : cairo-based devices are not supported on this build
Hello, Sorry if it is not the right place.. I installed R-2.13.0 on a x86_64 linux server. All went fine, but the svg() function yells: > svg() Error in svg() : cairo-based devices are not supported on this build I have the Cairo, cairoDevice, RSvgDevice packages installed, and running. > Cairo.capabilities() png jpeg tiff pdf svg ps x11 win TRUE TRUE TRUE TRUE TRUE
2006 Jul 26
1
.Call question
Writing R Ext says to treat R objects that are arguments to .Call as read only (i.e. don't modify). I have a long list of lists that and I want to avoid the overhead of a copy in my C code. I would just like to modify some of the elements of list by replacing them with elements of exactly the same size/type. below is an example of the essence of the problem. This seems to work. Is this
2016 Apr 29
2
lm() with spearman corr option ?
Hi, A following function was kindly provided by GGally?s maintainer, Barret Schloerke. function(data, mapping, ...) { p <- ggplot(data = data, mapping = mapping) + geom_point(color = I("blue")) + geom_smooth(method = "lm", color = I("black"), ...) + theme_blank() + theme(panel.border=element_rect(fill=NA, linetype =
2005 Dec 09
3
retrieving p-values in lm
Dear list, I want to retrieve the p-value of a two-polynomial regression. For a one-polynomial lm I can easily do this with: summary(lm(b~a, data=c)[[4]][[8]]. But how do I find the final p-value in the two-polynomial regression? Under $coefficients I don't find it Any suggestions? Patrick alt <-(2260,2183,2189,1930,2435, 2000,2100,2050,2020,2470, 1700,2310,2090,1560,2060,
2011 Aug 04
3
functions on rows or columns of two (or more) arrays
I realize this should be simple, but even after reading over the several help pages several times, I still cannot decide between the myriad "apply" functions to address it. I simply want to apply a function to all the rows (or columns) of the same index from two (or more) identically sized arrays (or data frames). For example: > a=matrix(1:50,nrow=10) >
2011 Oct 31
1
Significance of trend
Hi everyone, I'm trying to determine the significance of a trendline. From my internet search months ago, I came across the following post. I modified tim and dat for simiplicity. tim <- 1:10 dat <- c(0.17, 1.09 ,0.11, 0.82, 0.23, 0.38 ,2.47 ,0.41 ,0.75, 1.44) fstat <- summary(lm(dat~tim))$fstatistic p.val <-
2012 Aug 29
1
LDAP access to Samba 4
Hello, I am currently migrating from OpenLDAP to Samba 4 PDC, and I have a webpage (PHP/Apache) available for users so that they can change their password on the existing LDAP server. I attempted to adjust that script to change the password on the Samba 4 AD controller, but I get a "cannot connect" error to LDAP. The web server the password script is running on is not on the same
2011 Oct 24
3
extract the p value
OK, what is the trick to extracting the overall p value from an lm object? It shows up in the summary(lm(model)) output but I can't seem to extract it: > test2 = apply(aa, 1, function(x) summary(lm(x[,1] ~ 0 + x[,3] + x[,6]))) > test2[[1]] Call: lm(formula = x[, 1] ~ 0 + x[, 3] + x[, 6]) [omitted summary output] F-statistic: 40.94 on 2 and 7 DF, p-value: 0.0001371 It does not seem
2014 Feb 04
1
How to change objectSid?
Hi, I'm trying to modify the objectSid of a group using python-ldap. I've found that I need a server control to do it but doesn't work. The code that I'm using: modlist = [ (ldap.MOD_REPLACE, 'objectSid', s3sid_packed) ] LDB_CONTROL_PROVISION_OID = "1.3.6.1.4.1.7165.4.3.16" LDB_CONTROL_RELAX_OID = "1.3.6.1.4.1.4203.666.5.12"
2012 Jun 05
1
nls: how do you know if the model is significant?
Hi all, I'm struggling with nls. How do you know if your model is significant? For a lm, you get a p-value, but you don't get it for a nls. Is there a way to calculate it? For a lm I use this: a<-summary(lm(model ~obs)) f.stat<-a$fstatistic p.value<-1-pf(f.stat["value"],f.stat["numdf"],f.stat["dendf"]) Is there something similar for a nls?
2009 Feb 24
1
Box.test reference correction (PR#13554)
Full_Name: Peter Solymos Version: 2.8.1 OS: Windows Submission from: (NULL) (129.128.141.92) The help page of the Box.test function (stats) states that the Ljung-Box test was published in: Ljung, G. M. and Box, G. E. P. (1978), On a measure of lack of fit in time series models. Biometrika 65, 553--564. The page numbers are incorrect. The correct citation should be as follows: Ljung, G. M.